@deepraxis/cli 0.3.0-dev.3c2e98e → 0.3.0-dev.3f4bbf9
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 +16 -3
- package/dist/praxis.js +1282 -126
- package/package.json +1 -1
package/dist/praxis.js
CHANGED
|
@@ -13984,8 +13984,14 @@ 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
13986
|
"cognition-weight-driven": { kind: "RELEASE", type: "BOOLEAN", default: false, owner: "praxis-bd", ticket: 1760, expires: "2026-12-05", system: "devops" },
|
|
13987
|
+
crm: { kind: "RELEASE", type: "BOOLEAN", default: false, owner: "usr_rv860m7z9h8szkgma56cd14n", ticket: 2179, expires: "2026-12-31", system: "devops" },
|
|
13988
|
+
"delivery-rules-v2": { kind: "RELEASE", type: "BOOLEAN", default: false, owner: "usr_t60d4g5z82rhbtbfrfxfbdxe", ticket: 2048, expires: "2026-11-28", system: "devops" },
|
|
13987
13989
|
"model-access-gate": { kind: "RELEASE", type: "BOOLEAN", default: false, owner: "usr_t60d4g5z82rhbtbfrfxfbdxe", ticket: 1933, expires: "2026-12-15", system: "devops" },
|
|
13988
13990
|
"open-project": { kind: "RELEASE", type: "BOOLEAN", default: false, owner: "praxis-51", ticket: 1488, expires: "2026-11-25", system: "devops" },
|
|
13991
|
+
"requests-never-hold": { kind: "RELEASE", type: "BOOLEAN", default: false, owner: "usr_t60d4g5z82rhbtbfrfxfbdxe", ticket: 2119, expires: "2026-11-29", system: "devops" },
|
|
13992
|
+
"requests-v1": { kind: "RELEASE", type: "BOOLEAN", default: false, owner: "usr_t60d4g5z82rhbtbfrfxfbdxe", ticket: 2057, expires: "2026-11-28", system: "devops" },
|
|
13993
|
+
"router-precommit-hedge": { kind: "RELEASE", type: "BOOLEAN", default: false, owner: "usr_t60d4g5z82rhbtbfrfxfbdxe", ticket: 2052, expires: "2026-11-28", system: "devops" },
|
|
13994
|
+
"router-responses-hedge": { kind: "RELEASE", type: "BOOLEAN", default: false, owner: "usr_t60d4g5z82rhbtbfrfxfbdxe", ticket: 2149, expires: "2026-11-28", system: "devops" },
|
|
13989
13995
|
"search-provider-routing": { kind: "RELEASE", type: "BOOLEAN", default: false, owner: "praxis-98", ticket: 716, expires: "2026-12-31", system: "devops" },
|
|
13990
13996
|
"unit-live-probe": { kind: "RELEASE", type: "BOOLEAN", default: false, owner: "usr_t60d4g5z82rhbtbfrfxfbdxe", ticket: null, expires: "2026-11-19", system: "devops" }
|
|
13991
13997
|
};
|
|
@@ -14012,7 +14018,7 @@ function checkFlags(files, registry, today = new Date().toISOString().slice(0, 1
|
|
|
14012
14018
|
}
|
|
14013
14019
|
const registryFile = production.find((f) => f.path.endsWith("flag-registry.generated.ts"));
|
|
14014
14020
|
const registryLine = (key) => registryFile ? lineOf(registryFile.text, Math.max(0, registryFile.text.indexOf(`"${key}":`))) : 1;
|
|
14015
|
-
const add = (file, offset,
|
|
14021
|
+
const add = (file, offset, message2) => issues.push({ file: file.path, line: lineOf(file.text, offset), message: message2 });
|
|
14016
14022
|
const referencedKeysIn = (file) => {
|
|
14017
14023
|
for (const key of registered) {
|
|
14018
14024
|
const literal = new RegExp(`(?:"|')${key.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}(?:"|')`);
|
|
@@ -14031,6 +14037,8 @@ function checkFlags(files, registry, today = new Date().toISOString().slice(0, 1
|
|
|
14031
14037
|
add(f, browserList.index + entry.index, `unregistered browser flag key "${entry[1]}"`);
|
|
14032
14038
|
}
|
|
14033
14039
|
}
|
|
14040
|
+
if (/\.generated\.[cm]?[jt]sx?$/.test(f.path))
|
|
14041
|
+
continue;
|
|
14034
14042
|
const calls = /(\.bool|\breadBrowserFlag|\buseBrowserFlag)\s*\(\s*([^,)\n]+)/g;
|
|
14035
14043
|
for (const m of f.text.matchAll(calls)) {
|
|
14036
14044
|
if (/function\s*$/.test(f.text.slice(Math.max(0, m.index - 20), m.index)))
|
|
@@ -14099,7 +14107,7 @@ async function main() {
|
|
|
14099
14107
|
else
|
|
14100
14108
|
console.log(`Feature flag registry check passed (${Object.keys(FLAGS).length} registered flags).`);
|
|
14101
14109
|
}
|
|
14102
|
-
var isTest = (path) => /(^|\/)(spec|__tests__)(\/|$)|\.(test|spec)\.[cm]?[jt]sx?$/.test(path), lineOf = (
|
|
14110
|
+
var isTest = (path) => /(^|\/)(spec|__tests__)(\/|$)|\.(test|spec)\.[cm]?[jt]sx?$/.test(path), lineOf = (text3, offset) => text3.slice(0, offset).split(`
|
|
14103
14111
|
`).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;
|
|
14104
14112
|
var init_check_flags = __esm(() => {
|
|
14105
14113
|
init_flag_registry_generated();
|
|
@@ -14297,7 +14305,7 @@ async function checkRegistrySync(ports = {}) {
|
|
|
14297
14305
|
}
|
|
14298
14306
|
async function syncFlags(ports = {}) {
|
|
14299
14307
|
const registry = ports.registry ?? registryUrl;
|
|
14300
|
-
const write = ports.write ?? ((target,
|
|
14308
|
+
const write = ports.write ?? ((target, text3) => writeFile4(target, text3));
|
|
14301
14309
|
const log = ports.log ?? console.log;
|
|
14302
14310
|
const error = ports.error ?? console.error;
|
|
14303
14311
|
const devops = await (ports.devops ?? readDevopsFlags)();
|
|
@@ -14534,12 +14542,13 @@ async function runEngineDelegation(delegation, options) {
|
|
|
14534
14542
|
}
|
|
14535
14543
|
|
|
14536
14544
|
// src/main.ts
|
|
14537
|
-
import { existsSync as existsSync4 } from "node:fs";
|
|
14545
|
+
import { existsSync as existsSync4, readFileSync as readFileSync3, unlinkSync } from "node:fs";
|
|
14538
14546
|
import { mkdir as mkdir4, readFile as readFile7, readdir as readdir3, writeFile as writeFile5 } from "node:fs/promises";
|
|
14539
|
-
import { resolve as resolve11 } from "node:path";
|
|
14547
|
+
import { dirname as dirname10, join as join12, resolve as resolve11 } from "node:path";
|
|
14548
|
+
import { homedir as homedir3 } from "node:os";
|
|
14540
14549
|
import { pathToFileURL } from "node:url";
|
|
14541
14550
|
import { createHash as createHash5 } from "node:crypto";
|
|
14542
|
-
import { spawn as
|
|
14551
|
+
import { spawn as spawn5 } from "node:child_process";
|
|
14543
14552
|
import { createInterface } from "node:readline";
|
|
14544
14553
|
|
|
14545
14554
|
// ../../packages/sdk/typescript/src/operations.generated.ts
|
|
@@ -15594,8 +15603,8 @@ Idempotent. Access tokens revoked while the customer was blocked stay revoked; s
|
|
|
15594
15603
|
{
|
|
15595
15604
|
resource: "agent.agents.events",
|
|
15596
15605
|
method: "stream",
|
|
15597
|
-
summary: "Follow
|
|
15598
|
-
description: "Follow
|
|
15606
|
+
summary: "Follow an agent live",
|
|
15607
|
+
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.",
|
|
15599
15608
|
http: "GET",
|
|
15600
15609
|
path: "/agent/v1/agents/{agent_id}/events/stream",
|
|
15601
15610
|
streaming: "always",
|
|
@@ -15621,6 +15630,40 @@ Idempotent. Access tokens revoked while the customer was blocked stay revoked; s
|
|
|
15621
15630
|
}
|
|
15622
15631
|
]
|
|
15623
15632
|
},
|
|
15633
|
+
{
|
|
15634
|
+
resource: "agent.agents.inbox.letters",
|
|
15635
|
+
method: "list",
|
|
15636
|
+
summary: "List an assume agent's waiting letters",
|
|
15637
|
+
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.",
|
|
15638
|
+
http: "GET",
|
|
15639
|
+
path: "/agent/v1/agents/{agent_id}/inbox/letters",
|
|
15640
|
+
streaming: "no",
|
|
15641
|
+
pagination: false,
|
|
15642
|
+
pathParams: [
|
|
15643
|
+
{
|
|
15644
|
+
name: "agent_id",
|
|
15645
|
+
sdkName: "agent_id",
|
|
15646
|
+
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_…."
|
|
15647
|
+
}
|
|
15648
|
+
],
|
|
15649
|
+
query: [
|
|
15650
|
+
{
|
|
15651
|
+
name: "unread",
|
|
15652
|
+
type: "boolean",
|
|
15653
|
+
enum: [
|
|
15654
|
+
true
|
|
15655
|
+
],
|
|
15656
|
+
required: false,
|
|
15657
|
+
description: "Only true is accepted, which is also the default; this read lists waiting (unread) letters and nothing else."
|
|
15658
|
+
},
|
|
15659
|
+
{
|
|
15660
|
+
name: "limit",
|
|
15661
|
+
type: "integer",
|
|
15662
|
+
required: false,
|
|
15663
|
+
description: "How many of the newest unread letters to return, 1 to 50 (default 20); unread always counts every waiting letter."
|
|
15664
|
+
}
|
|
15665
|
+
]
|
|
15666
|
+
},
|
|
15624
15667
|
{
|
|
15625
15668
|
resource: "agent.agents.unarchive",
|
|
15626
15669
|
method: "create",
|
|
@@ -15983,18 +16026,14 @@ Praxis extension: the preview conversion endpoint. The browser never parses an u
|
|
|
15983
16026
|
description: "Computer id (cmp_...), as returned by computers.create or computers.list."
|
|
15984
16027
|
}
|
|
15985
16028
|
],
|
|
15986
|
-
query: [
|
|
15987
|
-
|
|
15988
|
-
|
|
15989
|
-
|
|
15990
|
-
|
|
15991
|
-
|
|
15992
|
-
|
|
15993
|
-
|
|
15994
|
-
description: "Name of the entry or object."
|
|
15995
|
-
}
|
|
15996
|
-
]
|
|
15997
|
-
}
|
|
16029
|
+
query: [
|
|
16030
|
+
{
|
|
16031
|
+
name: "path",
|
|
16032
|
+
type: "string",
|
|
16033
|
+
required: true,
|
|
16034
|
+
description: "Absolute path of the document on the computer, for example /home/user/workspace/deck.pptx. The request has no body."
|
|
16035
|
+
}
|
|
16036
|
+
]
|
|
15998
16037
|
},
|
|
15999
16038
|
{
|
|
16000
16039
|
resource: "agent.computers.leases",
|
|
@@ -16986,6 +17025,68 @@ delete it. Omit the field to preserve.`
|
|
|
16986
17025
|
],
|
|
16987
17026
|
query: []
|
|
16988
17027
|
},
|
|
17028
|
+
{
|
|
17029
|
+
resource: "agent.sessions.artifacts",
|
|
17030
|
+
method: "list",
|
|
17031
|
+
summary: "List Session Artifacts (Extension)",
|
|
17032
|
+
description: `List the files this session delivered; an end-customer token reads its own session.
|
|
17033
|
+
|
|
17034
|
+
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.`,
|
|
17035
|
+
http: "GET",
|
|
17036
|
+
path: "/agent/v1/sessions/{session_id}/artifacts",
|
|
17037
|
+
streaming: "no",
|
|
17038
|
+
pagination: false,
|
|
17039
|
+
pathParams: [
|
|
17040
|
+
{
|
|
17041
|
+
name: "session_id",
|
|
17042
|
+
sdkName: "session_id",
|
|
17043
|
+
description: "Session id from session creation or listing."
|
|
17044
|
+
}
|
|
17045
|
+
],
|
|
17046
|
+
query: []
|
|
17047
|
+
},
|
|
17048
|
+
{
|
|
17049
|
+
resource: "agent.sessions.artifacts.contentUrl",
|
|
17050
|
+
method: "create",
|
|
17051
|
+
summary: "Create Artifact Content URL (Extension)",
|
|
17052
|
+
description: `Mint a short-lived download address for one file of an artifact.
|
|
17053
|
+
|
|
17054
|
+
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.`,
|
|
17055
|
+
http: "POST",
|
|
17056
|
+
path: "/agent/v1/sessions/{session_id}/artifacts/{artifact_id}/content_url",
|
|
17057
|
+
streaming: "no",
|
|
17058
|
+
pagination: false,
|
|
17059
|
+
pathParams: [
|
|
17060
|
+
{
|
|
17061
|
+
name: "session_id",
|
|
17062
|
+
sdkName: "session_id",
|
|
17063
|
+
description: "Session id from session creation or listing."
|
|
17064
|
+
},
|
|
17065
|
+
{
|
|
17066
|
+
name: "artifact_id",
|
|
17067
|
+
sdkName: "artifact_id",
|
|
17068
|
+
description: "Artifact id (art_...) from the artifact list or an agent.artifact_delivered event."
|
|
17069
|
+
}
|
|
17070
|
+
],
|
|
17071
|
+
query: [],
|
|
17072
|
+
body: {
|
|
17073
|
+
required: false,
|
|
17074
|
+
fields: [
|
|
17075
|
+
{
|
|
17076
|
+
name: "part",
|
|
17077
|
+
type: "integer",
|
|
17078
|
+
required: false,
|
|
17079
|
+
description: "Index into the artifact's parts; defaults to 0."
|
|
17080
|
+
},
|
|
17081
|
+
{
|
|
17082
|
+
name: "ttl_seconds",
|
|
17083
|
+
type: "integer",
|
|
17084
|
+
required: false,
|
|
17085
|
+
description: "How long the address works, 60 to 300 seconds; defaults to 300."
|
|
17086
|
+
}
|
|
17087
|
+
]
|
|
17088
|
+
}
|
|
17089
|
+
},
|
|
16989
17090
|
{
|
|
16990
17091
|
resource: "agent.sessions.backgroundTasks",
|
|
16991
17092
|
method: "list",
|
|
@@ -17169,7 +17270,7 @@ Praxis extension available only on /agent/v1, following Claude Agent SDK getCont
|
|
|
17169
17270
|
resource: "agent.sessions.events",
|
|
17170
17271
|
method: "list",
|
|
17171
17272
|
summary: "List session events",
|
|
17172
|
-
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.",
|
|
17273
|
+
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.",
|
|
17173
17274
|
http: "GET",
|
|
17174
17275
|
path: "/agent/v1/sessions/{session_id}/events",
|
|
17175
17276
|
streaming: "no",
|
|
@@ -17328,6 +17429,26 @@ Available only on /agent/v1. Use the message_id field from own-face events, not
|
|
|
17328
17429
|
]
|
|
17329
17430
|
}
|
|
17330
17431
|
},
|
|
17432
|
+
{
|
|
17433
|
+
resource: "agent.sessions.requests",
|
|
17434
|
+
method: "list",
|
|
17435
|
+
summary: "List Session Requests (Extension)",
|
|
17436
|
+
description: `List the requests a session is waiting on; an end-customer token reads its own session.
|
|
17437
|
+
|
|
17438
|
+
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.`,
|
|
17439
|
+
http: "GET",
|
|
17440
|
+
path: "/agent/v1/sessions/{session_id}/requests",
|
|
17441
|
+
streaming: "no",
|
|
17442
|
+
pagination: false,
|
|
17443
|
+
pathParams: [
|
|
17444
|
+
{
|
|
17445
|
+
name: "session_id",
|
|
17446
|
+
sdkName: "session_id",
|
|
17447
|
+
description: "Session id from session creation or listing."
|
|
17448
|
+
}
|
|
17449
|
+
],
|
|
17450
|
+
query: []
|
|
17451
|
+
},
|
|
17331
17452
|
{
|
|
17332
17453
|
resource: "agent.sessions.resources",
|
|
17333
17454
|
method: "list",
|
|
@@ -25380,6 +25501,12 @@ Published at https://docs.deepraxis.com/docs/developers/cut/script-reference wit
|
|
|
25380
25501
|
- \`RippleDeleteRange\` — Cut a time range and close the gap.
|
|
25381
25502
|
- \`DeleteWords\` — Cut transcript words and ripple every track, keeping a breath.
|
|
25382
25503
|
- \`RemoveFillers\` — List and delete filler words by media's own labels; dryRun first.
|
|
25504
|
+
- \`Matte\` — Replace the clip's background with media's matte of its source, read as a luma mask.
|
|
25505
|
+
- \`EnhanceVoice\` — Replace a clip's sound with media's enhanced speech on its own audio track.
|
|
25506
|
+
- \`AlignByAudio\` — Line two recordings of the same sound up by media's measurement of their offset.
|
|
25507
|
+
- \`Reframe\` — Swap the clip's media for media's reframed take at the aspect you ask for.
|
|
25508
|
+
- \`Upscale\` — Swap the clip's media for media's upscaled take at the height you ask for.
|
|
25509
|
+
- \`Redact\` — Pixelate the faces, QR codes or text media marks, leaving the rest of the frame plain.
|
|
25383
25510
|
- \`AddTrack\` — Add a video, audio or caption track.
|
|
25384
25511
|
- \`MoveTrack\` — Move a track between layers; 0 is the topmost.
|
|
25385
25512
|
- \`UpdateTrack\` — Change a track's name, lock, gain or role.
|
|
@@ -25483,6 +25610,9 @@ Published at https://docs.deepraxis.com/docs/developers/cut/script-reference wit
|
|
|
25483
25610
|
- \`MEDIA_OFFLINE\` — The asset cannot be fetched right now.
|
|
25484
25611
|
- \`MEDIA_UNAVAILABLE\` — The asset is not usable for rendering.
|
|
25485
25612
|
- \`MEDIA_IMPORT_FAILED\` — Importing media failed.
|
|
25613
|
+
- \`MEDIA_PROCESSING\` — Media is still processing the clip; wait for the job and rerun.
|
|
25614
|
+
- \`MEDIA_PROCESSING_FAILED\` — Media's processing job failed; nothing changed.
|
|
25615
|
+
- \`ALIGNMENT_UNCERTAIN\` — \`AlignByAudio\` confidence too low; nothing changed.
|
|
25486
25616
|
- \`FRAME_OUT_OF_RANGE\` — The preview time is outside the project.
|
|
25487
25617
|
- \`PROJECT_TOO_LARGE\` — The project exceeds the size limit.
|
|
25488
25618
|
- \`RESPONSE_TOO_LARGE\` — The response would exceed its budget.
|
|
@@ -27006,7 +27136,7 @@ The default is return=minimal: success returns HTTP 201 with an empty body. Send
|
|
|
27006
27136
|
resource: "devops.flags",
|
|
27007
27137
|
method: "archive",
|
|
27008
27138
|
summary: "Archive a flag",
|
|
27009
|
-
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
|
|
27139
|
+
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.",
|
|
27010
27140
|
http: "POST",
|
|
27011
27141
|
path: "/devops/v1/flags/{id}:archive",
|
|
27012
27142
|
streaming: "no",
|
|
@@ -27870,6 +28000,42 @@ The default is return=minimal: success returns HTTP 201 with an empty body. Send
|
|
|
27870
28000
|
}
|
|
27871
28001
|
}
|
|
27872
28002
|
},
|
|
28003
|
+
{
|
|
28004
|
+
resource: "devops.projects.flags",
|
|
28005
|
+
method: "reportCodeRefs",
|
|
28006
|
+
summary: "Report a project's flag code references",
|
|
28007
|
+
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.",
|
|
28008
|
+
http: "POST",
|
|
28009
|
+
path: "/devops/v1/projects/{project}/flags/code-refs",
|
|
28010
|
+
streaming: "no",
|
|
28011
|
+
pagination: false,
|
|
28012
|
+
pathParams: [
|
|
28013
|
+
{
|
|
28014
|
+
name: "project",
|
|
28015
|
+
sdkName: "project",
|
|
28016
|
+
description: "Identifies the project whose data you are reading, from the project list or create answer."
|
|
28017
|
+
}
|
|
28018
|
+
],
|
|
28019
|
+
query: [],
|
|
28020
|
+
body: {
|
|
28021
|
+
required: true,
|
|
28022
|
+
fields: [
|
|
28023
|
+
{
|
|
28024
|
+
name: "scannedCommit",
|
|
28025
|
+
type: "string",
|
|
28026
|
+
required: true,
|
|
28027
|
+
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."
|
|
28028
|
+
},
|
|
28029
|
+
{
|
|
28030
|
+
name: "refs",
|
|
28031
|
+
type: "array",
|
|
28032
|
+
itemType: "object",
|
|
28033
|
+
required: true,
|
|
28034
|
+
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."
|
|
28035
|
+
}
|
|
28036
|
+
]
|
|
28037
|
+
}
|
|
28038
|
+
},
|
|
27873
28039
|
{
|
|
27874
28040
|
resource: "devops.projects.promotions",
|
|
27875
28041
|
method: "list",
|
|
@@ -29806,7 +29972,7 @@ The default is return=minimal: success returns HTTP 201 with an empty body. Send
|
|
|
29806
29972
|
resource: "devops.units",
|
|
29807
29973
|
method: "push",
|
|
29808
29974
|
summary: "Push a unit's branch",
|
|
29809
|
-
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
|
|
29975
|
+
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.",
|
|
29810
29976
|
http: "POST",
|
|
29811
29977
|
path: "/devops/v1/units/{id}:push",
|
|
29812
29978
|
streaming: "no",
|
|
@@ -31712,11 +31878,57 @@ The default is return=minimal: success returns HTTP 201 with an empty body. Send
|
|
|
31712
31878
|
]
|
|
31713
31879
|
}
|
|
31714
31880
|
},
|
|
31881
|
+
{
|
|
31882
|
+
resource: "media.libraries.assets.align",
|
|
31883
|
+
method: "create",
|
|
31884
|
+
summary: "Align asset",
|
|
31885
|
+
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}.",
|
|
31886
|
+
http: "POST",
|
|
31887
|
+
path: "/media/v1/libraries/{library_id}/assets/{asset_id}/align",
|
|
31888
|
+
streaming: "no",
|
|
31889
|
+
pagination: false,
|
|
31890
|
+
pathParams: [
|
|
31891
|
+
{
|
|
31892
|
+
name: "library_id",
|
|
31893
|
+
sdkName: "library_id",
|
|
31894
|
+
description: "Library ID returned by creation."
|
|
31895
|
+
},
|
|
31896
|
+
{
|
|
31897
|
+
name: "asset_id",
|
|
31898
|
+
sdkName: "asset_id",
|
|
31899
|
+
description: "32-character asset ID."
|
|
31900
|
+
}
|
|
31901
|
+
],
|
|
31902
|
+
query: [],
|
|
31903
|
+
body: {
|
|
31904
|
+
required: true,
|
|
31905
|
+
fields: [
|
|
31906
|
+
{
|
|
31907
|
+
name: "reference_asset_id",
|
|
31908
|
+
type: "string",
|
|
31909
|
+
required: true,
|
|
31910
|
+
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."
|
|
31911
|
+
},
|
|
31912
|
+
{
|
|
31913
|
+
name: "max_offset_seconds",
|
|
31914
|
+
type: "number",
|
|
31915
|
+
required: false,
|
|
31916
|
+
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."
|
|
31917
|
+
},
|
|
31918
|
+
{
|
|
31919
|
+
name: "idempotency_key",
|
|
31920
|
+
type: "string",
|
|
31921
|
+
required: false,
|
|
31922
|
+
description: "Stable key so a retried request reuses the same job instead of analysing and charging again; reusing it with different content is rejected."
|
|
31923
|
+
}
|
|
31924
|
+
]
|
|
31925
|
+
}
|
|
31926
|
+
},
|
|
31715
31927
|
{
|
|
31716
31928
|
resource: "media.assets",
|
|
31717
31929
|
method: "edit",
|
|
31718
31930
|
summary: "Edit asset",
|
|
31719
|
-
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, and to_video, frame and resynthesize on the material each takes; every other type in the operation vocabulary is refused with OPERATION_NOT_SUPPORTED. remove_background on a video produces a portrait matte video for compositing without a green screen: output picks
|
|
31931
|
+
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\"}}.",
|
|
31720
31932
|
http: "POST",
|
|
31721
31933
|
path: "/media/v1/libraries/{library_id}/assets/{asset_id}/edits",
|
|
31722
31934
|
streaming: "no",
|
|
@@ -31741,7 +31953,7 @@ The default is return=minimal: success returns HTTP 201 with an empty body. Send
|
|
|
31741
31953
|
name: "operation",
|
|
31742
31954
|
type: "object",
|
|
31743
31955
|
required: true,
|
|
31744
|
-
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, 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."
|
|
31956
|
+
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."
|
|
31745
31957
|
},
|
|
31746
31958
|
{
|
|
31747
31959
|
name: "model",
|
|
@@ -34734,6 +34946,18 @@ for more details.`
|
|
|
34734
34946
|
]
|
|
34735
34947
|
}
|
|
34736
34948
|
},
|
|
34949
|
+
{
|
|
34950
|
+
resource: "model.modelAccess",
|
|
34951
|
+
method: "list",
|
|
34952
|
+
summary: "List Model Access",
|
|
34953
|
+
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.",
|
|
34954
|
+
http: "GET",
|
|
34955
|
+
path: "/model/v1/model-access",
|
|
34956
|
+
streaming: "no",
|
|
34957
|
+
pagination: false,
|
|
34958
|
+
pathParams: [],
|
|
34959
|
+
query: []
|
|
34960
|
+
},
|
|
34737
34961
|
{
|
|
34738
34962
|
resource: "model.models",
|
|
34739
34963
|
method: "list",
|
|
@@ -34762,6 +34986,8 @@ for more details.`
|
|
|
34762
34986
|
"openai.images.generations",
|
|
34763
34987
|
"openai.responses",
|
|
34764
34988
|
"openai.videos",
|
|
34989
|
+
"praxis.media.process",
|
|
34990
|
+
"praxis.video.matting",
|
|
34765
34991
|
"typesafe.systemone",
|
|
34766
34992
|
"volcengine.music",
|
|
34767
34993
|
"volcengine.vod.matting",
|
|
@@ -34826,6 +35052,42 @@ for more details.`
|
|
|
34826
35052
|
],
|
|
34827
35053
|
query: []
|
|
34828
35054
|
},
|
|
35055
|
+
{
|
|
35056
|
+
resource: "model.models.access",
|
|
35057
|
+
method: "delete",
|
|
35058
|
+
summary: "Disable Model Access",
|
|
35059
|
+
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.",
|
|
35060
|
+
http: "DELETE",
|
|
35061
|
+
path: "/model/v1/models/{model}/access",
|
|
35062
|
+
streaming: "no",
|
|
35063
|
+
pagination: false,
|
|
35064
|
+
pathParams: [
|
|
35065
|
+
{
|
|
35066
|
+
name: "model",
|
|
35067
|
+
sdkName: "model",
|
|
35068
|
+
description: "Model ID the organization no longer wants enabled; same ids as enableModelAccess."
|
|
35069
|
+
}
|
|
35070
|
+
],
|
|
35071
|
+
query: []
|
|
35072
|
+
},
|
|
35073
|
+
{
|
|
35074
|
+
resource: "model.models.access",
|
|
35075
|
+
method: "update",
|
|
35076
|
+
summary: "Enable Model Access",
|
|
35077
|
+
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.",
|
|
35078
|
+
http: "PUT",
|
|
35079
|
+
path: "/model/v1/models/{model}/access",
|
|
35080
|
+
streaming: "no",
|
|
35081
|
+
pagination: false,
|
|
35082
|
+
pathParams: [
|
|
35083
|
+
{
|
|
35084
|
+
name: "model",
|
|
35085
|
+
sdkName: "model",
|
|
35086
|
+
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."
|
|
35087
|
+
}
|
|
35088
|
+
],
|
|
35089
|
+
query: []
|
|
35090
|
+
},
|
|
34829
35091
|
{
|
|
34830
35092
|
resource: "model.ocr",
|
|
34831
35093
|
method: "create",
|
|
@@ -40400,6 +40662,131 @@ for more details.`
|
|
|
40400
40662
|
]
|
|
40401
40663
|
}
|
|
40402
40664
|
},
|
|
40665
|
+
{
|
|
40666
|
+
resource: "share.permissions",
|
|
40667
|
+
method: "list",
|
|
40668
|
+
summary: "List shares",
|
|
40669
|
+
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.",
|
|
40670
|
+
http: "GET",
|
|
40671
|
+
path: "/share/v1/permissions",
|
|
40672
|
+
streaming: "no",
|
|
40673
|
+
pagination: false,
|
|
40674
|
+
pathParams: [],
|
|
40675
|
+
query: [
|
|
40676
|
+
{
|
|
40677
|
+
name: "resource_type",
|
|
40678
|
+
type: "string",
|
|
40679
|
+
enum: [
|
|
40680
|
+
"file",
|
|
40681
|
+
"artifact",
|
|
40682
|
+
"canvas",
|
|
40683
|
+
"media_asset"
|
|
40684
|
+
],
|
|
40685
|
+
required: false,
|
|
40686
|
+
description: "Only shares of this object type; file, canvas and media_asset create today."
|
|
40687
|
+
},
|
|
40688
|
+
{
|
|
40689
|
+
name: "resource_id",
|
|
40690
|
+
type: "string",
|
|
40691
|
+
required: false,
|
|
40692
|
+
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."
|
|
40693
|
+
},
|
|
40694
|
+
{
|
|
40695
|
+
name: "status",
|
|
40696
|
+
type: "string",
|
|
40697
|
+
enum: [
|
|
40698
|
+
"active",
|
|
40699
|
+
"expired",
|
|
40700
|
+
"revoked"
|
|
40701
|
+
],
|
|
40702
|
+
required: false,
|
|
40703
|
+
description: "Only shares in this state; omit to list every state."
|
|
40704
|
+
},
|
|
40705
|
+
{
|
|
40706
|
+
name: "page_size",
|
|
40707
|
+
type: "integer",
|
|
40708
|
+
required: false,
|
|
40709
|
+
description: "Maximum shares in one page, from 1 to 100; defaults to 50."
|
|
40710
|
+
},
|
|
40711
|
+
{
|
|
40712
|
+
name: "page_token",
|
|
40713
|
+
type: "string",
|
|
40714
|
+
required: false,
|
|
40715
|
+
description: "Opaque next_page_token from the preceding page with the same filters; omit on the first request."
|
|
40716
|
+
}
|
|
40717
|
+
]
|
|
40718
|
+
},
|
|
40719
|
+
{
|
|
40720
|
+
resource: "share.permissions",
|
|
40721
|
+
method: "create",
|
|
40722
|
+
summary: "Create share",
|
|
40723
|
+
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.",
|
|
40724
|
+
http: "POST",
|
|
40725
|
+
path: "/share/v1/permissions",
|
|
40726
|
+
streaming: "no",
|
|
40727
|
+
pagination: false,
|
|
40728
|
+
pathParams: [],
|
|
40729
|
+
query: [],
|
|
40730
|
+
body: {
|
|
40731
|
+
required: true,
|
|
40732
|
+
fields: [
|
|
40733
|
+
{
|
|
40734
|
+
name: "resource",
|
|
40735
|
+
type: "object",
|
|
40736
|
+
required: true,
|
|
40737
|
+
description: "The object a share exposes, named by a type and an id."
|
|
40738
|
+
},
|
|
40739
|
+
{
|
|
40740
|
+
name: "expire_time",
|
|
40741
|
+
type: "string",
|
|
40742
|
+
required: false,
|
|
40743
|
+
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."
|
|
40744
|
+
},
|
|
40745
|
+
{
|
|
40746
|
+
name: "prevents_download",
|
|
40747
|
+
type: "boolean",
|
|
40748
|
+
required: false,
|
|
40749
|
+
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."
|
|
40750
|
+
}
|
|
40751
|
+
]
|
|
40752
|
+
}
|
|
40753
|
+
},
|
|
40754
|
+
{
|
|
40755
|
+
resource: "share.permissions",
|
|
40756
|
+
method: "delete",
|
|
40757
|
+
summary: "Delete share",
|
|
40758
|
+
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.",
|
|
40759
|
+
http: "DELETE",
|
|
40760
|
+
path: "/share/v1/permissions/{id}",
|
|
40761
|
+
streaming: "no",
|
|
40762
|
+
pagination: false,
|
|
40763
|
+
pathParams: [
|
|
40764
|
+
{
|
|
40765
|
+
name: "id",
|
|
40766
|
+
sdkName: "id",
|
|
40767
|
+
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."
|
|
40768
|
+
}
|
|
40769
|
+
],
|
|
40770
|
+
query: []
|
|
40771
|
+
},
|
|
40772
|
+
{
|
|
40773
|
+
resource: "share.permissions",
|
|
40774
|
+
method: "retrieve",
|
|
40775
|
+
summary: "Retrieve share",
|
|
40776
|
+
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.",
|
|
40777
|
+
http: "GET",
|
|
40778
|
+
path: "/share/v1/permissions/{id}",
|
|
40779
|
+
streaming: "no",
|
|
40780
|
+
pagination: false,
|
|
40781
|
+
pathParams: [
|
|
40782
|
+
{
|
|
40783
|
+
name: "id",
|
|
40784
|
+
sdkName: "id",
|
|
40785
|
+
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."
|
|
40786
|
+
}
|
|
40787
|
+
],
|
|
40788
|
+
query: []
|
|
40789
|
+
},
|
|
40403
40790
|
{
|
|
40404
40791
|
resource: "studio.codexes",
|
|
40405
40792
|
method: "list",
|
|
@@ -46874,6 +47261,19 @@ var getAgentConsolidation = (options) => (options.client ?? client).get({
|
|
|
46874
47261
|
url: "/agent/v1/agents/{agent_id}/consolidations/{consolidation_id}",
|
|
46875
47262
|
...options
|
|
46876
47263
|
});
|
|
47264
|
+
var listAgentInboxLetters = (options) => (options.client ?? client).get({
|
|
47265
|
+
security: [{
|
|
47266
|
+
key: "BearerAuth",
|
|
47267
|
+
scheme: "bearer",
|
|
47268
|
+
type: "http"
|
|
47269
|
+
}, {
|
|
47270
|
+
key: "ApiKeyAuth",
|
|
47271
|
+
name: "X-API-Key",
|
|
47272
|
+
type: "apiKey"
|
|
47273
|
+
}],
|
|
47274
|
+
url: "/agent/v1/agents/{agent_id}/inbox/letters",
|
|
47275
|
+
...options
|
|
47276
|
+
});
|
|
46877
47277
|
var applyAgentVersion = (options) => (options.client ?? client).post({
|
|
46878
47278
|
security: [{
|
|
46879
47279
|
key: "BearerAuth",
|
|
@@ -47226,11 +47626,7 @@ var computersFilesConvert = (options) => (options.client ?? client).post({
|
|
|
47226
47626
|
type: "apiKey"
|
|
47227
47627
|
}],
|
|
47228
47628
|
url: "/agent/v1/computers/{computer_id}/files/convert",
|
|
47229
|
-
...options
|
|
47230
|
-
headers: {
|
|
47231
|
-
"Content-Type": "application/json",
|
|
47232
|
-
...options.headers
|
|
47233
|
-
}
|
|
47629
|
+
...options
|
|
47234
47630
|
});
|
|
47235
47631
|
var connectComputer = (options) => (options.client ?? client).post({
|
|
47236
47632
|
security: [{
|
|
@@ -47318,6 +47714,49 @@ var forkSession = (options) => (options.client ?? client).post({
|
|
|
47318
47714
|
...options.headers
|
|
47319
47715
|
}
|
|
47320
47716
|
});
|
|
47717
|
+
var listSessionArtifacts = (options) => (options.client ?? client).get({
|
|
47718
|
+
security: [{
|
|
47719
|
+
key: "BearerAuth",
|
|
47720
|
+
scheme: "bearer",
|
|
47721
|
+
type: "http"
|
|
47722
|
+
}, {
|
|
47723
|
+
key: "ApiKeyAuth",
|
|
47724
|
+
name: "X-API-Key",
|
|
47725
|
+
type: "apiKey"
|
|
47726
|
+
}],
|
|
47727
|
+
url: "/agent/v1/sessions/{session_id}/artifacts",
|
|
47728
|
+
...options
|
|
47729
|
+
});
|
|
47730
|
+
var createSessionArtifactContentUrl = (options) => (options.client ?? client).post({
|
|
47731
|
+
security: [{
|
|
47732
|
+
key: "BearerAuth",
|
|
47733
|
+
scheme: "bearer",
|
|
47734
|
+
type: "http"
|
|
47735
|
+
}, {
|
|
47736
|
+
key: "ApiKeyAuth",
|
|
47737
|
+
name: "X-API-Key",
|
|
47738
|
+
type: "apiKey"
|
|
47739
|
+
}],
|
|
47740
|
+
url: "/agent/v1/sessions/{session_id}/artifacts/{artifact_id}/content_url",
|
|
47741
|
+
...options,
|
|
47742
|
+
headers: {
|
|
47743
|
+
"Content-Type": "application/json",
|
|
47744
|
+
...options.headers
|
|
47745
|
+
}
|
|
47746
|
+
});
|
|
47747
|
+
var listSessionRequests = (options) => (options.client ?? client).get({
|
|
47748
|
+
security: [{
|
|
47749
|
+
key: "BearerAuth",
|
|
47750
|
+
scheme: "bearer",
|
|
47751
|
+
type: "http"
|
|
47752
|
+
}, {
|
|
47753
|
+
key: "ApiKeyAuth",
|
|
47754
|
+
name: "X-API-Key",
|
|
47755
|
+
type: "apiKey"
|
|
47756
|
+
}],
|
|
47757
|
+
url: "/agent/v1/sessions/{session_id}/requests",
|
|
47758
|
+
...options
|
|
47759
|
+
});
|
|
47321
47760
|
var listSessionBackgroundTasks = (options) => (options.client ?? client).get({
|
|
47322
47761
|
security: [{
|
|
47323
47762
|
key: "BearerAuth",
|
|
@@ -47963,6 +48402,45 @@ var createChatCompletion = (options) => (options.client ?? client).post({
|
|
|
47963
48402
|
...options.headers
|
|
47964
48403
|
}
|
|
47965
48404
|
});
|
|
48405
|
+
var disableModelAccess = (options) => (options.client ?? client).delete({
|
|
48406
|
+
security: [{
|
|
48407
|
+
key: "BearerAuth",
|
|
48408
|
+
scheme: "bearer",
|
|
48409
|
+
type: "http"
|
|
48410
|
+
}, {
|
|
48411
|
+
key: "ApiKeyAuth",
|
|
48412
|
+
name: "X-API-Key",
|
|
48413
|
+
type: "apiKey"
|
|
48414
|
+
}],
|
|
48415
|
+
url: "/model/v1/models/{model}/access",
|
|
48416
|
+
...options
|
|
48417
|
+
});
|
|
48418
|
+
var enableModelAccess = (options) => (options.client ?? client).put({
|
|
48419
|
+
security: [{
|
|
48420
|
+
key: "BearerAuth",
|
|
48421
|
+
scheme: "bearer",
|
|
48422
|
+
type: "http"
|
|
48423
|
+
}, {
|
|
48424
|
+
key: "ApiKeyAuth",
|
|
48425
|
+
name: "X-API-Key",
|
|
48426
|
+
type: "apiKey"
|
|
48427
|
+
}],
|
|
48428
|
+
url: "/model/v1/models/{model}/access",
|
|
48429
|
+
...options
|
|
48430
|
+
});
|
|
48431
|
+
var listModelAccess = (options) => (options?.client ?? client).get({
|
|
48432
|
+
security: [{
|
|
48433
|
+
key: "BearerAuth",
|
|
48434
|
+
scheme: "bearer",
|
|
48435
|
+
type: "http"
|
|
48436
|
+
}, {
|
|
48437
|
+
key: "ApiKeyAuth",
|
|
48438
|
+
name: "X-API-Key",
|
|
48439
|
+
type: "apiKey"
|
|
48440
|
+
}],
|
|
48441
|
+
url: "/model/v1/model-access",
|
|
48442
|
+
...options
|
|
48443
|
+
});
|
|
47966
48444
|
var getGeneration = (options) => (options.client ?? client).get({
|
|
47967
48445
|
security: [{
|
|
47968
48446
|
key: "BearerAuth",
|
|
@@ -53163,6 +53641,19 @@ var devopsFlagsCreate = (options) => (options.client ?? client).post({
|
|
|
53163
53641
|
...options.headers
|
|
53164
53642
|
}
|
|
53165
53643
|
});
|
|
53644
|
+
var devopsFlagsReportCodeRefs = (options) => (options.client ?? client).post({
|
|
53645
|
+
security: [{
|
|
53646
|
+
key: "devops-bearerAuth",
|
|
53647
|
+
scheme: "bearer",
|
|
53648
|
+
type: "http"
|
|
53649
|
+
}],
|
|
53650
|
+
url: "/devops/v1/projects/{project}/flags/code-refs",
|
|
53651
|
+
...options,
|
|
53652
|
+
headers: {
|
|
53653
|
+
"Content-Type": "application/json",
|
|
53654
|
+
...options.headers
|
|
53655
|
+
}
|
|
53656
|
+
});
|
|
53166
53657
|
var devopsFlagsGet = (options) => (options.client ?? client).get({
|
|
53167
53658
|
security: [{
|
|
53168
53659
|
key: "devops-bearerAuth",
|
|
@@ -54376,6 +54867,19 @@ var mediaGetGenerationCapabilities = (options) => (options?.client ?? client).ge
|
|
|
54376
54867
|
url: "/media/v1/generation/capabilities",
|
|
54377
54868
|
...options
|
|
54378
54869
|
});
|
|
54870
|
+
var mediaAlignAsset = (options) => (options.client ?? client).post({
|
|
54871
|
+
security: [{
|
|
54872
|
+
key: "media-BearerAuth",
|
|
54873
|
+
scheme: "bearer",
|
|
54874
|
+
type: "http"
|
|
54875
|
+
}],
|
|
54876
|
+
url: "/media/v1/libraries/{library_id}/assets/{asset_id}/align",
|
|
54877
|
+
...options,
|
|
54878
|
+
headers: {
|
|
54879
|
+
"Content-Type": "application/json",
|
|
54880
|
+
...options.headers
|
|
54881
|
+
}
|
|
54882
|
+
});
|
|
54379
54883
|
var ontologyListTypes = (options) => (options?.client ?? client).get({
|
|
54380
54884
|
security: [{
|
|
54381
54885
|
key: "ontology-bearerAuth",
|
|
@@ -55508,6 +56012,46 @@ var searchMap = (options) => (options.client ?? client).post({
|
|
|
55508
56012
|
...options.headers
|
|
55509
56013
|
}
|
|
55510
56014
|
});
|
|
56015
|
+
var shareListPermissions = (options) => (options?.client ?? client).get({
|
|
56016
|
+
security: [{
|
|
56017
|
+
key: "share-bearerAuth",
|
|
56018
|
+
scheme: "bearer",
|
|
56019
|
+
type: "http"
|
|
56020
|
+
}],
|
|
56021
|
+
url: "/share/v1/permissions",
|
|
56022
|
+
...options
|
|
56023
|
+
});
|
|
56024
|
+
var shareCreatePermission = (options) => (options.client ?? client).post({
|
|
56025
|
+
security: [{
|
|
56026
|
+
key: "share-bearerAuth",
|
|
56027
|
+
scheme: "bearer",
|
|
56028
|
+
type: "http"
|
|
56029
|
+
}],
|
|
56030
|
+
url: "/share/v1/permissions",
|
|
56031
|
+
...options,
|
|
56032
|
+
headers: {
|
|
56033
|
+
"Content-Type": "application/json",
|
|
56034
|
+
...options.headers
|
|
56035
|
+
}
|
|
56036
|
+
});
|
|
56037
|
+
var shareDeletePermission = (options) => (options.client ?? client).delete({
|
|
56038
|
+
security: [{
|
|
56039
|
+
key: "share-bearerAuth",
|
|
56040
|
+
scheme: "bearer",
|
|
56041
|
+
type: "http"
|
|
56042
|
+
}],
|
|
56043
|
+
url: "/share/v1/permissions/{id}",
|
|
56044
|
+
...options
|
|
56045
|
+
});
|
|
56046
|
+
var shareRetrievePermission = (options) => (options.client ?? client).get({
|
|
56047
|
+
security: [{
|
|
56048
|
+
key: "share-bearerAuth",
|
|
56049
|
+
scheme: "bearer",
|
|
56050
|
+
type: "http"
|
|
56051
|
+
}],
|
|
56052
|
+
url: "/share/v1/permissions/{id}",
|
|
56053
|
+
...options
|
|
56054
|
+
});
|
|
55511
56055
|
var studioGenresList = (options) => (options?.client ?? client).get({
|
|
55512
56056
|
security: [{
|
|
55513
56057
|
key: "BearerAuth",
|
|
@@ -57544,6 +58088,11 @@ function createAgent(transport) {
|
|
|
57544
58088
|
send: bind(transport, sendAgentEvents),
|
|
57545
58089
|
stream: bindStream(transport, streamAgentEvents)
|
|
57546
58090
|
},
|
|
58091
|
+
inbox: {
|
|
58092
|
+
letters: {
|
|
58093
|
+
list: bind(transport, listAgentInboxLetters)
|
|
58094
|
+
}
|
|
58095
|
+
},
|
|
57547
58096
|
list: bind(transport, agentsList),
|
|
57548
58097
|
retrieve: bind(transport, agentsRetrieve),
|
|
57549
58098
|
retrieveAppearance: bind(transport, getAgentAppearance),
|
|
@@ -57608,6 +58157,12 @@ function createAgent(transport) {
|
|
|
57608
58157
|
},
|
|
57609
58158
|
sessions: {
|
|
57610
58159
|
archive: bind(transport, sessionsArchive),
|
|
58160
|
+
artifacts: {
|
|
58161
|
+
contentUrl: {
|
|
58162
|
+
create: bind(transport, createSessionArtifactContentUrl)
|
|
58163
|
+
},
|
|
58164
|
+
list: bind(transport, listSessionArtifacts)
|
|
58165
|
+
},
|
|
57611
58166
|
backgroundTasks: {
|
|
57612
58167
|
list: bind(transport, listSessionBackgroundTasks),
|
|
57613
58168
|
retrieveOutput: bind(transport, getSessionBackgroundTaskOutput),
|
|
@@ -57626,6 +58181,9 @@ function createAgent(transport) {
|
|
|
57626
58181
|
},
|
|
57627
58182
|
fork: bind(transport, forkSession),
|
|
57628
58183
|
list: bind(transport, sessionsList),
|
|
58184
|
+
requests: {
|
|
58185
|
+
list: bind(transport, listSessionRequests)
|
|
58186
|
+
},
|
|
57629
58187
|
resources: {
|
|
57630
58188
|
create: bind(transport, sessionsResourcesAdd),
|
|
57631
58189
|
delete: bind(transport, aliasOperation(sessionsResourcesDelete, { query: { session_id: "query_session_id" } })),
|
|
@@ -58138,7 +58696,8 @@ function createDevops(transport) {
|
|
|
58138
58696
|
},
|
|
58139
58697
|
flags: {
|
|
58140
58698
|
create: bind(transport, devopsFlagsCreate),
|
|
58141
|
-
list: bind(transport, devopsFlagsList)
|
|
58699
|
+
list: bind(transport, devopsFlagsList),
|
|
58700
|
+
reportCodeRefs: bind(transport, devopsFlagsReportCodeRefs)
|
|
58142
58701
|
},
|
|
58143
58702
|
list: bind(transport, devopsProjectsList),
|
|
58144
58703
|
promotions: {
|
|
@@ -58342,6 +58901,9 @@ function createMedia(transport) {
|
|
|
58342
58901
|
},
|
|
58343
58902
|
libraries: {
|
|
58344
58903
|
assets: {
|
|
58904
|
+
align: {
|
|
58905
|
+
create: bind(transport, mediaAlignAsset)
|
|
58906
|
+
},
|
|
58345
58907
|
batch: bind(transport, mediaBatchAssets),
|
|
58346
58908
|
create: bind(transport, (options) => mediaUploadAsset({ ...options, bodySerializer: multipartBodySerializer, headers: { "Content-Type": null, ...options.headers } })),
|
|
58347
58909
|
delete: bind(transport, mediaDeleteAsset),
|
|
@@ -58483,7 +59045,14 @@ function createModel(transport) {
|
|
|
58483
59045
|
countTokens: bind(transport, countTokens),
|
|
58484
59046
|
create: bindMixed(transport, createMessage)
|
|
58485
59047
|
},
|
|
59048
|
+
modelAccess: {
|
|
59049
|
+
list: bind(transport, listModelAccess)
|
|
59050
|
+
},
|
|
58486
59051
|
models: {
|
|
59052
|
+
access: {
|
|
59053
|
+
delete: bind(transport, disableModelAccess),
|
|
59054
|
+
update: bind(transport, enableModelAccess)
|
|
59055
|
+
},
|
|
58487
59056
|
list: bind(transport, listModels),
|
|
58488
59057
|
retrieve: bind(transport, retrieveModel)
|
|
58489
59058
|
},
|
|
@@ -58776,6 +59345,16 @@ function createSearch(transport) {
|
|
|
58776
59345
|
}
|
|
58777
59346
|
};
|
|
58778
59347
|
}
|
|
59348
|
+
function createShare(transport) {
|
|
59349
|
+
return {
|
|
59350
|
+
permissions: {
|
|
59351
|
+
create: bind(transport, shareCreatePermission),
|
|
59352
|
+
delete: bind(transport, shareDeletePermission),
|
|
59353
|
+
list: bind(transport, shareListPermissions),
|
|
59354
|
+
retrieve: bind(transport, shareRetrievePermission)
|
|
59355
|
+
}
|
|
59356
|
+
};
|
|
59357
|
+
}
|
|
58779
59358
|
function createStudio(transport) {
|
|
58780
59359
|
return {
|
|
58781
59360
|
codexes: {
|
|
@@ -59046,6 +59625,7 @@ var resourceFactories = {
|
|
|
59046
59625
|
organization: createOrganization,
|
|
59047
59626
|
sandbox: createSandbox,
|
|
59048
59627
|
search: createSearch,
|
|
59628
|
+
share: createShare,
|
|
59049
59629
|
studio: createStudio,
|
|
59050
59630
|
ticket: createTicket,
|
|
59051
59631
|
vault: createVault
|
|
@@ -61233,7 +61813,7 @@ var workflows = [
|
|
|
61233
61813
|
],
|
|
61234
61814
|
group: "local",
|
|
61235
61815
|
network: "offline",
|
|
61236
|
-
platform: "the `@
|
|
61816
|
+
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).",
|
|
61237
61817
|
docs: "https://docs.deepraxis.com/docs/cli"
|
|
61238
61818
|
},
|
|
61239
61819
|
{
|
|
@@ -61322,30 +61902,31 @@ var workflows = [
|
|
|
61322
61902
|
{
|
|
61323
61903
|
words: ["devops", "flag", "refs"],
|
|
61324
61904
|
requires: "checkout",
|
|
61325
|
-
usage: "devops flag refs [key]",
|
|
61326
|
-
summary: "Where each flag key is referenced in this checkout: file and line, for every registered key or one named key.",
|
|
61327
|
-
example: "praxis devops flag refs",
|
|
61905
|
+
usage: "devops flag refs [key] [--report --project <dvp_…>]",
|
|
61906
|
+
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.",
|
|
61907
|
+
example: "praxis devops flag refs --report --project dvp_…",
|
|
61328
61908
|
examples: [
|
|
61329
61909
|
"praxis devops flag refs",
|
|
61330
|
-
"praxis devops flag refs run-page-v2"
|
|
61910
|
+
"praxis devops flag refs run-page-v2",
|
|
61911
|
+
"praxis devops flag refs --report --project dvp_…"
|
|
61331
61912
|
],
|
|
61332
61913
|
group: "local",
|
|
61333
|
-
network: "
|
|
61334
|
-
platform: "
|
|
61914
|
+
network: "Offline. --report: needs a login and sends this checkout's references to the platform",
|
|
61915
|
+
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).",
|
|
61335
61916
|
docs: "https://docs.deepraxis.com/docs/cli"
|
|
61336
61917
|
},
|
|
61337
61918
|
{
|
|
61338
61919
|
words: ["devops", "flag", "remove"],
|
|
61339
61920
|
requires: "checkout",
|
|
61340
61921
|
usage: "devops flag remove <key>",
|
|
61341
|
-
summary: "The local step of removing a flag: list the remaining references, or the steps that follow once none remain. Order:
|
|
61922
|
+
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.",
|
|
61342
61923
|
example: "praxis devops flag remove run-page-v2",
|
|
61343
61924
|
examples: [
|
|
61344
61925
|
"praxis devops flag remove run-page-v2"
|
|
61345
61926
|
],
|
|
61346
61927
|
group: "local",
|
|
61347
61928
|
network: "offline",
|
|
61348
|
-
platform: "praxis api devops flag archive — retires the flag on the platform after the code that named it is deployed away
|
|
61929
|
+
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).",
|
|
61349
61930
|
docs: "https://docs.deepraxis.com/docs/cli"
|
|
61350
61931
|
},
|
|
61351
61932
|
{
|
|
@@ -61362,6 +61943,13 @@ var workflows = [
|
|
|
61362
61943
|
platform: "praxis api devops project change create — the platform creates and names a Change; the CLI only lands its branch (ADR-125 §5).",
|
|
61363
61944
|
docs: "https://docs.deepraxis.com/docs/cli"
|
|
61364
61945
|
},
|
|
61946
|
+
{
|
|
61947
|
+
words: ["agent", "events", "wait"],
|
|
61948
|
+
usage: "agent events wait [--timeout <seconds>]",
|
|
61949
|
+
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.",
|
|
61950
|
+
example: "PRAXIS_ASSUME_AGENT=R1M9TQ2X praxis agent events wait",
|
|
61951
|
+
network: "online"
|
|
61952
|
+
},
|
|
61365
61953
|
{ 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"' },
|
|
61366
61954
|
{ words: ["skill"], usage: "skill [--install <dir>]", summary: "Print the AI skill, or write <dir>/praxis-cli/SKILL.md." },
|
|
61367
61955
|
{
|
|
@@ -62954,6 +63542,101 @@ function wranglerEdges(nodes) {
|
|
|
62954
63542
|
}
|
|
62955
63543
|
return edges;
|
|
62956
63544
|
}
|
|
63545
|
+
// ../../packages/praxis/deploy-core/src/lambda-function.ts
|
|
63546
|
+
var LAMBDA_FUNCTIONS_ROOT = "services/lambda/functions";
|
|
63547
|
+
var UPSTREAM = "aliyun-fc";
|
|
63548
|
+
var RECIPE_PATH = /^services\/lambda\/functions\/([^/]+)\/function\.json$/;
|
|
63549
|
+
var isText = (value) => typeof value === "string" && value !== "";
|
|
63550
|
+
var isCount = (value, min, max) => typeof value === "number" && Number.isInteger(value) && value >= min && value <= max;
|
|
63551
|
+
function lambdaFunctionOf(text) {
|
|
63552
|
+
const parsed = text === null ? null : parseJsonc2(text);
|
|
63553
|
+
if (parsed === null)
|
|
63554
|
+
return null;
|
|
63555
|
+
if (!isText(parsed.name) || !isText(parsed.upstream))
|
|
63556
|
+
return null;
|
|
63557
|
+
if (!Array.isArray(parsed.regions) || parsed.regions.length === 0 || !parsed.regions.every(isText))
|
|
63558
|
+
return null;
|
|
63559
|
+
if (parsed.gpu !== undefined && !isText(parsed.gpu))
|
|
63560
|
+
return null;
|
|
63561
|
+
if (!isCount(parsed.cpu, 1, 256))
|
|
63562
|
+
return null;
|
|
63563
|
+
if (!isCount(parsed.memoryMb, 128, 32 * 1024))
|
|
63564
|
+
return null;
|
|
63565
|
+
if (!isCount(parsed.timeoutSeconds, 1, 24 * 3600))
|
|
63566
|
+
return null;
|
|
63567
|
+
if (!isCount(parsed.concurrency, 1, 1024))
|
|
63568
|
+
return null;
|
|
63569
|
+
return {
|
|
63570
|
+
name: parsed.name,
|
|
63571
|
+
upstream: parsed.upstream,
|
|
63572
|
+
regions: [...parsed.regions],
|
|
63573
|
+
...parsed.gpu === undefined ? {} : { gpu: parsed.gpu },
|
|
63574
|
+
cpu: parsed.cpu,
|
|
63575
|
+
memoryMb: parsed.memoryMb,
|
|
63576
|
+
timeoutSeconds: parsed.timeoutSeconds,
|
|
63577
|
+
concurrency: parsed.concurrency
|
|
63578
|
+
};
|
|
63579
|
+
}
|
|
63580
|
+
function lambdaFunctionTarget(recipe) {
|
|
63581
|
+
return { path: `${LAMBDA_FUNCTIONS_ROOT}/${recipe.name}`, name: `lambda-${recipe.name}` };
|
|
63582
|
+
}
|
|
63583
|
+
function lambdaFunctionOwner(path) {
|
|
63584
|
+
return path.split("/").slice(0, -2).join("/");
|
|
63585
|
+
}
|
|
63586
|
+
async function scanRecipes(facts) {
|
|
63587
|
+
const found = [];
|
|
63588
|
+
const warnings = [];
|
|
63589
|
+
for (const path of [...facts.tree].sort()) {
|
|
63590
|
+
const match = RECIPE_PATH.exec(path);
|
|
63591
|
+
if (match === null)
|
|
63592
|
+
continue;
|
|
63593
|
+
const dir = path.slice(0, -"/function.json".length);
|
|
63594
|
+
const recipe = lambdaFunctionOf(await facts.read(path));
|
|
63595
|
+
if (recipe === null) {
|
|
63596
|
+
warnings.push(`${dir}: function.json is not a recipe`);
|
|
63597
|
+
continue;
|
|
63598
|
+
}
|
|
63599
|
+
if (recipe.upstream !== UPSTREAM)
|
|
63600
|
+
continue;
|
|
63601
|
+
if (recipe.name !== match[1]) {
|
|
63602
|
+
warnings.push(`${dir}: function.json names ${JSON.stringify(recipe.name)}, not the directory name`);
|
|
63603
|
+
continue;
|
|
63604
|
+
}
|
|
63605
|
+
found.push(recipe);
|
|
63606
|
+
}
|
|
63607
|
+
return { found, warnings };
|
|
63608
|
+
}
|
|
63609
|
+
function lambdaFunctionProvider(_options = {}) {
|
|
63610
|
+
return {
|
|
63611
|
+
id: "lambda-function",
|
|
63612
|
+
async detect(facts) {
|
|
63613
|
+
return (await scanRecipes(facts)).found.length > 0 ? "certain" : "none";
|
|
63614
|
+
},
|
|
63615
|
+
async plan(facts, partial) {
|
|
63616
|
+
const claimed = new Set(partial.targets.map((target) => target.path));
|
|
63617
|
+
const scan = await scanRecipes(facts);
|
|
63618
|
+
const targets = [];
|
|
63619
|
+
const byOwner = new Map;
|
|
63620
|
+
for (const recipe of scan.found) {
|
|
63621
|
+
const { path, name } = lambdaFunctionTarget(recipe);
|
|
63622
|
+
if (claimed.has(path))
|
|
63623
|
+
continue;
|
|
63624
|
+
targets.push({ path, name, destination: "aliyun-fc", production: true, onTrain: true });
|
|
63625
|
+
const owner = lambdaFunctionOwner(path);
|
|
63626
|
+
byOwner.set(owner, [...byOwner.get(owner) ?? [], path]);
|
|
63627
|
+
}
|
|
63628
|
+
const refined = partial.targets.map((target) => {
|
|
63629
|
+
const paths = byOwner.get(target.path);
|
|
63630
|
+
return paths === undefined ? target : { ...target, dependsOn: [...new Set([...target.dependsOn ?? [], ...paths])] };
|
|
63631
|
+
});
|
|
63632
|
+
return {
|
|
63633
|
+
targets: [...refined, ...targets],
|
|
63634
|
+
...scan.warnings.length === 0 ? {} : { warnings: [...partial.warnings ?? [], ...scan.warnings] }
|
|
63635
|
+
};
|
|
63636
|
+
}
|
|
63637
|
+
};
|
|
63638
|
+
}
|
|
63639
|
+
var lambdaFunction = lambdaFunctionProvider();
|
|
62957
63640
|
// ../../packages/praxis/deploy-core/src/package-manifest.ts
|
|
62958
63641
|
function packageManifestOf(text) {
|
|
62959
63642
|
const parsed = text === null ? null : parseJsonc2(text);
|
|
@@ -63111,13 +63794,21 @@ function matchesPattern(pattern, path) {
|
|
|
63111
63794
|
}
|
|
63112
63795
|
async function workspaceIndexOf(facts, options = {}) {
|
|
63113
63796
|
const tree = new Set(facts.tree);
|
|
63114
|
-
|
|
63797
|
+
return workspaceIndexOfSync({
|
|
63798
|
+
tree: facts.tree,
|
|
63115
63799
|
packageJson: tree.has("package.json") ? await facts.read("package.json") : null,
|
|
63116
63800
|
pnpmWorkspace: tree.has("pnpm-workspace.yaml") ? await facts.read("pnpm-workspace.yaml") : null
|
|
63801
|
+
}, options);
|
|
63802
|
+
}
|
|
63803
|
+
function workspaceIndexOfSync(input, options = {}) {
|
|
63804
|
+
const tree = new Set(input.tree);
|
|
63805
|
+
const declared = workspacePatternsOf({
|
|
63806
|
+
packageJson: input.packageJson,
|
|
63807
|
+
pnpmWorkspace: input.pnpmWorkspace
|
|
63117
63808
|
});
|
|
63118
63809
|
const patterns = declared.length > 0 ? declared : options.defaultPatterns ?? [];
|
|
63119
63810
|
const candidates2 = new Set;
|
|
63120
|
-
for (const path of
|
|
63811
|
+
for (const path of input.tree) {
|
|
63121
63812
|
const dir = dirOfPackageJson(path) ?? dirOfManifest(path);
|
|
63122
63813
|
if (dir === undefined || dir === ".")
|
|
63123
63814
|
continue;
|
|
@@ -63280,7 +63971,11 @@ function workspaceCloudflareProvider(options = {}) {
|
|
|
63280
63971
|
};
|
|
63281
63972
|
}
|
|
63282
63973
|
var workspaceCloudflare = workspaceCloudflareProvider();
|
|
63283
|
-
var BUILTIN_PROVIDERS = [
|
|
63974
|
+
var BUILTIN_PROVIDERS = [
|
|
63975
|
+
workspaceCloudflare,
|
|
63976
|
+
workspaceNpmProvider(),
|
|
63977
|
+
lambdaFunctionProvider()
|
|
63978
|
+
];
|
|
63284
63979
|
function directoriesOfPackageNames(workspaces) {
|
|
63285
63980
|
const byName = new Map;
|
|
63286
63981
|
for (const workspace of workspaces)
|
|
@@ -63307,15 +64002,23 @@ function workspaceClosureOf(target, byName, dependenciesOf) {
|
|
|
63307
64002
|
// ../../packages/praxis/deploy-core/src/plan.ts
|
|
63308
64003
|
async function planRepository(facts, providers = BUILTIN_PROVIDERS, options = {}) {
|
|
63309
64004
|
let partial = { targets: [] };
|
|
64005
|
+
const warnings = [];
|
|
63310
64006
|
for (const provider of providers) {
|
|
63311
64007
|
const confidence = await provider.detect(facts);
|
|
63312
64008
|
if (confidence === "none")
|
|
63313
64009
|
continue;
|
|
63314
64010
|
partial = await provider.plan(facts, partial);
|
|
64011
|
+
for (const warning of partial.warnings ?? [])
|
|
64012
|
+
if (!warnings.includes(warning))
|
|
64013
|
+
warnings.push(warning);
|
|
63315
64014
|
}
|
|
63316
64015
|
const drafts = partial.targets.filter((draft) => draft.deploy !== false);
|
|
63317
64016
|
const workspaces = await readWorkspaces(facts, options);
|
|
63318
|
-
return {
|
|
64017
|
+
return {
|
|
64018
|
+
commit: facts.commit,
|
|
64019
|
+
targets: closePlan(drafts, workspaces),
|
|
64020
|
+
...warnings.length === 0 ? {} : { warnings }
|
|
64021
|
+
};
|
|
63319
64022
|
}
|
|
63320
64023
|
function closePlan(drafts, workspaces) {
|
|
63321
64024
|
const configOf = new Map(workspaces.map((workspace) => [workspace.dir, workspace.config]));
|
|
@@ -63337,7 +64040,7 @@ function closePlan(drafts, workspaces) {
|
|
|
63337
64040
|
path: draft.path,
|
|
63338
64041
|
name: draft.name,
|
|
63339
64042
|
destination: draft.destination,
|
|
63340
|
-
dependsOn: edges.get(draft.path) ?? [],
|
|
64043
|
+
dependsOn: [...new Set([...edges.get(draft.path) ?? [], ...draft.dependsOn ?? []])],
|
|
63341
64044
|
...draft.environments === undefined ? {} : { environments: draft.environments },
|
|
63342
64045
|
production: draft.production === true,
|
|
63343
64046
|
onTrain: draft.onTrain !== false,
|
|
@@ -63346,10 +64049,10 @@ function closePlan(drafts, workspaces) {
|
|
|
63346
64049
|
}
|
|
63347
64050
|
function isDeployToolDependency(name, path) {
|
|
63348
64051
|
const directory = path.replace(/^(\.\/)+/, "").replace(/^\/+/, "").replace(/\/+$/, "");
|
|
63349
|
-
|
|
63350
|
-
|
|
63351
|
-
|
|
63352
|
-
|
|
64052
|
+
for (const root of ["packages/mise", "packages/devops", "packages/testing", "packages/bdd"]) {
|
|
64053
|
+
if (directory === root || directory.startsWith(`${root}/`))
|
|
64054
|
+
return true;
|
|
64055
|
+
}
|
|
63353
64056
|
return name.startsWith("@mise/");
|
|
63354
64057
|
}
|
|
63355
64058
|
function targetsFor(plan, environment2) {
|
|
@@ -65098,7 +65801,7 @@ function planTest(flags, paths) {
|
|
|
65098
65801
|
}
|
|
65099
65802
|
function requireSingleCtrfTarget(targets) {
|
|
65100
65803
|
if (targets > 1)
|
|
65101
|
-
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 .
|
|
65804
|
+
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.");
|
|
65102
65805
|
}
|
|
65103
65806
|
var FAILURE_LIMIT2 = 20;
|
|
65104
65807
|
var member3 = (value, key) => typeof value === "object" && value !== null ? value[key] : undefined;
|
|
@@ -65333,6 +66036,30 @@ function bunTestRun(packagePath, code, output) {
|
|
|
65333
66036
|
}
|
|
65334
66037
|
|
|
65335
66038
|
// src/commands/devops-test.ts
|
|
66039
|
+
import { spawn as spawn4 } from "node:child_process";
|
|
66040
|
+
var CACHE_OFF_REEXEC_ENV = "PRAXIS_DEVOPS_TEST_CACHE_OFF";
|
|
66041
|
+
function needsCacheOffReexec(env) {
|
|
66042
|
+
return env.BUN_RUNTIME_TRANSPILER_CACHE_PATH !== "0" && !env[CACHE_OFF_REEXEC_ENV];
|
|
66043
|
+
}
|
|
66044
|
+
function isDevopsTestRun(words) {
|
|
66045
|
+
return words.join(" ") === "devops test";
|
|
66046
|
+
}
|
|
66047
|
+
function spawnInherit(cmd, args, options) {
|
|
66048
|
+
return new Promise((resolveCode) => {
|
|
66049
|
+
const child = spawn4(cmd, [...args], { cwd: options.cwd, env: options.env, stdio: "inherit" });
|
|
66050
|
+
child.once("error", (error) => {
|
|
66051
|
+
console.error(error instanceof Error ? error.message : String(error));
|
|
66052
|
+
resolveCode(1);
|
|
66053
|
+
});
|
|
66054
|
+
child.once("close", (code) => resolveCode(code ?? 1));
|
|
66055
|
+
});
|
|
66056
|
+
}
|
|
66057
|
+
function reexecWithCacheOff(options = {}) {
|
|
66058
|
+
return (options.spawn ?? spawnInherit)(process.execPath, options.argv ?? process.argv.slice(1), {
|
|
66059
|
+
cwd: options.cwd ?? process.cwd(),
|
|
66060
|
+
env: { ...options.env ?? process.env, BUN_RUNTIME_TRANSPILER_CACHE_PATH: "0", [CACHE_OFF_REEXEC_ENV]: "1" }
|
|
66061
|
+
});
|
|
66062
|
+
}
|
|
65336
66063
|
async function devopsTest(flags, paths, ports) {
|
|
65337
66064
|
const plan = planTest(flags, paths);
|
|
65338
66065
|
if (plan.mode.kind === "affected")
|
|
@@ -65457,7 +66184,7 @@ async function devopsTestReportUpload(args, ports) {
|
|
|
65457
66184
|
if (id === undefined || id === "")
|
|
65458
66185
|
throw new UsageError("--upload needs --id", "Run `praxis devops test report` first to list this machine's runs, then pass one with --id.");
|
|
65459
66186
|
const root = await ports.root();
|
|
65460
|
-
const file = join6(root, ".
|
|
66187
|
+
const file = join6(root, ".praxis", "ctrf", `${id}.json`);
|
|
65461
66188
|
let report;
|
|
65462
66189
|
try {
|
|
65463
66190
|
report = await ports.readFile(file);
|
|
@@ -65533,8 +66260,8 @@ async function devopsTestInspect(args, ports) {
|
|
|
65533
66260
|
return 0;
|
|
65534
66261
|
}
|
|
65535
66262
|
async function localEngine(cwd) {
|
|
65536
|
-
const { testCommand } = await import("@
|
|
65537
|
-
const { mise } = await import("@
|
|
66263
|
+
const { testCommand } = await import("@deepractice-ai/devops-test-engine/test-command");
|
|
66264
|
+
const { mise } = await import("@deepractice-ai/devops-test-engine");
|
|
65538
66265
|
const { createLocalPlatform } = await import("@deepractice-ai/bdd-local");
|
|
65539
66266
|
const { _scanPackages } = await import("@deepractice-ai/bdd-service/shared/bdd-config");
|
|
65540
66267
|
const platform = createLocalPlatform({ cwd });
|
|
@@ -65603,8 +66330,8 @@ async function localEngine(cwd) {
|
|
|
65603
66330
|
})
|
|
65604
66331
|
};
|
|
65605
66332
|
}
|
|
65606
|
-
async function localCheckout(cwd,
|
|
65607
|
-
const git2 = (args) =>
|
|
66333
|
+
async function localCheckout(cwd, spawn5) {
|
|
66334
|
+
const git2 = (args) => spawn5("git", [...args], { cwd });
|
|
65608
66335
|
const required = async (args) => {
|
|
65609
66336
|
const result = await git2(args);
|
|
65610
66337
|
if (result.code !== 0)
|
|
@@ -65640,7 +66367,7 @@ async function localCheckout(cwd, spawn4) {
|
|
|
65640
66367
|
const files = new Map;
|
|
65641
66368
|
const walk = async (dir) => {
|
|
65642
66369
|
for (const entry of await readdir2(dir, { withFileTypes: true })) {
|
|
65643
|
-
if (["node_modules", ".git", "dist", ".
|
|
66370
|
+
if (["node_modules", ".git", "dist", ".praxis"].includes(entry.name))
|
|
65644
66371
|
continue;
|
|
65645
66372
|
const full = join6(dir, entry.name);
|
|
65646
66373
|
if (entry.isDirectory()) {
|
|
@@ -65655,7 +66382,7 @@ async function localCheckout(cwd, spawn4) {
|
|
|
65655
66382
|
await walk(packagePath);
|
|
65656
66383
|
return files;
|
|
65657
66384
|
},
|
|
65658
|
-
runTests: (packagePath, files) =>
|
|
66385
|
+
runTests: (packagePath, files) => spawn5("nice", ["-n", "10", "bun", "test", ...files], { cwd: packagePath })
|
|
65659
66386
|
};
|
|
65660
66387
|
}
|
|
65661
66388
|
async function withEngineStdoutOnStderr(body) {
|
|
@@ -65692,7 +66419,7 @@ async function runEngineCall(call, ports) {
|
|
|
65692
66419
|
return exitCode;
|
|
65693
66420
|
}
|
|
65694
66421
|
async function miseEngine(cwd) {
|
|
65695
|
-
const { mise } = await import("@
|
|
66422
|
+
const { mise } = await import("@deepractice-ai/devops-test-engine");
|
|
65696
66423
|
const { createLocalPlatform } = await import("@deepractice-ai/bdd-local");
|
|
65697
66424
|
const platform = createLocalPlatform({ cwd });
|
|
65698
66425
|
return {
|
|
@@ -65832,7 +66559,7 @@ function removalSteps(key) {
|
|
|
65832
66559
|
`No code references ${key}. The rest is not this command's to do:`,
|
|
65833
66560
|
` 1. Deploy the code that removed the references (deploy never writes the trunk).`,
|
|
65834
66561
|
` 2. Retire the flag on the platform: praxis api devops flag archive <flg_…> — the terminal state.`,
|
|
65835
|
-
` Archiving keeps the key reserved and
|
|
66562
|
+
` 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).`,
|
|
65836
66563
|
` 3. Regenerate the registry: praxis devops flag sync`
|
|
65837
66564
|
].join(`
|
|
65838
66565
|
`);
|
|
@@ -65862,6 +66589,25 @@ async function repositoryRoot(cwd, read) {
|
|
|
65862
66589
|
dir = parent;
|
|
65863
66590
|
}
|
|
65864
66591
|
}
|
|
66592
|
+
var SNIPPET_LIMIT = 200;
|
|
66593
|
+
function snippetOf(text2, line) {
|
|
66594
|
+
const trimmed = (text2.split(`
|
|
66595
|
+
`)[line - 1] ?? "").trim();
|
|
66596
|
+
return trimmed.length > SNIPPET_LIMIT ? trimmed.slice(0, SNIPPET_LIMIT) : trimmed;
|
|
66597
|
+
}
|
|
66598
|
+
function reportedKeys(keys, sources, refs) {
|
|
66599
|
+
const texts = new Map(sources.map((file) => [file.path, file.text]));
|
|
66600
|
+
return keys.map((flagKey) => ({
|
|
66601
|
+
flagKey,
|
|
66602
|
+
items: refs.filter((ref) => ref.key === flagKey).map((ref) => ({ path: ref.file, line: ref.line, snippet: snippetOf(texts.get(ref.file) ?? "", ref.line) }))
|
|
66603
|
+
}));
|
|
66604
|
+
}
|
|
66605
|
+
function reportNeedsProject() {
|
|
66606
|
+
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.");
|
|
66607
|
+
}
|
|
66608
|
+
function reportClientMissing() {
|
|
66609
|
+
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.");
|
|
66610
|
+
}
|
|
65865
66611
|
async function codeSources(ports, registry) {
|
|
65866
66612
|
const suffix = registry.replace(/^\.\//, "");
|
|
65867
66613
|
return (await ports.sources()).filter((file) => !file.path.replace(/^\.\//, "").endsWith(suffix));
|
|
@@ -65918,15 +66664,33 @@ async function devopsFlagScaffold(key, args, ports) {
|
|
|
65918
66664
|
ports.emit({ kind: "object", data: { key, registry, file, call: scaffoldCall(key) } });
|
|
65919
66665
|
return 0;
|
|
65920
66666
|
}
|
|
65921
|
-
async function devopsFlagRefs(key, ports) {
|
|
66667
|
+
async function devopsFlagRefs(key, args, ports) {
|
|
65922
66668
|
const registry = await registryOf(ports);
|
|
65923
66669
|
const flags = await ports.loadRegistry(registry);
|
|
65924
66670
|
const keys = key !== undefined ? [key] : Object.keys(flags).sort();
|
|
65925
|
-
const
|
|
66671
|
+
const sources = await codeSources(ports, registry);
|
|
66672
|
+
const refs = flagReferences(sources, keys);
|
|
65926
66673
|
for (const ref of refs)
|
|
65927
66674
|
ports.human(`${ref.file}:${ref.line}: ${ref.key}`);
|
|
65928
66675
|
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.`);
|
|
65929
|
-
|
|
66676
|
+
if (!args.report) {
|
|
66677
|
+
ports.emit({ kind: "object", data: { refs, reported: false } });
|
|
66678
|
+
return 0;
|
|
66679
|
+
}
|
|
66680
|
+
const project = args.project;
|
|
66681
|
+
if (project === undefined || project === "")
|
|
66682
|
+
throw reportNeedsProject();
|
|
66683
|
+
const scannedCommit = (await ports.git(["rev-parse", "HEAD"])).trim();
|
|
66684
|
+
if (scannedCommit === "")
|
|
66685
|
+
throw new UsageError("git rev-parse HEAD answered no commit", "Run this command inside a git repository.");
|
|
66686
|
+
const payload = reportedKeys(Object.keys(flags).sort(), sources, refs);
|
|
66687
|
+
const client2 = await ports.client();
|
|
66688
|
+
const report = client2.devops?.projects?.flags?.reportCodeRefs;
|
|
66689
|
+
if (typeof report !== "function")
|
|
66690
|
+
throw reportClientMissing();
|
|
66691
|
+
const answer = await report.call(client2.devops.projects.flags, { path: { project }, body: { scannedCommit, refs: payload } });
|
|
66692
|
+
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(", ")}` : ""}.`);
|
|
66693
|
+
ports.emit({ kind: "object", data: { refs, reported: true, project, scannedCommit, updated: answer.updated, unknownKeys: answer.unknownKeys } });
|
|
65930
66694
|
return 0;
|
|
65931
66695
|
}
|
|
65932
66696
|
async function devopsFlagRemove(key, ports) {
|
|
@@ -66166,9 +66930,9 @@ function refactorRoot(fileRelToCheckout, hasTsconfig) {
|
|
|
66166
66930
|
// src/commands/devops-refactor.ts
|
|
66167
66931
|
function codeRefactorEngine() {
|
|
66168
66932
|
return {
|
|
66169
|
-
rename: async (input) => (await repositoryEngine("devops refactor rename", () => import("@
|
|
66170
|
-
check: async (input) => (await repositoryEngine("devops refactor check", () => import("@
|
|
66171
|
-
apply: async (input) => (await repositoryEngine("devops refactor apply", () => import("@
|
|
66933
|
+
rename: async (input) => (await repositoryEngine("devops refactor rename", () => import("@deepractice-ai/devops-refactor/rename"))).planSemanticRename(input),
|
|
66934
|
+
check: async (input) => (await repositoryEngine("devops refactor check", () => import("@deepractice-ai/devops-refactor/rename"))).inspectRenamePlan(input),
|
|
66935
|
+
apply: async (input) => (await repositoryEngine("devops refactor apply", () => import("@deepractice-ai/devops-refactor/rename"))).applyRenamePlan(input)
|
|
66172
66936
|
};
|
|
66173
66937
|
}
|
|
66174
66938
|
function required(value, argument, use) {
|
|
@@ -68576,6 +69340,7 @@ var FILE_ID = /^file-/;
|
|
|
68576
69340
|
var asRecord = (value) => value !== null && typeof value === "object" && !Array.isArray(value) ? value : undefined;
|
|
68577
69341
|
var isImage = (node2) => node2.type === "image" && typeof node2.url === "string";
|
|
68578
69342
|
var isRef = (node2) => node2.type === "ref" && typeof node2.ref === "string";
|
|
69343
|
+
var NODE_TYPES = new Set(Object.keys(KNOWN_PROPS));
|
|
68579
69344
|
function visit2(value, nodeId, fn) {
|
|
68580
69345
|
if (Array.isArray(value)) {
|
|
68581
69346
|
for (const item of value)
|
|
@@ -68769,6 +69534,8 @@ var warningLine = (warning) => {
|
|
|
68769
69534
|
return `${warning.code}: ${warning.ref} at ${warning.nodeId}`;
|
|
68770
69535
|
case "FRAME_NOT_FOUND":
|
|
68771
69536
|
return `${warning.code}: ${warning.id}`;
|
|
69537
|
+
case "IMAGE_FILE_NOT_FOUND":
|
|
69538
|
+
return `${warning.code}: ${warning.url} (the platform holds no such file) at ${warning.nodeId}`;
|
|
68772
69539
|
default:
|
|
68773
69540
|
return `${warning.code}: ${warning.url}`;
|
|
68774
69541
|
}
|
|
@@ -68876,6 +69643,268 @@ async function canvasImport(args, ports) {
|
|
|
68876
69643
|
return 0;
|
|
68877
69644
|
}
|
|
68878
69645
|
|
|
69646
|
+
// src/commands/events-wait.ts
|
|
69647
|
+
var DEFAULT_AGENT = "R1M9TQ2X";
|
|
69648
|
+
var BASE_BACKOFF_MS = 1000;
|
|
69649
|
+
var MAX_BACKOFF_MS = 60000;
|
|
69650
|
+
var NOTICE_NAMED = 5;
|
|
69651
|
+
var ANNOUNCED_KEEP = 500;
|
|
69652
|
+
function assumeAgentOf(env) {
|
|
69653
|
+
return env.PRAXIS_ASSUME_AGENT?.trim() || DEFAULT_AGENT;
|
|
69654
|
+
}
|
|
69655
|
+
function sessionOf(raw) {
|
|
69656
|
+
if (raw === undefined)
|
|
69657
|
+
return null;
|
|
69658
|
+
const session = raw.trim();
|
|
69659
|
+
if (!/^[A-Za-z0-9_-]{1,128}$/.test(session))
|
|
69660
|
+
throw new Error("--session takes the Claude Code session id (letters, digits, - and _)");
|
|
69661
|
+
return session;
|
|
69662
|
+
}
|
|
69663
|
+
var keyPart = (part) => part.replace(/[^A-Za-z0-9_-]/g, "_");
|
|
69664
|
+
function waitKeyOf(env, agent, session) {
|
|
69665
|
+
return [env, agent, ...session === null ? [] : [session]].map(keyPart).join("-");
|
|
69666
|
+
}
|
|
69667
|
+
function pidOf(raw) {
|
|
69668
|
+
const pid = raw === null ? NaN : Number(raw.trim());
|
|
69669
|
+
return Number.isInteger(pid) && pid > 0 ? pid : null;
|
|
69670
|
+
}
|
|
69671
|
+
function lockDecision(recorded, self, probe) {
|
|
69672
|
+
if (recorded === null || recorded === self || probe === null || !probe.alive)
|
|
69673
|
+
return { kind: "take" };
|
|
69674
|
+
if (!/events\s+wait/.test(probe.command))
|
|
69675
|
+
return { kind: "take" };
|
|
69676
|
+
if (probe.ppid === 1)
|
|
69677
|
+
return { kind: "replace", pid: recorded };
|
|
69678
|
+
return { kind: "refuse", pid: recorded };
|
|
69679
|
+
}
|
|
69680
|
+
function alreadyWaitingNotice(pid) {
|
|
69681
|
+
return `本会话已有 praxis agent events wait 在后台等待(pid ${pid}),不用再启动。`;
|
|
69682
|
+
}
|
|
69683
|
+
async function acquireWaitLock(ports) {
|
|
69684
|
+
for (let attempt = 0;attempt < 3; attempt++) {
|
|
69685
|
+
const recorded = pidOf(await ports.readPid());
|
|
69686
|
+
if (recorded === null) {
|
|
69687
|
+
if (await ports.createPid(String(ports.self)))
|
|
69688
|
+
return null;
|
|
69689
|
+
continue;
|
|
69690
|
+
}
|
|
69691
|
+
const decision = lockDecision(recorded, ports.self, await ports.probe(recorded));
|
|
69692
|
+
if (decision.kind === "refuse")
|
|
69693
|
+
return decision.pid;
|
|
69694
|
+
if (decision.kind === "replace")
|
|
69695
|
+
ports.terminate(decision.pid);
|
|
69696
|
+
await ports.replacePid(String(ports.self));
|
|
69697
|
+
const holder = pidOf(await ports.readPid());
|
|
69698
|
+
return holder === ports.self || holder === null ? null : holder;
|
|
69699
|
+
}
|
|
69700
|
+
return pidOf(await ports.readPid());
|
|
69701
|
+
}
|
|
69702
|
+
function timeoutMsOf(raw) {
|
|
69703
|
+
if (raw === undefined)
|
|
69704
|
+
return null;
|
|
69705
|
+
const seconds = Number(raw);
|
|
69706
|
+
if (!/^\d+(\.\d+)?$/.test(raw.trim()) || !Number.isFinite(seconds) || seconds <= 0)
|
|
69707
|
+
throw new Error("--timeout takes a positive number of seconds");
|
|
69708
|
+
return Math.round(seconds * 1000);
|
|
69709
|
+
}
|
|
69710
|
+
function backoffMs(failures) {
|
|
69711
|
+
if (failures <= 0)
|
|
69712
|
+
return 0;
|
|
69713
|
+
return Math.min(MAX_BACKOFF_MS, BASE_BACKOFF_MS * 2 ** Math.min(failures - 1, 16));
|
|
69714
|
+
}
|
|
69715
|
+
function inboxLettersUrl(apiUrl, agent) {
|
|
69716
|
+
return `${apiUrl}/agent/v1/agents/${encodeURIComponent(agent)}/inbox/letters?unread=true&limit=20`;
|
|
69717
|
+
}
|
|
69718
|
+
function eventsStreamUrl(apiUrl, agent) {
|
|
69719
|
+
return `${apiUrl}/agent/v1/agents/${encodeURIComponent(agent)}/events/stream`;
|
|
69720
|
+
}
|
|
69721
|
+
function streamHeaders(auth, lastEventId) {
|
|
69722
|
+
return { ...auth, Accept: "text/event-stream", ...lastEventId === null ? {} : { "Last-Event-ID": lastEventId } };
|
|
69723
|
+
}
|
|
69724
|
+
function lettersOf(body) {
|
|
69725
|
+
const value = body;
|
|
69726
|
+
if (!value || typeof value.unread !== "number" || !Array.isArray(value.letters))
|
|
69727
|
+
throw new Error("letters answer is not { unread, letters }");
|
|
69728
|
+
const letters = value.letters.filter((letter) => typeof letter === "object" && letter !== null && typeof letter.id === "string" && typeof letter.summary === "string");
|
|
69729
|
+
return { unread: value.unread, letters };
|
|
69730
|
+
}
|
|
69731
|
+
function feedSse(buffer, chunk) {
|
|
69732
|
+
const text2 = (buffer + chunk).replace(/\r\n?/g, `
|
|
69733
|
+
`);
|
|
69734
|
+
const blocks = text2.split(`
|
|
69735
|
+
|
|
69736
|
+
`);
|
|
69737
|
+
const rest = blocks.pop() ?? "";
|
|
69738
|
+
const frames = [];
|
|
69739
|
+
for (const block of blocks) {
|
|
69740
|
+
let event, id;
|
|
69741
|
+
const data = [];
|
|
69742
|
+
for (const line of block.split(`
|
|
69743
|
+
`)) {
|
|
69744
|
+
if (line === "" || line.startsWith(":"))
|
|
69745
|
+
continue;
|
|
69746
|
+
const colon = line.indexOf(":");
|
|
69747
|
+
const field = colon < 0 ? line : line.slice(0, colon);
|
|
69748
|
+
const value = colon < 0 ? "" : line.slice(colon + 1).replace(/^ /, "");
|
|
69749
|
+
if (field === "data")
|
|
69750
|
+
data.push(value);
|
|
69751
|
+
else if (field === "event")
|
|
69752
|
+
event = value;
|
|
69753
|
+
else if (field === "id")
|
|
69754
|
+
id = value;
|
|
69755
|
+
}
|
|
69756
|
+
if (data.length)
|
|
69757
|
+
frames.push({ ...event === undefined ? {} : { event }, ...id === undefined ? {} : { id }, data: data.join(`
|
|
69758
|
+
`) });
|
|
69759
|
+
}
|
|
69760
|
+
return { buffer: rest, frames };
|
|
69761
|
+
}
|
|
69762
|
+
var text2 = (value) => typeof value === "string" && value !== "";
|
|
69763
|
+
function wakeOf(frame) {
|
|
69764
|
+
let event;
|
|
69765
|
+
try {
|
|
69766
|
+
event = JSON.parse(frame.data);
|
|
69767
|
+
} catch {
|
|
69768
|
+
return null;
|
|
69769
|
+
}
|
|
69770
|
+
if (typeof event !== "object" || event === null)
|
|
69771
|
+
return null;
|
|
69772
|
+
if (event.type === "inbox.letter_delivered" && text2(event.letter_id) && typeof event.summary === "string")
|
|
69773
|
+
return { kind: "letter", letter: {
|
|
69774
|
+
id: event.letter_id,
|
|
69775
|
+
sender: typeof event.sender === "string" ? event.sender : "",
|
|
69776
|
+
...text2(event.sender_name) ? { sender_name: event.sender_name } : {},
|
|
69777
|
+
summary: event.summary,
|
|
69778
|
+
thread: typeof event.thread === "string" ? event.thread : null,
|
|
69779
|
+
create_time: typeof event.create_time === "string" ? event.create_time : ""
|
|
69780
|
+
} };
|
|
69781
|
+
if (event.type === "cognition.ritual_held" && text2(event.title))
|
|
69782
|
+
return { kind: "ritual", ritual: {
|
|
69783
|
+
ritual: text2(event.ritual) ? event.ritual : "",
|
|
69784
|
+
owner: text2(event.owner) ? event.owner : "",
|
|
69785
|
+
title: event.title,
|
|
69786
|
+
engram: text2(event.engram) ? event.engram : ""
|
|
69787
|
+
} };
|
|
69788
|
+
return null;
|
|
69789
|
+
}
|
|
69790
|
+
function ritualNotice(ritual) {
|
|
69791
|
+
const origin = [ritual.owner, ritual.ritual].filter(Boolean).join(" 的仪式 ");
|
|
69792
|
+
return `你获得了一段新记忆:「${ritual.title}」${origin ? `(${origin}${ritual.engram ? `,${ritual.engram}` : ""})` : ""}。处理完再在后台运行 praxis agent events wait。`;
|
|
69793
|
+
}
|
|
69794
|
+
function retryableStatus(status) {
|
|
69795
|
+
return status >= 500 || status === 408 || status === 429;
|
|
69796
|
+
}
|
|
69797
|
+
function planNotice(page, announced) {
|
|
69798
|
+
const seen = new Set(announced);
|
|
69799
|
+
const fresh = page.letters.filter((letter) => !seen.has(letter.id));
|
|
69800
|
+
if (!fresh.length)
|
|
69801
|
+
return { announced };
|
|
69802
|
+
const named = fresh.slice(0, NOTICE_NAMED).map((letter) => `${letter.sender_name || letter.sender}:${letter.summary}(${letter.id})`);
|
|
69803
|
+
const more = fresh.length > NOTICE_NAMED ? `;另有 ${fresh.length - NOTICE_NAMED} 封` : "";
|
|
69804
|
+
const notice = `你有 ${fresh.length} 封新信:${named.join(";")}${more}。用 praxis_assume_inbox(action "read")读取并处理,处理完再在后台运行 praxis agent events wait。`;
|
|
69805
|
+
const next = [...announced, ...fresh.map((letter) => letter.id)];
|
|
69806
|
+
return { notice, announced: next.length > ANNOUNCED_KEEP ? next.slice(next.length - ANNOUNCED_KEEP) : next };
|
|
69807
|
+
}
|
|
69808
|
+
function waitStateOf(raw) {
|
|
69809
|
+
if (raw === null)
|
|
69810
|
+
return { announced: [], lastEventId: null };
|
|
69811
|
+
try {
|
|
69812
|
+
const value = JSON.parse(raw);
|
|
69813
|
+
return {
|
|
69814
|
+
announced: Array.isArray(value.announced) ? value.announced.filter((id) => typeof id === "string") : [],
|
|
69815
|
+
lastEventId: typeof value.last_event_id === "string" && /^\d+$/.test(value.last_event_id) ? value.last_event_id : null
|
|
69816
|
+
};
|
|
69817
|
+
} catch {
|
|
69818
|
+
return { announced: [], lastEventId: null };
|
|
69819
|
+
}
|
|
69820
|
+
}
|
|
69821
|
+
function waitStateText(state) {
|
|
69822
|
+
return JSON.stringify({ announced: state.announced, ...state.lastEventId === null ? {} : { last_event_id: state.lastEventId } });
|
|
69823
|
+
}
|
|
69824
|
+
var message = (error) => error instanceof Error ? error.message : String(error);
|
|
69825
|
+
async function runEventsWait(ports) {
|
|
69826
|
+
const stop = new AbortController;
|
|
69827
|
+
let timedOut = false;
|
|
69828
|
+
const timer = ports.timeoutMs === null ? undefined : setTimeout(() => {
|
|
69829
|
+
timedOut = true;
|
|
69830
|
+
stop.abort();
|
|
69831
|
+
}, ports.timeoutMs);
|
|
69832
|
+
const state = await ports.readState();
|
|
69833
|
+
let announced = state.announced;
|
|
69834
|
+
let lastEventId = state.lastEventId;
|
|
69835
|
+
const announceLetters = async (page) => {
|
|
69836
|
+
const planned = planNotice(page, announced);
|
|
69837
|
+
if (!planned.notice)
|
|
69838
|
+
return false;
|
|
69839
|
+
announced = planned.announced;
|
|
69840
|
+
await ports.writeState({ announced, lastEventId });
|
|
69841
|
+
ports.print(planned.notice);
|
|
69842
|
+
return true;
|
|
69843
|
+
};
|
|
69844
|
+
const announce = async () => announceLetters(await ports.fetchLetters());
|
|
69845
|
+
try {
|
|
69846
|
+
try {
|
|
69847
|
+
if (await announce())
|
|
69848
|
+
return 0;
|
|
69849
|
+
} catch (error) {
|
|
69850
|
+
ports.log(`praxis agent events wait: reading letters failed: ${message(error)}`);
|
|
69851
|
+
}
|
|
69852
|
+
ports.log(`praxis agent events wait: waiting for letters to assume agent ${ports.agent}`);
|
|
69853
|
+
let failures = 0;
|
|
69854
|
+
while (!stop.signal.aborted) {
|
|
69855
|
+
if (failures)
|
|
69856
|
+
await ports.sleep(backoffMs(failures), stop.signal);
|
|
69857
|
+
if (stop.signal.aborted)
|
|
69858
|
+
break;
|
|
69859
|
+
try {
|
|
69860
|
+
const opened = await ports.openStream(stop.signal, lastEventId);
|
|
69861
|
+
if (opened.status < 200 || opened.status >= 300 || !opened.chunks) {
|
|
69862
|
+
if (!retryableStatus(opened.status)) {
|
|
69863
|
+
ports.log(`praxis agent events wait: the event stream was refused (HTTP ${opened.status}${opened.reason ? `: ${opened.reason}` : ""})`);
|
|
69864
|
+
return 1;
|
|
69865
|
+
}
|
|
69866
|
+
throw new Error(`HTTP ${opened.status}`);
|
|
69867
|
+
}
|
|
69868
|
+
if (await announce())
|
|
69869
|
+
return 0;
|
|
69870
|
+
if (failures)
|
|
69871
|
+
ports.log("praxis agent events wait: event stream reconnected");
|
|
69872
|
+
failures = 0;
|
|
69873
|
+
let buffer = "";
|
|
69874
|
+
for await (const chunk of opened.chunks) {
|
|
69875
|
+
const fed = feedSse(buffer, chunk);
|
|
69876
|
+
buffer = fed.buffer;
|
|
69877
|
+
for (const frame of fed.frames) {
|
|
69878
|
+
const wake = wakeOf(frame);
|
|
69879
|
+
if (wake !== null && frame.id !== undefined)
|
|
69880
|
+
lastEventId = frame.id;
|
|
69881
|
+
if (wake?.kind === "letter" && await announceLetters({ unread: 1, letters: [wake.letter] }))
|
|
69882
|
+
return 0;
|
|
69883
|
+
if (wake?.kind === "ritual") {
|
|
69884
|
+
await ports.writeState({ announced, lastEventId });
|
|
69885
|
+
ports.print(ritualNotice(wake.ritual));
|
|
69886
|
+
return 0;
|
|
69887
|
+
}
|
|
69888
|
+
}
|
|
69889
|
+
}
|
|
69890
|
+
throw new Error("the event stream ended");
|
|
69891
|
+
} catch (error) {
|
|
69892
|
+
if (stop.signal.aborted)
|
|
69893
|
+
break;
|
|
69894
|
+
failures += 1;
|
|
69895
|
+
ports.log(`praxis agent events wait: ${message(error)} (${failures} in a row, reconnecting in ${backoffMs(failures) / 1000}s)`);
|
|
69896
|
+
}
|
|
69897
|
+
}
|
|
69898
|
+
if (timedOut)
|
|
69899
|
+
ports.print(`${(ports.timeoutMs ?? 0) / 1000} 秒内没有新信。需要继续等待时再在后台运行 praxis agent events wait。`);
|
|
69900
|
+
return 0;
|
|
69901
|
+
} finally {
|
|
69902
|
+
if (timer)
|
|
69903
|
+
clearTimeout(timer);
|
|
69904
|
+
stop.abort();
|
|
69905
|
+
}
|
|
69906
|
+
}
|
|
69907
|
+
|
|
68879
69908
|
// src/main.ts
|
|
68880
69909
|
import { spawnSync } from "node:child_process";
|
|
68881
69910
|
|
|
@@ -68993,15 +70022,15 @@ class ModelStream {
|
|
|
68993
70022
|
finishReason = "unknown";
|
|
68994
70023
|
usage;
|
|
68995
70024
|
add(event) {
|
|
68996
|
-
const data = streamData(event),
|
|
70025
|
+
const data = streamData(event), message2 = record(data.message), response = record(data.response);
|
|
68997
70026
|
this.chunks.push(streamText(event));
|
|
68998
70027
|
const choices = Array.isArray(data.choices) ? data.choices : [];
|
|
68999
|
-
const reason2 = choices.map((c) => record(c).finish_reason).find((r) => typeof r === "string" && r) ?? record(data.delta).stop_reason ??
|
|
70028
|
+
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;
|
|
69000
70029
|
if (typeof reason2 === "string" && reason2)
|
|
69001
70030
|
this.finishReason = reason2;
|
|
69002
70031
|
else if (["response.completed", "response.incomplete", "response.failed"].includes(String(data.type)))
|
|
69003
70032
|
this.finishReason = String(data.type).slice("response.".length);
|
|
69004
|
-
for (const usage of [
|
|
70033
|
+
for (const usage of [message2.usage, data.usage, response.usage]) {
|
|
69005
70034
|
if (usage !== null && typeof usage === "object" && !Array.isArray(usage))
|
|
69006
70035
|
this.usage = { ...this.usage, ...record(usage) };
|
|
69007
70036
|
}
|
|
@@ -69066,8 +70095,8 @@ function isSuccess(verb, ctx) {
|
|
|
69066
70095
|
}
|
|
69067
70096
|
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" };
|
|
69068
70097
|
var deleted = (verb) => /^(delete|remove|purge)(-|$)/.test(verb);
|
|
69069
|
-
function width(
|
|
69070
|
-
return [...
|
|
70098
|
+
function width(text3) {
|
|
70099
|
+
return [...text3].reduce((sum, ch) => {
|
|
69071
70100
|
const cp = ch.codePointAt(0);
|
|
69072
70101
|
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);
|
|
69073
70102
|
}, 0);
|
|
@@ -69075,13 +70104,13 @@ function width(text2) {
|
|
|
69075
70104
|
function truncate(value, size) {
|
|
69076
70105
|
if (width(value) <= size)
|
|
69077
70106
|
return value;
|
|
69078
|
-
let
|
|
70107
|
+
let text3 = "";
|
|
69079
70108
|
for (const ch of value) {
|
|
69080
|
-
if (width(
|
|
70109
|
+
if (width(text3 + ch) > size - 1)
|
|
69081
70110
|
break;
|
|
69082
|
-
|
|
70111
|
+
text3 += ch;
|
|
69083
70112
|
}
|
|
69084
|
-
return
|
|
70113
|
+
return text3 + "…";
|
|
69085
70114
|
}
|
|
69086
70115
|
function table(items, ctx, paint) {
|
|
69087
70116
|
const columns = columnsFor(items);
|
|
@@ -69114,13 +70143,13 @@ function table(items, ctx, paint) {
|
|
|
69114
70143
|
sizes[index]--;
|
|
69115
70144
|
}
|
|
69116
70145
|
const line = (row, header) => row.map((v, i) => {
|
|
69117
|
-
const
|
|
69118
|
-
let styled = header ? paint.dim(
|
|
70146
|
+
const text3 = truncate(v, sizes[i]);
|
|
70147
|
+
let styled = header ? paint.dim(text3) : text3;
|
|
69119
70148
|
if (!header && ["status", "state"].includes(columns[i])) {
|
|
69120
70149
|
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;
|
|
69121
|
-
styled = color(
|
|
70150
|
+
styled = color(text3);
|
|
69122
70151
|
}
|
|
69123
|
-
return styled + (i === row.length - 1 ? "" : " ".repeat(Math.max(0, sizes[i] - width(
|
|
70152
|
+
return styled + (i === row.length - 1 ? "" : " ".repeat(Math.max(0, sizes[i] - width(text3))));
|
|
69124
70153
|
}).join(" ");
|
|
69125
70154
|
return [line(headers, true), ...rows.map((row) => line(row, false))].join(`
|
|
69126
70155
|
`) + `
|
|
@@ -69219,9 +70248,9 @@ function renderHuman(result, ctx) {
|
|
|
69219
70248
|
}
|
|
69220
70249
|
|
|
69221
70250
|
// src/output/agent.ts
|
|
69222
|
-
function cell(
|
|
69223
|
-
const chars = [...
|
|
69224
|
-
const limited = chars.length > 500 ? chars.slice(0, 500).join("") + `…[+${chars.length - 500} chars, use --json]` :
|
|
70251
|
+
function cell(text3) {
|
|
70252
|
+
const chars = [...text3];
|
|
70253
|
+
const limited = chars.length > 500 ? chars.slice(0, 500).join("") + `…[+${chars.length - 500} chars, use --json]` : text3;
|
|
69225
70254
|
return limited.replace(/\\/g, "\\\\").replace(/\|/g, "\\|").replace(/\r?\n/g, "<br>").replace(/\r/g, "<br>");
|
|
69226
70255
|
}
|
|
69227
70256
|
function renderAgent(result, ctx) {
|
|
@@ -69232,9 +70261,9 @@ function renderAgent(result, ctx) {
|
|
|
69232
70261
|
if (modelStream(result.op)) {
|
|
69233
70262
|
if (!result.summary)
|
|
69234
70263
|
return {};
|
|
69235
|
-
const { text:
|
|
69236
|
-
return { stdout: `${
|
|
69237
|
-
`) || !
|
|
70264
|
+
const { text: text3, finish_reason, usage } = result.summary;
|
|
70265
|
+
return { stdout: `${text3}${text3.endsWith(`
|
|
70266
|
+
`) || !text3 ? "" : `
|
|
69238
70267
|
`}finish_reason: ${finish_reason}
|
|
69239
70268
|
${usage ? `usage: ${JSON.stringify(usage)}
|
|
69240
70269
|
` : ""}` };
|
|
@@ -69453,18 +70482,18 @@ function errorInput(error, ctx) {
|
|
|
69453
70482
|
const details = candidate !== null && typeof candidate === "object" && !Array.isArray(candidate) ? candidate : undefined;
|
|
69454
70483
|
const problem = serverProblem(Object.keys(nested).length ? nested : raw);
|
|
69455
70484
|
const serverText = (value) => typeof value === "string" && value.trim() ? value : undefined;
|
|
69456
|
-
let
|
|
69457
|
-
const prefix =
|
|
70485
|
+
let message2 = error instanceof Error ? error.message : "Unexpected error";
|
|
70486
|
+
const prefix = message2.match(/^([A-Z][A-Z0-9_]+):\s*/)?.[1];
|
|
69458
70487
|
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");
|
|
69459
70488
|
let stripped = false;
|
|
69460
|
-
while (
|
|
69461
|
-
|
|
70489
|
+
while (message2.startsWith(`${code}:`)) {
|
|
70490
|
+
message2 = message2.slice(code.length + 1).trimStart();
|
|
69462
70491
|
stripped = true;
|
|
69463
70492
|
}
|
|
69464
70493
|
if (stripped)
|
|
69465
|
-
|
|
70494
|
+
message2 = `${humanize(code)}${message2 ? `: ${message2}` : ""}`;
|
|
69466
70495
|
const status = sdk?.status, request_id = sdk?.requestId;
|
|
69467
|
-
|
|
70496
|
+
message2 = serverText(problem?.detail) ?? serverText(problem?.title) ?? message2;
|
|
69468
70497
|
const authFailure = status === 401 || ["NOT_LOGGED_IN", "UNAUTHENTICATED", "TOKEN_REVOKED", "LOGIN_FAILED", "MANAGED_LOGIN_EXPIRED"].includes(code);
|
|
69469
70498
|
const source = ctx.credentialSource ?? "login";
|
|
69470
70499
|
let hint3 = genericHint;
|
|
@@ -69482,11 +70511,11 @@ function errorInput(error, ctx) {
|
|
|
69482
70511
|
hint3 = "Rate limited; retry later.";
|
|
69483
70512
|
else if (status !== undefined && status >= 500)
|
|
69484
70513
|
hint3 = `Server error; retry later.${request_id ? ` Request id: ${request_id}.` : ""}`;
|
|
69485
|
-
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 } : {} };
|
|
70514
|
+
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 } : {} };
|
|
69486
70515
|
}
|
|
69487
70516
|
|
|
69488
70517
|
// src/output/progress.ts
|
|
69489
|
-
function startProgress(ctx, write = (
|
|
70518
|
+
function startProgress(ctx, write = (text3) => writeOutput({ stderr: text3 })) {
|
|
69490
70519
|
if (ctx.mode !== "human" || !ctx.stderrIsTTY)
|
|
69491
70520
|
return () => {};
|
|
69492
70521
|
let interval;
|
|
@@ -69512,7 +70541,7 @@ function startProgress(ctx, write = (text2) => writeOutput({ stderr: text2 })) {
|
|
|
69512
70541
|
}
|
|
69513
70542
|
|
|
69514
70543
|
// src/main.ts
|
|
69515
|
-
var version = "0.3.0-dev.
|
|
70544
|
+
var version = "0.3.0-dev.3f4bbf9";
|
|
69516
70545
|
var commands = commandTree(operations);
|
|
69517
70546
|
var manual = [...workflows.map((w) => w.words), [API_WORD]];
|
|
69518
70547
|
function route(argv) {
|
|
@@ -69594,7 +70623,7 @@ var defaults = {
|
|
|
69594
70623
|
return;
|
|
69595
70624
|
const cmd = process.platform === "darwin" ? ["open", url] : process.platform === "win32" ? ["rundll32", "url.dll,FileProtocolHandler", url] : ["xdg-open", url];
|
|
69596
70625
|
await new Promise((resolve12, reject) => {
|
|
69597
|
-
const child =
|
|
70626
|
+
const child = spawn5(cmd[0], cmd.slice(1), { stdio: "ignore" });
|
|
69598
70627
|
child.once("error", reject);
|
|
69599
70628
|
child.once("close", () => resolve12());
|
|
69600
70629
|
});
|
|
@@ -69603,12 +70632,12 @@ var defaults = {
|
|
|
69603
70632
|
wait: (ms) => new Promise((resolve12) => setTimeout(resolve12, ms)),
|
|
69604
70633
|
render,
|
|
69605
70634
|
spawn: (cmd, args, options) => new Promise((resolve12, reject) => {
|
|
69606
|
-
const child =
|
|
70635
|
+
const child = spawn5(cmd, args, { cwd: options.cwd, stdio: ["ignore", 2, 2] });
|
|
69607
70636
|
child.once("error", reject);
|
|
69608
70637
|
child.once("close", (code) => resolve12(code ?? 1));
|
|
69609
70638
|
}),
|
|
69610
70639
|
spawnCapture: (cmd, args, options) => new Promise((resolve12, reject) => {
|
|
69611
|
-
const child =
|
|
70640
|
+
const child = spawn5(cmd, args, { cwd: options.cwd, stdio: ["ignore", "pipe", "pipe"] });
|
|
69612
70641
|
const chunks = [];
|
|
69613
70642
|
child.stdout.on("data", (c) => chunks.push(c));
|
|
69614
70643
|
child.stderr.on("data", (c) => chunks.push(c));
|
|
@@ -69667,7 +70696,7 @@ var appOptions = {
|
|
|
69667
70696
|
{ name: "case", type: "string", description: "Scenario title substring; the engine's `scenario` (case ids are a later slice)." },
|
|
69668
70697
|
{ name: "e2e", type: "boolean", description: "The large end-to-end tests; exactly --size large, so the two cannot be combined." },
|
|
69669
70698
|
{ name: "retries", type: "string", description: "Retries after a failing scenario (default: 0)." },
|
|
69670
|
-
{ name: "ctrf", type: "string", description: "Write the CTRF report here (default: <cwd>/.
|
|
70699
|
+
{ name: "ctrf", type: "string", description: "Write the CTRF report here (default: <cwd>/.praxis/ctrf/<run>.json)." }
|
|
69671
70700
|
],
|
|
69672
70701
|
"devops test report": [
|
|
69673
70702
|
{ name: "id", type: "string", description: "Show one run's detail instead of the recent list." },
|
|
@@ -69687,6 +70716,14 @@ var appOptions = {
|
|
|
69687
70716
|
"devops flag scaffold": [
|
|
69688
70717
|
{ name: "out", type: "string", description: "Directory the paired on/off scenario stubs are written to (default: the current directory)." }
|
|
69689
70718
|
],
|
|
70719
|
+
"devops flag refs": [
|
|
70720
|
+
{ name: "report", type: "boolean", description: "Post this checkout's scan to the platform, so archiving a flag is refused while code still names it (ADR-125 §4)." },
|
|
70721
|
+
{ name: "project", type: "string", description: "With --report: the DevOps project id (dvp_…) whose flags the scan is reported into. Required." }
|
|
70722
|
+
],
|
|
70723
|
+
"agent events wait": [
|
|
70724
|
+
{ name: "timeout", type: "string", description: "Give up after this many seconds, print that nothing arrived and exit 0 (default: wait until a letter arrives)." },
|
|
70725
|
+
{ 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)." }
|
|
70726
|
+
],
|
|
69690
70727
|
"canvas import": [
|
|
69691
70728
|
{ name: "name", type: "string", description: "Name for the new canvas (default: the file name without .pen)." },
|
|
69692
70729
|
{ 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." },
|
|
@@ -69701,17 +70738,19 @@ var appOptions = {
|
|
|
69701
70738
|
};
|
|
69702
70739
|
appOptions["devops engine deploy"] = appOptions["devops deploy"];
|
|
69703
70740
|
var workflowOptions = (words) => words[0] === "skill" ? [{ name: "install", type: "string" }] : appOptions[words.join(" ")] ?? [];
|
|
69704
|
-
function flagPortsFor(ports, context, emit) {
|
|
70741
|
+
function flagPortsFor(ports, context, emit, connect) {
|
|
69705
70742
|
return {
|
|
69706
70743
|
mode: context.mode,
|
|
69707
70744
|
emit,
|
|
69708
|
-
human: (
|
|
70745
|
+
human: (text3) => {
|
|
69709
70746
|
if (context.mode === "human")
|
|
69710
|
-
emit({ kind: "message", channel: "stdout", text:
|
|
70747
|
+
emit({ kind: "message", channel: "stdout", text: text3 });
|
|
69711
70748
|
},
|
|
69712
70749
|
cwd: ports.cwd,
|
|
69713
70750
|
readFile: ports.readFile,
|
|
69714
|
-
|
|
70751
|
+
git: async (args) => (await ports.spawnCapture("git", [...args], { cwd: ports.cwd })).output,
|
|
70752
|
+
client: connect,
|
|
70753
|
+
writeFile: (path, text3) => writeFile5(path, text3, "utf8"),
|
|
69715
70754
|
mkdir: async (path) => {
|
|
69716
70755
|
await mkdir4(path, { recursive: true });
|
|
69717
70756
|
},
|
|
@@ -69735,9 +70774,9 @@ function toolPortsFor(ports, context, emit) {
|
|
|
69735
70774
|
return {
|
|
69736
70775
|
mode: context.mode,
|
|
69737
70776
|
emit,
|
|
69738
|
-
human: (
|
|
70777
|
+
human: (text3) => {
|
|
69739
70778
|
if (context.mode === "human")
|
|
69740
|
-
emit({ kind: "message", channel: "stdout", text:
|
|
70779
|
+
emit({ kind: "message", channel: "stdout", text: text3 });
|
|
69741
70780
|
},
|
|
69742
70781
|
cwd: ports.cwd,
|
|
69743
70782
|
readFile: ports.readFile,
|
|
@@ -69752,7 +70791,7 @@ function toolPortsFor(ports, context, emit) {
|
|
|
69752
70791
|
},
|
|
69753
70792
|
git: (args, cwd) => ports.spawnCapture("git", args, { cwd }),
|
|
69754
70793
|
run: (cmd, args, cwd) => new Promise((resolve12, reject) => {
|
|
69755
|
-
const child =
|
|
70794
|
+
const child = spawn5(cmd, args, { cwd, stdio: "inherit" });
|
|
69756
70795
|
child.once("error", reject);
|
|
69757
70796
|
child.once("close", (code) => resolve12(code ?? 1));
|
|
69758
70797
|
}),
|
|
@@ -70047,9 +71086,9 @@ Examples:
|
|
|
70047
71086
|
},
|
|
70048
71087
|
mode: ctx.mode,
|
|
70049
71088
|
emit,
|
|
70050
|
-
human: (
|
|
71089
|
+
human: (text3) => {
|
|
70051
71090
|
if (ctx.mode === "human")
|
|
70052
|
-
emit({ kind: "message", channel: "stdout", text:
|
|
71091
|
+
emit({ kind: "message", channel: "stdout", text: text3 });
|
|
70053
71092
|
},
|
|
70054
71093
|
cwd: ports.cwd
|
|
70055
71094
|
});
|
|
@@ -70076,14 +71115,14 @@ Examples:
|
|
|
70076
71115
|
}, {
|
|
70077
71116
|
mode: ctx.mode,
|
|
70078
71117
|
emit,
|
|
70079
|
-
human: (
|
|
71118
|
+
human: (text3) => {
|
|
70080
71119
|
if (ctx.mode === "human")
|
|
70081
|
-
emit({ kind: "message", channel: "stdout", text:
|
|
71120
|
+
emit({ kind: "message", channel: "stdout", text: text3 });
|
|
70082
71121
|
},
|
|
70083
71122
|
engine: codeRefactorEngine(),
|
|
70084
71123
|
hasFile: (path2) => existsSync4(path2),
|
|
70085
71124
|
readFile: ports.readFile,
|
|
70086
|
-
writeFile: (path2,
|
|
71125
|
+
writeFile: (path2, text3) => writeFile5(path2, text3, "utf8"),
|
|
70087
71126
|
mkdir: async (path2) => {
|
|
70088
71127
|
await mkdir4(path2, { recursive: true });
|
|
70089
71128
|
},
|
|
@@ -70100,9 +71139,9 @@ Examples:
|
|
|
70100
71139
|
const shellPorts = {
|
|
70101
71140
|
mode: ctx.mode,
|
|
70102
71141
|
emit,
|
|
70103
|
-
human: (
|
|
71142
|
+
human: (text3) => {
|
|
70104
71143
|
if (ctx.mode === "human")
|
|
70105
|
-
emit({ kind: "message", channel: "stdout", text:
|
|
71144
|
+
emit({ kind: "message", channel: "stdout", text: text3 });
|
|
70106
71145
|
},
|
|
70107
71146
|
engine: await repositoryEngine(name, () => localEngine(ports.cwd)),
|
|
70108
71147
|
...localFilePorts(ports.cwd)
|
|
@@ -70115,9 +71154,9 @@ Examples:
|
|
|
70115
71154
|
const testPorts = {
|
|
70116
71155
|
mode: ctx.mode,
|
|
70117
71156
|
emit,
|
|
70118
|
-
human: (
|
|
71157
|
+
human: (text3) => {
|
|
70119
71158
|
if (ctx.mode === "human")
|
|
70120
|
-
emit({ kind: "message", channel: "stdout", text:
|
|
71159
|
+
emit({ kind: "message", channel: "stdout", text: text3 });
|
|
70121
71160
|
},
|
|
70122
71161
|
engine: await repositoryEngine(name, () => localEngine(ports.cwd)),
|
|
70123
71162
|
checkout: await localCheckout(ports.cwd, (cmd, args, options) => ports.spawnCapture(cmd, args, options))
|
|
@@ -70126,9 +71165,9 @@ Examples:
|
|
|
70126
71165
|
return await devopsTestReport({ path: parsed.positional[0], id: parsed.flags.id?.[0], upload: Boolean(parsed.flags.upload), project: parsed.flags.project?.[0] }, testPorts, {
|
|
70127
71166
|
mode: ctx.mode,
|
|
70128
71167
|
emit,
|
|
70129
|
-
human: (
|
|
71168
|
+
human: (text3) => {
|
|
70130
71169
|
if (ctx.mode === "human")
|
|
70131
|
-
emit({ kind: "message", channel: "stdout", text:
|
|
71170
|
+
emit({ kind: "message", channel: "stdout", text: text3 });
|
|
70132
71171
|
},
|
|
70133
71172
|
root: async () => await checkoutRoot(ports.cwd, ports.readFile),
|
|
70134
71173
|
readFile: ports.readFile,
|
|
@@ -70158,13 +71197,13 @@ Examples:
|
|
|
70158
71197
|
git: (args) => ports.spawnCapture("git", args, { cwd: ports.cwd }),
|
|
70159
71198
|
mode: ctx.mode,
|
|
70160
71199
|
emit,
|
|
70161
|
-
human: (
|
|
71200
|
+
human: (text3) => {
|
|
70162
71201
|
if (ctx.mode === "human")
|
|
70163
|
-
emit({ kind: "message", channel: "stdout", text:
|
|
71202
|
+
emit({ kind: "message", channel: "stdout", text: text3 });
|
|
70164
71203
|
}
|
|
70165
71204
|
});
|
|
70166
71205
|
}
|
|
70167
|
-
const flagPorts = flagPortsFor(ports, ctx, emit);
|
|
71206
|
+
const flagPorts = flagPortsFor(ports, ctx, emit, async () => await auth.client(org));
|
|
70168
71207
|
if (name === "devops flag sync")
|
|
70169
71208
|
return await devopsFlagSync({ check: Boolean(parsed.flags.check) }, flagPorts);
|
|
70170
71209
|
if (name === "devops flag check")
|
|
@@ -70172,7 +71211,7 @@ Examples:
|
|
|
70172
71211
|
if (name === "devops flag scaffold")
|
|
70173
71212
|
return await devopsFlagScaffold(parsed.positional[0], { out: parsed.flags.out?.[0] }, flagPorts);
|
|
70174
71213
|
if (name === "devops flag refs")
|
|
70175
|
-
return await devopsFlagRefs(parsed.positional[0], flagPorts);
|
|
71214
|
+
return await devopsFlagRefs(parsed.positional[0], { report: Boolean(parsed.flags.report), project: parsed.flags.project?.[0] }, flagPorts);
|
|
70176
71215
|
return await devopsFlagRemove(parsed.positional[0], flagPorts);
|
|
70177
71216
|
}
|
|
70178
71217
|
if (!quiet)
|
|
@@ -70210,9 +71249,9 @@ Examples:
|
|
|
70210
71249
|
emit({ kind: "object", data: await auth.switchOrganization(parsed.positional[0]) });
|
|
70211
71250
|
break;
|
|
70212
71251
|
case "app create": {
|
|
70213
|
-
const appPorts = { ...ports, mode: ctx.mode, emit, human: (
|
|
71252
|
+
const appPorts = { ...ports, mode: ctx.mode, emit, human: (text3) => {
|
|
70214
71253
|
if (ctx.mode === "human")
|
|
70215
|
-
emit({ kind: "message", channel: "stdout", text:
|
|
71254
|
+
emit({ kind: "message", channel: "stdout", text: text3 });
|
|
70216
71255
|
}, random: randomSecret };
|
|
70217
71256
|
await appCreate({ name: parsed.positional[0], dir: parsed.flags.dir?.[0], template: parsed.flags.template?.[0], install: !parsed.flags["no-install"] }, config.env, appPorts);
|
|
70218
71257
|
break;
|
|
@@ -70241,13 +71280,129 @@ Examples:
|
|
|
70241
71280
|
wait: ports.wait,
|
|
70242
71281
|
mode: ctx.mode,
|
|
70243
71282
|
emit,
|
|
70244
|
-
human: (
|
|
71283
|
+
human: (text3) => {
|
|
70245
71284
|
if (ctx.mode === "human")
|
|
70246
|
-
emit({ kind: "message", channel: "stdout", text:
|
|
71285
|
+
emit({ kind: "message", channel: "stdout", text: text3 });
|
|
70247
71286
|
},
|
|
70248
71287
|
cwd: ports.cwd
|
|
70249
71288
|
});
|
|
70250
71289
|
}
|
|
71290
|
+
case "agent events wait": {
|
|
71291
|
+
const agent = assumeAgentOf(ports.env);
|
|
71292
|
+
const timeoutMs = (() => {
|
|
71293
|
+
try {
|
|
71294
|
+
return timeoutMsOf(parsed.flags.timeout?.[0]);
|
|
71295
|
+
} catch (error) {
|
|
71296
|
+
throw new UsageError(error.message, "Example: praxis agent events wait --timeout 3600");
|
|
71297
|
+
}
|
|
71298
|
+
})();
|
|
71299
|
+
const headers = async () => {
|
|
71300
|
+
const credential = await auth.get(org);
|
|
71301
|
+
return { Authorization: `Bearer ${credential.token}`, ...credential.source === "api-key" ? { "X-API-Key": credential.token } : {} };
|
|
71302
|
+
};
|
|
71303
|
+
const failure2 = (status, body) => `HTTP ${status}${body?.error?.code ? ` ${body.error.code}` : ""}${body?.error?.message ? `: ${String(redact(body.error.message, secrets))}` : ""}`;
|
|
71304
|
+
const session = (() => {
|
|
71305
|
+
try {
|
|
71306
|
+
return sessionOf(parsed.flags.session?.[0]);
|
|
71307
|
+
} catch (error) {
|
|
71308
|
+
throw new UsageError(error.message, "Example: praxis agent events wait --session 0f6c…");
|
|
71309
|
+
}
|
|
71310
|
+
})();
|
|
71311
|
+
const key = waitKeyOf(config.env, agent, session);
|
|
71312
|
+
const waitDir = join12(ports.env.HOME || homedir3(), ".praxis", "cli", "events-wait");
|
|
71313
|
+
const statePath = join12(waitDir, `${key}.json`);
|
|
71314
|
+
const pidPath = join12(waitDir, `${key}.pid`);
|
|
71315
|
+
await mkdir4(waitDir, { recursive: true, mode: 448 });
|
|
71316
|
+
const holder = await acquireWaitLock({
|
|
71317
|
+
self: process.pid,
|
|
71318
|
+
readPid: () => readFile7(pidPath, "utf8").catch(() => null),
|
|
71319
|
+
createPid: (text3) => writeFile5(pidPath, text3, { mode: 384, flag: "wx" }).then(() => true, () => false),
|
|
71320
|
+
replacePid: (text3) => writeFile5(pidPath, text3, { mode: 384 }),
|
|
71321
|
+
probe: async (pid) => {
|
|
71322
|
+
try {
|
|
71323
|
+
process.kill(pid, 0);
|
|
71324
|
+
} catch (error) {
|
|
71325
|
+
if (error.code !== "EPERM")
|
|
71326
|
+
return { alive: false };
|
|
71327
|
+
}
|
|
71328
|
+
const ps = spawnSync("ps", ["-o", "ppid=,command=", "-p", String(pid)], { encoding: "utf8" });
|
|
71329
|
+
const line = ps.stdout?.trim() ?? "";
|
|
71330
|
+
const match = /^(\d+)\s+(.*)$/.exec(line);
|
|
71331
|
+
return match ? { alive: true, ppid: Number(match[1]), command: match[2] } : { alive: false };
|
|
71332
|
+
},
|
|
71333
|
+
terminate: (pid) => {
|
|
71334
|
+
try {
|
|
71335
|
+
process.kill(pid, "SIGTERM");
|
|
71336
|
+
} catch {}
|
|
71337
|
+
}
|
|
71338
|
+
});
|
|
71339
|
+
if (holder !== null) {
|
|
71340
|
+
process.stdout.write(alreadyWaitingNotice(holder) + `
|
|
71341
|
+
`);
|
|
71342
|
+
return 0;
|
|
71343
|
+
}
|
|
71344
|
+
const release = () => {
|
|
71345
|
+
try {
|
|
71346
|
+
if (pidOf(readFileSync3(pidPath, "utf8")) === process.pid)
|
|
71347
|
+
unlinkSync(pidPath);
|
|
71348
|
+
} catch {}
|
|
71349
|
+
};
|
|
71350
|
+
const onSignal = (signal) => {
|
|
71351
|
+
release();
|
|
71352
|
+
process.exit(signal === "SIGINT" ? 130 : 143);
|
|
71353
|
+
};
|
|
71354
|
+
for (const signal of ["SIGTERM", "SIGINT", "SIGHUP"])
|
|
71355
|
+
process.once(signal, onSignal);
|
|
71356
|
+
try {
|
|
71357
|
+
return await runEventsWait({
|
|
71358
|
+
agent,
|
|
71359
|
+
timeoutMs,
|
|
71360
|
+
fetchLetters: async () => {
|
|
71361
|
+
const response = await wireFetch(inboxLettersUrl(config.apiUrl, agent), { headers: await headers(), signal: AbortSignal.timeout(30000), redirect: "error" });
|
|
71362
|
+
const body = await response.json().catch(() => null);
|
|
71363
|
+
if (!response.ok)
|
|
71364
|
+
throw new Error(failure2(response.status, body));
|
|
71365
|
+
return lettersOf(body);
|
|
71366
|
+
},
|
|
71367
|
+
openStream: async (signal, lastEventId) => {
|
|
71368
|
+
const response = await wireFetch(eventsStreamUrl(config.apiUrl, agent), {
|
|
71369
|
+
headers: streamHeaders(await headers(), lastEventId),
|
|
71370
|
+
signal,
|
|
71371
|
+
redirect: "error"
|
|
71372
|
+
});
|
|
71373
|
+
if (!response.ok || !response.body) {
|
|
71374
|
+
const body = await response.json().catch(() => null);
|
|
71375
|
+
return { status: response.status, reason: failure2(response.status, body) };
|
|
71376
|
+
}
|
|
71377
|
+
return { status: response.status, chunks: response.body.pipeThrough(new TextDecoderStream) };
|
|
71378
|
+
},
|
|
71379
|
+
readState: async () => waitStateOf(await readFile7(statePath, "utf8").catch(() => null)),
|
|
71380
|
+
writeState: async (next) => {
|
|
71381
|
+
await mkdir4(dirname10(statePath), { recursive: true, mode: 448 });
|
|
71382
|
+
await writeFile5(statePath, waitStateText(next), { mode: 384 });
|
|
71383
|
+
},
|
|
71384
|
+
print: (line) => {
|
|
71385
|
+
process.stdout.write(line + `
|
|
71386
|
+
`);
|
|
71387
|
+
},
|
|
71388
|
+
log: (line) => {
|
|
71389
|
+
process.stderr.write(String(redact(line, secrets)) + `
|
|
71390
|
+
`);
|
|
71391
|
+
},
|
|
71392
|
+
sleep: (ms, signal) => new Promise((resolve12) => {
|
|
71393
|
+
const timer = setTimeout(resolve12, ms);
|
|
71394
|
+
signal.addEventListener("abort", () => {
|
|
71395
|
+
clearTimeout(timer);
|
|
71396
|
+
resolve12();
|
|
71397
|
+
}, { once: true });
|
|
71398
|
+
})
|
|
71399
|
+
});
|
|
71400
|
+
} finally {
|
|
71401
|
+
release();
|
|
71402
|
+
for (const signal of ["SIGTERM", "SIGINT", "SIGHUP"])
|
|
71403
|
+
process.removeListener(signal, onSignal);
|
|
71404
|
+
}
|
|
71405
|
+
}
|
|
70251
71406
|
case "canvas import": {
|
|
70252
71407
|
const authorize = async () => {
|
|
70253
71408
|
const credential = await auth.get(org);
|
|
@@ -70303,9 +71458,9 @@ Examples:
|
|
|
70303
71458
|
cwd: ports.cwd,
|
|
70304
71459
|
rpc,
|
|
70305
71460
|
upload,
|
|
70306
|
-
human: (
|
|
71461
|
+
human: (text3) => {
|
|
70307
71462
|
if (ctx.mode === "human")
|
|
70308
|
-
emit({ kind: "message", channel: "stdout", text:
|
|
71463
|
+
emit({ kind: "message", channel: "stdout", text: text3 });
|
|
70309
71464
|
}
|
|
70310
71465
|
});
|
|
70311
71466
|
}
|
|
@@ -70337,7 +71492,8 @@ if (true) {
|
|
|
70337
71492
|
process.exit(0);
|
|
70338
71493
|
throw error;
|
|
70339
71494
|
});
|
|
70340
|
-
|
|
71495
|
+
const argv = process.argv.slice(2);
|
|
71496
|
+
process.exitCode = isDevopsTestRun(route(argv).words) && needsCacheOffReexec(process.env) ? await reexecWithCacheOff() : await main3(argv);
|
|
70341
71497
|
}
|
|
70342
71498
|
export {
|
|
70343
71499
|
main3 as main
|