@deepraxis/cli 0.3.0-dev.bf2443c → 0.3.0-dev.c02df8c
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 +1279 -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 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. 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,7 @@ for more details.`
|
|
|
34762
34986
|
"openai.images.generations",
|
|
34763
34987
|
"openai.responses",
|
|
34764
34988
|
"openai.videos",
|
|
34989
|
+
"praxis.media.process",
|
|
34765
34990
|
"praxis.video.matting",
|
|
34766
34991
|
"typesafe.systemone",
|
|
34767
34992
|
"volcengine.music",
|
|
@@ -34827,6 +35052,42 @@ for more details.`
|
|
|
34827
35052
|
],
|
|
34828
35053
|
query: []
|
|
34829
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
|
+
},
|
|
34830
35091
|
{
|
|
34831
35092
|
resource: "model.ocr",
|
|
34832
35093
|
method: "create",
|
|
@@ -40401,6 +40662,129 @@ for more details.`
|
|
|
40401
40662
|
]
|
|
40402
40663
|
}
|
|
40403
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
|
+
],
|
|
40683
|
+
required: false,
|
|
40684
|
+
description: "Only shares of this object type; file is the only type that creates today."
|
|
40685
|
+
},
|
|
40686
|
+
{
|
|
40687
|
+
name: "resource_id",
|
|
40688
|
+
type: "string",
|
|
40689
|
+
required: false,
|
|
40690
|
+
description: "Only shares of the object with this id, for example a file id from the File API; combine with resource_type."
|
|
40691
|
+
},
|
|
40692
|
+
{
|
|
40693
|
+
name: "status",
|
|
40694
|
+
type: "string",
|
|
40695
|
+
enum: [
|
|
40696
|
+
"active",
|
|
40697
|
+
"expired",
|
|
40698
|
+
"revoked"
|
|
40699
|
+
],
|
|
40700
|
+
required: false,
|
|
40701
|
+
description: "Only shares in this state; omit to list every state."
|
|
40702
|
+
},
|
|
40703
|
+
{
|
|
40704
|
+
name: "page_size",
|
|
40705
|
+
type: "integer",
|
|
40706
|
+
required: false,
|
|
40707
|
+
description: "Maximum shares in one page, from 1 to 100; defaults to 50."
|
|
40708
|
+
},
|
|
40709
|
+
{
|
|
40710
|
+
name: "page_token",
|
|
40711
|
+
type: "string",
|
|
40712
|
+
required: false,
|
|
40713
|
+
description: "Opaque next_page_token from the preceding page with the same filters; omit on the first request."
|
|
40714
|
+
}
|
|
40715
|
+
]
|
|
40716
|
+
},
|
|
40717
|
+
{
|
|
40718
|
+
resource: "share.permissions",
|
|
40719
|
+
method: "create",
|
|
40720
|
+
summary: "Create share",
|
|
40721
|
+
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.",
|
|
40722
|
+
http: "POST",
|
|
40723
|
+
path: "/share/v1/permissions",
|
|
40724
|
+
streaming: "no",
|
|
40725
|
+
pagination: false,
|
|
40726
|
+
pathParams: [],
|
|
40727
|
+
query: [],
|
|
40728
|
+
body: {
|
|
40729
|
+
required: true,
|
|
40730
|
+
fields: [
|
|
40731
|
+
{
|
|
40732
|
+
name: "resource",
|
|
40733
|
+
type: "object",
|
|
40734
|
+
required: true,
|
|
40735
|
+
description: "The object a share exposes, named by a type and an id."
|
|
40736
|
+
},
|
|
40737
|
+
{
|
|
40738
|
+
name: "expire_time",
|
|
40739
|
+
type: "string",
|
|
40740
|
+
required: false,
|
|
40741
|
+
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."
|
|
40742
|
+
},
|
|
40743
|
+
{
|
|
40744
|
+
name: "prevents_download",
|
|
40745
|
+
type: "boolean",
|
|
40746
|
+
required: false,
|
|
40747
|
+
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."
|
|
40748
|
+
}
|
|
40749
|
+
]
|
|
40750
|
+
}
|
|
40751
|
+
},
|
|
40752
|
+
{
|
|
40753
|
+
resource: "share.permissions",
|
|
40754
|
+
method: "delete",
|
|
40755
|
+
summary: "Delete share",
|
|
40756
|
+
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.",
|
|
40757
|
+
http: "DELETE",
|
|
40758
|
+
path: "/share/v1/permissions/{id}",
|
|
40759
|
+
streaming: "no",
|
|
40760
|
+
pagination: false,
|
|
40761
|
+
pathParams: [
|
|
40762
|
+
{
|
|
40763
|
+
name: "id",
|
|
40764
|
+
sdkName: "id",
|
|
40765
|
+
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."
|
|
40766
|
+
}
|
|
40767
|
+
],
|
|
40768
|
+
query: []
|
|
40769
|
+
},
|
|
40770
|
+
{
|
|
40771
|
+
resource: "share.permissions",
|
|
40772
|
+
method: "retrieve",
|
|
40773
|
+
summary: "Retrieve share",
|
|
40774
|
+
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.",
|
|
40775
|
+
http: "GET",
|
|
40776
|
+
path: "/share/v1/permissions/{id}",
|
|
40777
|
+
streaming: "no",
|
|
40778
|
+
pagination: false,
|
|
40779
|
+
pathParams: [
|
|
40780
|
+
{
|
|
40781
|
+
name: "id",
|
|
40782
|
+
sdkName: "id",
|
|
40783
|
+
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."
|
|
40784
|
+
}
|
|
40785
|
+
],
|
|
40786
|
+
query: []
|
|
40787
|
+
},
|
|
40404
40788
|
{
|
|
40405
40789
|
resource: "studio.codexes",
|
|
40406
40790
|
method: "list",
|
|
@@ -46875,6 +47259,19 @@ var getAgentConsolidation = (options) => (options.client ?? client).get({
|
|
|
46875
47259
|
url: "/agent/v1/agents/{agent_id}/consolidations/{consolidation_id}",
|
|
46876
47260
|
...options
|
|
46877
47261
|
});
|
|
47262
|
+
var listAgentInboxLetters = (options) => (options.client ?? client).get({
|
|
47263
|
+
security: [{
|
|
47264
|
+
key: "BearerAuth",
|
|
47265
|
+
scheme: "bearer",
|
|
47266
|
+
type: "http"
|
|
47267
|
+
}, {
|
|
47268
|
+
key: "ApiKeyAuth",
|
|
47269
|
+
name: "X-API-Key",
|
|
47270
|
+
type: "apiKey"
|
|
47271
|
+
}],
|
|
47272
|
+
url: "/agent/v1/agents/{agent_id}/inbox/letters",
|
|
47273
|
+
...options
|
|
47274
|
+
});
|
|
46878
47275
|
var applyAgentVersion = (options) => (options.client ?? client).post({
|
|
46879
47276
|
security: [{
|
|
46880
47277
|
key: "BearerAuth",
|
|
@@ -47227,11 +47624,7 @@ var computersFilesConvert = (options) => (options.client ?? client).post({
|
|
|
47227
47624
|
type: "apiKey"
|
|
47228
47625
|
}],
|
|
47229
47626
|
url: "/agent/v1/computers/{computer_id}/files/convert",
|
|
47230
|
-
...options
|
|
47231
|
-
headers: {
|
|
47232
|
-
"Content-Type": "application/json",
|
|
47233
|
-
...options.headers
|
|
47234
|
-
}
|
|
47627
|
+
...options
|
|
47235
47628
|
});
|
|
47236
47629
|
var connectComputer = (options) => (options.client ?? client).post({
|
|
47237
47630
|
security: [{
|
|
@@ -47319,6 +47712,49 @@ var forkSession = (options) => (options.client ?? client).post({
|
|
|
47319
47712
|
...options.headers
|
|
47320
47713
|
}
|
|
47321
47714
|
});
|
|
47715
|
+
var listSessionArtifacts = (options) => (options.client ?? client).get({
|
|
47716
|
+
security: [{
|
|
47717
|
+
key: "BearerAuth",
|
|
47718
|
+
scheme: "bearer",
|
|
47719
|
+
type: "http"
|
|
47720
|
+
}, {
|
|
47721
|
+
key: "ApiKeyAuth",
|
|
47722
|
+
name: "X-API-Key",
|
|
47723
|
+
type: "apiKey"
|
|
47724
|
+
}],
|
|
47725
|
+
url: "/agent/v1/sessions/{session_id}/artifacts",
|
|
47726
|
+
...options
|
|
47727
|
+
});
|
|
47728
|
+
var createSessionArtifactContentUrl = (options) => (options.client ?? client).post({
|
|
47729
|
+
security: [{
|
|
47730
|
+
key: "BearerAuth",
|
|
47731
|
+
scheme: "bearer",
|
|
47732
|
+
type: "http"
|
|
47733
|
+
}, {
|
|
47734
|
+
key: "ApiKeyAuth",
|
|
47735
|
+
name: "X-API-Key",
|
|
47736
|
+
type: "apiKey"
|
|
47737
|
+
}],
|
|
47738
|
+
url: "/agent/v1/sessions/{session_id}/artifacts/{artifact_id}/content_url",
|
|
47739
|
+
...options,
|
|
47740
|
+
headers: {
|
|
47741
|
+
"Content-Type": "application/json",
|
|
47742
|
+
...options.headers
|
|
47743
|
+
}
|
|
47744
|
+
});
|
|
47745
|
+
var listSessionRequests = (options) => (options.client ?? client).get({
|
|
47746
|
+
security: [{
|
|
47747
|
+
key: "BearerAuth",
|
|
47748
|
+
scheme: "bearer",
|
|
47749
|
+
type: "http"
|
|
47750
|
+
}, {
|
|
47751
|
+
key: "ApiKeyAuth",
|
|
47752
|
+
name: "X-API-Key",
|
|
47753
|
+
type: "apiKey"
|
|
47754
|
+
}],
|
|
47755
|
+
url: "/agent/v1/sessions/{session_id}/requests",
|
|
47756
|
+
...options
|
|
47757
|
+
});
|
|
47322
47758
|
var listSessionBackgroundTasks = (options) => (options.client ?? client).get({
|
|
47323
47759
|
security: [{
|
|
47324
47760
|
key: "BearerAuth",
|
|
@@ -47964,6 +48400,45 @@ var createChatCompletion = (options) => (options.client ?? client).post({
|
|
|
47964
48400
|
...options.headers
|
|
47965
48401
|
}
|
|
47966
48402
|
});
|
|
48403
|
+
var disableModelAccess = (options) => (options.client ?? client).delete({
|
|
48404
|
+
security: [{
|
|
48405
|
+
key: "BearerAuth",
|
|
48406
|
+
scheme: "bearer",
|
|
48407
|
+
type: "http"
|
|
48408
|
+
}, {
|
|
48409
|
+
key: "ApiKeyAuth",
|
|
48410
|
+
name: "X-API-Key",
|
|
48411
|
+
type: "apiKey"
|
|
48412
|
+
}],
|
|
48413
|
+
url: "/model/v1/models/{model}/access",
|
|
48414
|
+
...options
|
|
48415
|
+
});
|
|
48416
|
+
var enableModelAccess = (options) => (options.client ?? client).put({
|
|
48417
|
+
security: [{
|
|
48418
|
+
key: "BearerAuth",
|
|
48419
|
+
scheme: "bearer",
|
|
48420
|
+
type: "http"
|
|
48421
|
+
}, {
|
|
48422
|
+
key: "ApiKeyAuth",
|
|
48423
|
+
name: "X-API-Key",
|
|
48424
|
+
type: "apiKey"
|
|
48425
|
+
}],
|
|
48426
|
+
url: "/model/v1/models/{model}/access",
|
|
48427
|
+
...options
|
|
48428
|
+
});
|
|
48429
|
+
var listModelAccess = (options) => (options?.client ?? client).get({
|
|
48430
|
+
security: [{
|
|
48431
|
+
key: "BearerAuth",
|
|
48432
|
+
scheme: "bearer",
|
|
48433
|
+
type: "http"
|
|
48434
|
+
}, {
|
|
48435
|
+
key: "ApiKeyAuth",
|
|
48436
|
+
name: "X-API-Key",
|
|
48437
|
+
type: "apiKey"
|
|
48438
|
+
}],
|
|
48439
|
+
url: "/model/v1/model-access",
|
|
48440
|
+
...options
|
|
48441
|
+
});
|
|
47967
48442
|
var getGeneration = (options) => (options.client ?? client).get({
|
|
47968
48443
|
security: [{
|
|
47969
48444
|
key: "BearerAuth",
|
|
@@ -53164,6 +53639,19 @@ var devopsFlagsCreate = (options) => (options.client ?? client).post({
|
|
|
53164
53639
|
...options.headers
|
|
53165
53640
|
}
|
|
53166
53641
|
});
|
|
53642
|
+
var devopsFlagsReportCodeRefs = (options) => (options.client ?? client).post({
|
|
53643
|
+
security: [{
|
|
53644
|
+
key: "devops-bearerAuth",
|
|
53645
|
+
scheme: "bearer",
|
|
53646
|
+
type: "http"
|
|
53647
|
+
}],
|
|
53648
|
+
url: "/devops/v1/projects/{project}/flags/code-refs",
|
|
53649
|
+
...options,
|
|
53650
|
+
headers: {
|
|
53651
|
+
"Content-Type": "application/json",
|
|
53652
|
+
...options.headers
|
|
53653
|
+
}
|
|
53654
|
+
});
|
|
53167
53655
|
var devopsFlagsGet = (options) => (options.client ?? client).get({
|
|
53168
53656
|
security: [{
|
|
53169
53657
|
key: "devops-bearerAuth",
|
|
@@ -54377,6 +54865,19 @@ var mediaGetGenerationCapabilities = (options) => (options?.client ?? client).ge
|
|
|
54377
54865
|
url: "/media/v1/generation/capabilities",
|
|
54378
54866
|
...options
|
|
54379
54867
|
});
|
|
54868
|
+
var mediaAlignAsset = (options) => (options.client ?? client).post({
|
|
54869
|
+
security: [{
|
|
54870
|
+
key: "media-BearerAuth",
|
|
54871
|
+
scheme: "bearer",
|
|
54872
|
+
type: "http"
|
|
54873
|
+
}],
|
|
54874
|
+
url: "/media/v1/libraries/{library_id}/assets/{asset_id}/align",
|
|
54875
|
+
...options,
|
|
54876
|
+
headers: {
|
|
54877
|
+
"Content-Type": "application/json",
|
|
54878
|
+
...options.headers
|
|
54879
|
+
}
|
|
54880
|
+
});
|
|
54380
54881
|
var ontologyListTypes = (options) => (options?.client ?? client).get({
|
|
54381
54882
|
security: [{
|
|
54382
54883
|
key: "ontology-bearerAuth",
|
|
@@ -55509,6 +56010,46 @@ var searchMap = (options) => (options.client ?? client).post({
|
|
|
55509
56010
|
...options.headers
|
|
55510
56011
|
}
|
|
55511
56012
|
});
|
|
56013
|
+
var shareListPermissions = (options) => (options?.client ?? client).get({
|
|
56014
|
+
security: [{
|
|
56015
|
+
key: "share-bearerAuth",
|
|
56016
|
+
scheme: "bearer",
|
|
56017
|
+
type: "http"
|
|
56018
|
+
}],
|
|
56019
|
+
url: "/share/v1/permissions",
|
|
56020
|
+
...options
|
|
56021
|
+
});
|
|
56022
|
+
var shareCreatePermission = (options) => (options.client ?? client).post({
|
|
56023
|
+
security: [{
|
|
56024
|
+
key: "share-bearerAuth",
|
|
56025
|
+
scheme: "bearer",
|
|
56026
|
+
type: "http"
|
|
56027
|
+
}],
|
|
56028
|
+
url: "/share/v1/permissions",
|
|
56029
|
+
...options,
|
|
56030
|
+
headers: {
|
|
56031
|
+
"Content-Type": "application/json",
|
|
56032
|
+
...options.headers
|
|
56033
|
+
}
|
|
56034
|
+
});
|
|
56035
|
+
var shareDeletePermission = (options) => (options.client ?? client).delete({
|
|
56036
|
+
security: [{
|
|
56037
|
+
key: "share-bearerAuth",
|
|
56038
|
+
scheme: "bearer",
|
|
56039
|
+
type: "http"
|
|
56040
|
+
}],
|
|
56041
|
+
url: "/share/v1/permissions/{id}",
|
|
56042
|
+
...options
|
|
56043
|
+
});
|
|
56044
|
+
var shareRetrievePermission = (options) => (options.client ?? client).get({
|
|
56045
|
+
security: [{
|
|
56046
|
+
key: "share-bearerAuth",
|
|
56047
|
+
scheme: "bearer",
|
|
56048
|
+
type: "http"
|
|
56049
|
+
}],
|
|
56050
|
+
url: "/share/v1/permissions/{id}",
|
|
56051
|
+
...options
|
|
56052
|
+
});
|
|
55512
56053
|
var studioGenresList = (options) => (options?.client ?? client).get({
|
|
55513
56054
|
security: [{
|
|
55514
56055
|
key: "BearerAuth",
|
|
@@ -57545,6 +58086,11 @@ function createAgent(transport) {
|
|
|
57545
58086
|
send: bind(transport, sendAgentEvents),
|
|
57546
58087
|
stream: bindStream(transport, streamAgentEvents)
|
|
57547
58088
|
},
|
|
58089
|
+
inbox: {
|
|
58090
|
+
letters: {
|
|
58091
|
+
list: bind(transport, listAgentInboxLetters)
|
|
58092
|
+
}
|
|
58093
|
+
},
|
|
57548
58094
|
list: bind(transport, agentsList),
|
|
57549
58095
|
retrieve: bind(transport, agentsRetrieve),
|
|
57550
58096
|
retrieveAppearance: bind(transport, getAgentAppearance),
|
|
@@ -57609,6 +58155,12 @@ function createAgent(transport) {
|
|
|
57609
58155
|
},
|
|
57610
58156
|
sessions: {
|
|
57611
58157
|
archive: bind(transport, sessionsArchive),
|
|
58158
|
+
artifacts: {
|
|
58159
|
+
contentUrl: {
|
|
58160
|
+
create: bind(transport, createSessionArtifactContentUrl)
|
|
58161
|
+
},
|
|
58162
|
+
list: bind(transport, listSessionArtifacts)
|
|
58163
|
+
},
|
|
57612
58164
|
backgroundTasks: {
|
|
57613
58165
|
list: bind(transport, listSessionBackgroundTasks),
|
|
57614
58166
|
retrieveOutput: bind(transport, getSessionBackgroundTaskOutput),
|
|
@@ -57627,6 +58179,9 @@ function createAgent(transport) {
|
|
|
57627
58179
|
},
|
|
57628
58180
|
fork: bind(transport, forkSession),
|
|
57629
58181
|
list: bind(transport, sessionsList),
|
|
58182
|
+
requests: {
|
|
58183
|
+
list: bind(transport, listSessionRequests)
|
|
58184
|
+
},
|
|
57630
58185
|
resources: {
|
|
57631
58186
|
create: bind(transport, sessionsResourcesAdd),
|
|
57632
58187
|
delete: bind(transport, aliasOperation(sessionsResourcesDelete, { query: { session_id: "query_session_id" } })),
|
|
@@ -58139,7 +58694,8 @@ function createDevops(transport) {
|
|
|
58139
58694
|
},
|
|
58140
58695
|
flags: {
|
|
58141
58696
|
create: bind(transport, devopsFlagsCreate),
|
|
58142
|
-
list: bind(transport, devopsFlagsList)
|
|
58697
|
+
list: bind(transport, devopsFlagsList),
|
|
58698
|
+
reportCodeRefs: bind(transport, devopsFlagsReportCodeRefs)
|
|
58143
58699
|
},
|
|
58144
58700
|
list: bind(transport, devopsProjectsList),
|
|
58145
58701
|
promotions: {
|
|
@@ -58343,6 +58899,9 @@ function createMedia(transport) {
|
|
|
58343
58899
|
},
|
|
58344
58900
|
libraries: {
|
|
58345
58901
|
assets: {
|
|
58902
|
+
align: {
|
|
58903
|
+
create: bind(transport, mediaAlignAsset)
|
|
58904
|
+
},
|
|
58346
58905
|
batch: bind(transport, mediaBatchAssets),
|
|
58347
58906
|
create: bind(transport, (options) => mediaUploadAsset({ ...options, bodySerializer: multipartBodySerializer, headers: { "Content-Type": null, ...options.headers } })),
|
|
58348
58907
|
delete: bind(transport, mediaDeleteAsset),
|
|
@@ -58484,7 +59043,14 @@ function createModel(transport) {
|
|
|
58484
59043
|
countTokens: bind(transport, countTokens),
|
|
58485
59044
|
create: bindMixed(transport, createMessage)
|
|
58486
59045
|
},
|
|
59046
|
+
modelAccess: {
|
|
59047
|
+
list: bind(transport, listModelAccess)
|
|
59048
|
+
},
|
|
58487
59049
|
models: {
|
|
59050
|
+
access: {
|
|
59051
|
+
delete: bind(transport, disableModelAccess),
|
|
59052
|
+
update: bind(transport, enableModelAccess)
|
|
59053
|
+
},
|
|
58488
59054
|
list: bind(transport, listModels),
|
|
58489
59055
|
retrieve: bind(transport, retrieveModel)
|
|
58490
59056
|
},
|
|
@@ -58777,6 +59343,16 @@ function createSearch(transport) {
|
|
|
58777
59343
|
}
|
|
58778
59344
|
};
|
|
58779
59345
|
}
|
|
59346
|
+
function createShare(transport) {
|
|
59347
|
+
return {
|
|
59348
|
+
permissions: {
|
|
59349
|
+
create: bind(transport, shareCreatePermission),
|
|
59350
|
+
delete: bind(transport, shareDeletePermission),
|
|
59351
|
+
list: bind(transport, shareListPermissions),
|
|
59352
|
+
retrieve: bind(transport, shareRetrievePermission)
|
|
59353
|
+
}
|
|
59354
|
+
};
|
|
59355
|
+
}
|
|
58780
59356
|
function createStudio(transport) {
|
|
58781
59357
|
return {
|
|
58782
59358
|
codexes: {
|
|
@@ -59047,6 +59623,7 @@ var resourceFactories = {
|
|
|
59047
59623
|
organization: createOrganization,
|
|
59048
59624
|
sandbox: createSandbox,
|
|
59049
59625
|
search: createSearch,
|
|
59626
|
+
share: createShare,
|
|
59050
59627
|
studio: createStudio,
|
|
59051
59628
|
ticket: createTicket,
|
|
59052
59629
|
vault: createVault
|
|
@@ -61234,7 +61811,7 @@ var workflows = [
|
|
|
61234
61811
|
],
|
|
61235
61812
|
group: "local",
|
|
61236
61813
|
network: "offline",
|
|
61237
|
-
platform: "the `@
|
|
61814
|
+
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).",
|
|
61238
61815
|
docs: "https://docs.deepraxis.com/docs/cli"
|
|
61239
61816
|
},
|
|
61240
61817
|
{
|
|
@@ -61323,30 +61900,31 @@ var workflows = [
|
|
|
61323
61900
|
{
|
|
61324
61901
|
words: ["devops", "flag", "refs"],
|
|
61325
61902
|
requires: "checkout",
|
|
61326
|
-
usage: "devops flag refs [key]",
|
|
61327
|
-
summary: "Where each flag key is referenced in this checkout: file and line, for every registered key or one named key.",
|
|
61328
|
-
example: "praxis devops flag refs",
|
|
61903
|
+
usage: "devops flag refs [key] [--report --project <dvp_…>]",
|
|
61904
|
+
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.",
|
|
61905
|
+
example: "praxis devops flag refs --report --project dvp_…",
|
|
61329
61906
|
examples: [
|
|
61330
61907
|
"praxis devops flag refs",
|
|
61331
|
-
"praxis devops flag refs run-page-v2"
|
|
61908
|
+
"praxis devops flag refs run-page-v2",
|
|
61909
|
+
"praxis devops flag refs --report --project dvp_…"
|
|
61332
61910
|
],
|
|
61333
61911
|
group: "local",
|
|
61334
|
-
network: "
|
|
61335
|
-
platform: "
|
|
61912
|
+
network: "Offline. --report: needs a login and sends this checkout's references to the platform",
|
|
61913
|
+
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).",
|
|
61336
61914
|
docs: "https://docs.deepraxis.com/docs/cli"
|
|
61337
61915
|
},
|
|
61338
61916
|
{
|
|
61339
61917
|
words: ["devops", "flag", "remove"],
|
|
61340
61918
|
requires: "checkout",
|
|
61341
61919
|
usage: "devops flag remove <key>",
|
|
61342
|
-
summary: "The local step of removing a flag: list the remaining references, or the steps that follow once none remain. Order:
|
|
61920
|
+
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.",
|
|
61343
61921
|
example: "praxis devops flag remove run-page-v2",
|
|
61344
61922
|
examples: [
|
|
61345
61923
|
"praxis devops flag remove run-page-v2"
|
|
61346
61924
|
],
|
|
61347
61925
|
group: "local",
|
|
61348
61926
|
network: "offline",
|
|
61349
|
-
platform: "praxis api devops flag archive — retires the flag on the platform after the code that named it is deployed away
|
|
61927
|
+
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).",
|
|
61350
61928
|
docs: "https://docs.deepraxis.com/docs/cli"
|
|
61351
61929
|
},
|
|
61352
61930
|
{
|
|
@@ -61363,6 +61941,13 @@ var workflows = [
|
|
|
61363
61941
|
platform: "praxis api devops project change create — the platform creates and names a Change; the CLI only lands its branch (ADR-125 §5).",
|
|
61364
61942
|
docs: "https://docs.deepraxis.com/docs/cli"
|
|
61365
61943
|
},
|
|
61944
|
+
{
|
|
61945
|
+
words: ["agent", "events", "wait"],
|
|
61946
|
+
usage: "agent events wait [--timeout <seconds>]",
|
|
61947
|
+
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.",
|
|
61948
|
+
example: "PRAXIS_ASSUME_AGENT=R1M9TQ2X praxis agent events wait",
|
|
61949
|
+
network: "online"
|
|
61950
|
+
},
|
|
61366
61951
|
{ 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"' },
|
|
61367
61952
|
{ words: ["skill"], usage: "skill [--install <dir>]", summary: "Print the AI skill, or write <dir>/praxis-cli/SKILL.md." },
|
|
61368
61953
|
{
|
|
@@ -62955,6 +63540,101 @@ function wranglerEdges(nodes) {
|
|
|
62955
63540
|
}
|
|
62956
63541
|
return edges;
|
|
62957
63542
|
}
|
|
63543
|
+
// ../../packages/praxis/deploy-core/src/lambda-function.ts
|
|
63544
|
+
var LAMBDA_FUNCTIONS_ROOT = "services/lambda/functions";
|
|
63545
|
+
var UPSTREAM = "aliyun-fc";
|
|
63546
|
+
var RECIPE_PATH = /^services\/lambda\/functions\/([^/]+)\/function\.json$/;
|
|
63547
|
+
var isText = (value) => typeof value === "string" && value !== "";
|
|
63548
|
+
var isCount = (value, min, max) => typeof value === "number" && Number.isInteger(value) && value >= min && value <= max;
|
|
63549
|
+
function lambdaFunctionOf(text) {
|
|
63550
|
+
const parsed = text === null ? null : parseJsonc2(text);
|
|
63551
|
+
if (parsed === null)
|
|
63552
|
+
return null;
|
|
63553
|
+
if (!isText(parsed.name) || !isText(parsed.upstream))
|
|
63554
|
+
return null;
|
|
63555
|
+
if (!Array.isArray(parsed.regions) || parsed.regions.length === 0 || !parsed.regions.every(isText))
|
|
63556
|
+
return null;
|
|
63557
|
+
if (parsed.gpu !== undefined && !isText(parsed.gpu))
|
|
63558
|
+
return null;
|
|
63559
|
+
if (!isCount(parsed.cpu, 1, 256))
|
|
63560
|
+
return null;
|
|
63561
|
+
if (!isCount(parsed.memoryMb, 128, 32 * 1024))
|
|
63562
|
+
return null;
|
|
63563
|
+
if (!isCount(parsed.timeoutSeconds, 1, 24 * 3600))
|
|
63564
|
+
return null;
|
|
63565
|
+
if (!isCount(parsed.concurrency, 1, 1024))
|
|
63566
|
+
return null;
|
|
63567
|
+
return {
|
|
63568
|
+
name: parsed.name,
|
|
63569
|
+
upstream: parsed.upstream,
|
|
63570
|
+
regions: [...parsed.regions],
|
|
63571
|
+
...parsed.gpu === undefined ? {} : { gpu: parsed.gpu },
|
|
63572
|
+
cpu: parsed.cpu,
|
|
63573
|
+
memoryMb: parsed.memoryMb,
|
|
63574
|
+
timeoutSeconds: parsed.timeoutSeconds,
|
|
63575
|
+
concurrency: parsed.concurrency
|
|
63576
|
+
};
|
|
63577
|
+
}
|
|
63578
|
+
function lambdaFunctionTarget(recipe) {
|
|
63579
|
+
return { path: `${LAMBDA_FUNCTIONS_ROOT}/${recipe.name}`, name: `lambda-${recipe.name}` };
|
|
63580
|
+
}
|
|
63581
|
+
function lambdaFunctionOwner(path) {
|
|
63582
|
+
return path.split("/").slice(0, -2).join("/");
|
|
63583
|
+
}
|
|
63584
|
+
async function scanRecipes(facts) {
|
|
63585
|
+
const found = [];
|
|
63586
|
+
const warnings = [];
|
|
63587
|
+
for (const path of [...facts.tree].sort()) {
|
|
63588
|
+
const match = RECIPE_PATH.exec(path);
|
|
63589
|
+
if (match === null)
|
|
63590
|
+
continue;
|
|
63591
|
+
const dir = path.slice(0, -"/function.json".length);
|
|
63592
|
+
const recipe = lambdaFunctionOf(await facts.read(path));
|
|
63593
|
+
if (recipe === null) {
|
|
63594
|
+
warnings.push(`${dir}: function.json is not a recipe`);
|
|
63595
|
+
continue;
|
|
63596
|
+
}
|
|
63597
|
+
if (recipe.upstream !== UPSTREAM)
|
|
63598
|
+
continue;
|
|
63599
|
+
if (recipe.name !== match[1]) {
|
|
63600
|
+
warnings.push(`${dir}: function.json names ${JSON.stringify(recipe.name)}, not the directory name`);
|
|
63601
|
+
continue;
|
|
63602
|
+
}
|
|
63603
|
+
found.push(recipe);
|
|
63604
|
+
}
|
|
63605
|
+
return { found, warnings };
|
|
63606
|
+
}
|
|
63607
|
+
function lambdaFunctionProvider(_options = {}) {
|
|
63608
|
+
return {
|
|
63609
|
+
id: "lambda-function",
|
|
63610
|
+
async detect(facts) {
|
|
63611
|
+
return (await scanRecipes(facts)).found.length > 0 ? "certain" : "none";
|
|
63612
|
+
},
|
|
63613
|
+
async plan(facts, partial) {
|
|
63614
|
+
const claimed = new Set(partial.targets.map((target) => target.path));
|
|
63615
|
+
const scan = await scanRecipes(facts);
|
|
63616
|
+
const targets = [];
|
|
63617
|
+
const byOwner = new Map;
|
|
63618
|
+
for (const recipe of scan.found) {
|
|
63619
|
+
const { path, name } = lambdaFunctionTarget(recipe);
|
|
63620
|
+
if (claimed.has(path))
|
|
63621
|
+
continue;
|
|
63622
|
+
targets.push({ path, name, destination: "aliyun-fc", production: true, onTrain: true });
|
|
63623
|
+
const owner = lambdaFunctionOwner(path);
|
|
63624
|
+
byOwner.set(owner, [...byOwner.get(owner) ?? [], path]);
|
|
63625
|
+
}
|
|
63626
|
+
const refined = partial.targets.map((target) => {
|
|
63627
|
+
const paths = byOwner.get(target.path);
|
|
63628
|
+
return paths === undefined ? target : { ...target, dependsOn: [...new Set([...target.dependsOn ?? [], ...paths])] };
|
|
63629
|
+
});
|
|
63630
|
+
return {
|
|
63631
|
+
targets: [...refined, ...targets],
|
|
63632
|
+
...scan.warnings.length === 0 ? {} : { warnings: [...partial.warnings ?? [], ...scan.warnings] }
|
|
63633
|
+
};
|
|
63634
|
+
}
|
|
63635
|
+
};
|
|
63636
|
+
}
|
|
63637
|
+
var lambdaFunction = lambdaFunctionProvider();
|
|
62958
63638
|
// ../../packages/praxis/deploy-core/src/package-manifest.ts
|
|
62959
63639
|
function packageManifestOf(text) {
|
|
62960
63640
|
const parsed = text === null ? null : parseJsonc2(text);
|
|
@@ -63112,13 +63792,21 @@ function matchesPattern(pattern, path) {
|
|
|
63112
63792
|
}
|
|
63113
63793
|
async function workspaceIndexOf(facts, options = {}) {
|
|
63114
63794
|
const tree = new Set(facts.tree);
|
|
63115
|
-
|
|
63795
|
+
return workspaceIndexOfSync({
|
|
63796
|
+
tree: facts.tree,
|
|
63116
63797
|
packageJson: tree.has("package.json") ? await facts.read("package.json") : null,
|
|
63117
63798
|
pnpmWorkspace: tree.has("pnpm-workspace.yaml") ? await facts.read("pnpm-workspace.yaml") : null
|
|
63799
|
+
}, options);
|
|
63800
|
+
}
|
|
63801
|
+
function workspaceIndexOfSync(input, options = {}) {
|
|
63802
|
+
const tree = new Set(input.tree);
|
|
63803
|
+
const declared = workspacePatternsOf({
|
|
63804
|
+
packageJson: input.packageJson,
|
|
63805
|
+
pnpmWorkspace: input.pnpmWorkspace
|
|
63118
63806
|
});
|
|
63119
63807
|
const patterns = declared.length > 0 ? declared : options.defaultPatterns ?? [];
|
|
63120
63808
|
const candidates2 = new Set;
|
|
63121
|
-
for (const path of
|
|
63809
|
+
for (const path of input.tree) {
|
|
63122
63810
|
const dir = dirOfPackageJson(path) ?? dirOfManifest(path);
|
|
63123
63811
|
if (dir === undefined || dir === ".")
|
|
63124
63812
|
continue;
|
|
@@ -63281,7 +63969,11 @@ function workspaceCloudflareProvider(options = {}) {
|
|
|
63281
63969
|
};
|
|
63282
63970
|
}
|
|
63283
63971
|
var workspaceCloudflare = workspaceCloudflareProvider();
|
|
63284
|
-
var BUILTIN_PROVIDERS = [
|
|
63972
|
+
var BUILTIN_PROVIDERS = [
|
|
63973
|
+
workspaceCloudflare,
|
|
63974
|
+
workspaceNpmProvider(),
|
|
63975
|
+
lambdaFunctionProvider()
|
|
63976
|
+
];
|
|
63285
63977
|
function directoriesOfPackageNames(workspaces) {
|
|
63286
63978
|
const byName = new Map;
|
|
63287
63979
|
for (const workspace of workspaces)
|
|
@@ -63308,15 +64000,23 @@ function workspaceClosureOf(target, byName, dependenciesOf) {
|
|
|
63308
64000
|
// ../../packages/praxis/deploy-core/src/plan.ts
|
|
63309
64001
|
async function planRepository(facts, providers = BUILTIN_PROVIDERS, options = {}) {
|
|
63310
64002
|
let partial = { targets: [] };
|
|
64003
|
+
const warnings = [];
|
|
63311
64004
|
for (const provider of providers) {
|
|
63312
64005
|
const confidence = await provider.detect(facts);
|
|
63313
64006
|
if (confidence === "none")
|
|
63314
64007
|
continue;
|
|
63315
64008
|
partial = await provider.plan(facts, partial);
|
|
64009
|
+
for (const warning of partial.warnings ?? [])
|
|
64010
|
+
if (!warnings.includes(warning))
|
|
64011
|
+
warnings.push(warning);
|
|
63316
64012
|
}
|
|
63317
64013
|
const drafts = partial.targets.filter((draft) => draft.deploy !== false);
|
|
63318
64014
|
const workspaces = await readWorkspaces(facts, options);
|
|
63319
|
-
return {
|
|
64015
|
+
return {
|
|
64016
|
+
commit: facts.commit,
|
|
64017
|
+
targets: closePlan(drafts, workspaces),
|
|
64018
|
+
...warnings.length === 0 ? {} : { warnings }
|
|
64019
|
+
};
|
|
63320
64020
|
}
|
|
63321
64021
|
function closePlan(drafts, workspaces) {
|
|
63322
64022
|
const configOf = new Map(workspaces.map((workspace) => [workspace.dir, workspace.config]));
|
|
@@ -63338,7 +64038,7 @@ function closePlan(drafts, workspaces) {
|
|
|
63338
64038
|
path: draft.path,
|
|
63339
64039
|
name: draft.name,
|
|
63340
64040
|
destination: draft.destination,
|
|
63341
|
-
dependsOn: edges.get(draft.path) ?? [],
|
|
64041
|
+
dependsOn: [...new Set([...edges.get(draft.path) ?? [], ...draft.dependsOn ?? []])],
|
|
63342
64042
|
...draft.environments === undefined ? {} : { environments: draft.environments },
|
|
63343
64043
|
production: draft.production === true,
|
|
63344
64044
|
onTrain: draft.onTrain !== false,
|
|
@@ -63347,10 +64047,10 @@ function closePlan(drafts, workspaces) {
|
|
|
63347
64047
|
}
|
|
63348
64048
|
function isDeployToolDependency(name, path) {
|
|
63349
64049
|
const directory = path.replace(/^(\.\/)+/, "").replace(/^\/+/, "").replace(/\/+$/, "");
|
|
63350
|
-
|
|
63351
|
-
|
|
63352
|
-
|
|
63353
|
-
|
|
64050
|
+
for (const root of ["packages/mise", "packages/devops", "packages/testing", "packages/bdd"]) {
|
|
64051
|
+
if (directory === root || directory.startsWith(`${root}/`))
|
|
64052
|
+
return true;
|
|
64053
|
+
}
|
|
63354
64054
|
return name.startsWith("@mise/");
|
|
63355
64055
|
}
|
|
63356
64056
|
function targetsFor(plan, environment2) {
|
|
@@ -65099,7 +65799,7 @@ function planTest(flags, paths) {
|
|
|
65099
65799
|
}
|
|
65100
65800
|
function requireSingleCtrfTarget(targets) {
|
|
65101
65801
|
if (targets > 1)
|
|
65102
|
-
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 .
|
|
65802
|
+
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.");
|
|
65103
65803
|
}
|
|
65104
65804
|
var FAILURE_LIMIT2 = 20;
|
|
65105
65805
|
var member3 = (value, key) => typeof value === "object" && value !== null ? value[key] : undefined;
|
|
@@ -65334,6 +66034,30 @@ function bunTestRun(packagePath, code, output) {
|
|
|
65334
66034
|
}
|
|
65335
66035
|
|
|
65336
66036
|
// src/commands/devops-test.ts
|
|
66037
|
+
import { spawn as spawn4 } from "node:child_process";
|
|
66038
|
+
var CACHE_OFF_REEXEC_ENV = "PRAXIS_DEVOPS_TEST_CACHE_OFF";
|
|
66039
|
+
function needsCacheOffReexec(env) {
|
|
66040
|
+
return env.BUN_RUNTIME_TRANSPILER_CACHE_PATH !== "0" && !env[CACHE_OFF_REEXEC_ENV];
|
|
66041
|
+
}
|
|
66042
|
+
function isDevopsTestRun(words) {
|
|
66043
|
+
return words.join(" ") === "devops test";
|
|
66044
|
+
}
|
|
66045
|
+
function spawnInherit(cmd, args, options) {
|
|
66046
|
+
return new Promise((resolveCode) => {
|
|
66047
|
+
const child = spawn4(cmd, [...args], { cwd: options.cwd, env: options.env, stdio: "inherit" });
|
|
66048
|
+
child.once("error", (error) => {
|
|
66049
|
+
console.error(error instanceof Error ? error.message : String(error));
|
|
66050
|
+
resolveCode(1);
|
|
66051
|
+
});
|
|
66052
|
+
child.once("close", (code) => resolveCode(code ?? 1));
|
|
66053
|
+
});
|
|
66054
|
+
}
|
|
66055
|
+
function reexecWithCacheOff(options = {}) {
|
|
66056
|
+
return (options.spawn ?? spawnInherit)(process.execPath, options.argv ?? process.argv.slice(1), {
|
|
66057
|
+
cwd: options.cwd ?? process.cwd(),
|
|
66058
|
+
env: { ...options.env ?? process.env, BUN_RUNTIME_TRANSPILER_CACHE_PATH: "0", [CACHE_OFF_REEXEC_ENV]: "1" }
|
|
66059
|
+
});
|
|
66060
|
+
}
|
|
65337
66061
|
async function devopsTest(flags, paths, ports) {
|
|
65338
66062
|
const plan = planTest(flags, paths);
|
|
65339
66063
|
if (plan.mode.kind === "affected")
|
|
@@ -65458,7 +66182,7 @@ async function devopsTestReportUpload(args, ports) {
|
|
|
65458
66182
|
if (id === undefined || id === "")
|
|
65459
66183
|
throw new UsageError("--upload needs --id", "Run `praxis devops test report` first to list this machine's runs, then pass one with --id.");
|
|
65460
66184
|
const root = await ports.root();
|
|
65461
|
-
const file = join6(root, ".
|
|
66185
|
+
const file = join6(root, ".praxis", "ctrf", `${id}.json`);
|
|
65462
66186
|
let report;
|
|
65463
66187
|
try {
|
|
65464
66188
|
report = await ports.readFile(file);
|
|
@@ -65534,8 +66258,8 @@ async function devopsTestInspect(args, ports) {
|
|
|
65534
66258
|
return 0;
|
|
65535
66259
|
}
|
|
65536
66260
|
async function localEngine(cwd) {
|
|
65537
|
-
const { testCommand } = await import("@
|
|
65538
|
-
const { mise } = await import("@
|
|
66261
|
+
const { testCommand } = await import("@deepractice-ai/devops-test-engine/test-command");
|
|
66262
|
+
const { mise } = await import("@deepractice-ai/devops-test-engine");
|
|
65539
66263
|
const { createLocalPlatform } = await import("@deepractice-ai/bdd-local");
|
|
65540
66264
|
const { _scanPackages } = await import("@deepractice-ai/bdd-service/shared/bdd-config");
|
|
65541
66265
|
const platform = createLocalPlatform({ cwd });
|
|
@@ -65604,8 +66328,8 @@ async function localEngine(cwd) {
|
|
|
65604
66328
|
})
|
|
65605
66329
|
};
|
|
65606
66330
|
}
|
|
65607
|
-
async function localCheckout(cwd,
|
|
65608
|
-
const git2 = (args) =>
|
|
66331
|
+
async function localCheckout(cwd, spawn5) {
|
|
66332
|
+
const git2 = (args) => spawn5("git", [...args], { cwd });
|
|
65609
66333
|
const required = async (args) => {
|
|
65610
66334
|
const result = await git2(args);
|
|
65611
66335
|
if (result.code !== 0)
|
|
@@ -65641,7 +66365,7 @@ async function localCheckout(cwd, spawn4) {
|
|
|
65641
66365
|
const files = new Map;
|
|
65642
66366
|
const walk = async (dir) => {
|
|
65643
66367
|
for (const entry of await readdir2(dir, { withFileTypes: true })) {
|
|
65644
|
-
if (["node_modules", ".git", "dist", ".
|
|
66368
|
+
if (["node_modules", ".git", "dist", ".praxis"].includes(entry.name))
|
|
65645
66369
|
continue;
|
|
65646
66370
|
const full = join6(dir, entry.name);
|
|
65647
66371
|
if (entry.isDirectory()) {
|
|
@@ -65656,7 +66380,7 @@ async function localCheckout(cwd, spawn4) {
|
|
|
65656
66380
|
await walk(packagePath);
|
|
65657
66381
|
return files;
|
|
65658
66382
|
},
|
|
65659
|
-
runTests: (packagePath, files) =>
|
|
66383
|
+
runTests: (packagePath, files) => spawn5("nice", ["-n", "10", "bun", "test", ...files], { cwd: packagePath })
|
|
65660
66384
|
};
|
|
65661
66385
|
}
|
|
65662
66386
|
async function withEngineStdoutOnStderr(body) {
|
|
@@ -65693,7 +66417,7 @@ async function runEngineCall(call, ports) {
|
|
|
65693
66417
|
return exitCode;
|
|
65694
66418
|
}
|
|
65695
66419
|
async function miseEngine(cwd) {
|
|
65696
|
-
const { mise } = await import("@
|
|
66420
|
+
const { mise } = await import("@deepractice-ai/devops-test-engine");
|
|
65697
66421
|
const { createLocalPlatform } = await import("@deepractice-ai/bdd-local");
|
|
65698
66422
|
const platform = createLocalPlatform({ cwd });
|
|
65699
66423
|
return {
|
|
@@ -65833,7 +66557,7 @@ function removalSteps(key) {
|
|
|
65833
66557
|
`No code references ${key}. The rest is not this command's to do:`,
|
|
65834
66558
|
` 1. Deploy the code that removed the references (deploy never writes the trunk).`,
|
|
65835
66559
|
` 2. Retire the flag on the platform: praxis api devops flag archive <flg_…> — the terminal state.`,
|
|
65836
|
-
` Archiving keeps the key reserved and
|
|
66560
|
+
` 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).`,
|
|
65837
66561
|
` 3. Regenerate the registry: praxis devops flag sync`
|
|
65838
66562
|
].join(`
|
|
65839
66563
|
`);
|
|
@@ -65863,6 +66587,25 @@ async function repositoryRoot(cwd, read) {
|
|
|
65863
66587
|
dir = parent;
|
|
65864
66588
|
}
|
|
65865
66589
|
}
|
|
66590
|
+
var SNIPPET_LIMIT = 200;
|
|
66591
|
+
function snippetOf(text2, line) {
|
|
66592
|
+
const trimmed = (text2.split(`
|
|
66593
|
+
`)[line - 1] ?? "").trim();
|
|
66594
|
+
return trimmed.length > SNIPPET_LIMIT ? trimmed.slice(0, SNIPPET_LIMIT) : trimmed;
|
|
66595
|
+
}
|
|
66596
|
+
function reportedKeys(keys, sources, refs) {
|
|
66597
|
+
const texts = new Map(sources.map((file) => [file.path, file.text]));
|
|
66598
|
+
return keys.map((flagKey) => ({
|
|
66599
|
+
flagKey,
|
|
66600
|
+
items: refs.filter((ref) => ref.key === flagKey).map((ref) => ({ path: ref.file, line: ref.line, snippet: snippetOf(texts.get(ref.file) ?? "", ref.line) }))
|
|
66601
|
+
}));
|
|
66602
|
+
}
|
|
66603
|
+
function reportNeedsProject() {
|
|
66604
|
+
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.");
|
|
66605
|
+
}
|
|
66606
|
+
function reportClientMissing() {
|
|
66607
|
+
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.");
|
|
66608
|
+
}
|
|
65866
66609
|
async function codeSources(ports, registry) {
|
|
65867
66610
|
const suffix = registry.replace(/^\.\//, "");
|
|
65868
66611
|
return (await ports.sources()).filter((file) => !file.path.replace(/^\.\//, "").endsWith(suffix));
|
|
@@ -65919,15 +66662,33 @@ async function devopsFlagScaffold(key, args, ports) {
|
|
|
65919
66662
|
ports.emit({ kind: "object", data: { key, registry, file, call: scaffoldCall(key) } });
|
|
65920
66663
|
return 0;
|
|
65921
66664
|
}
|
|
65922
|
-
async function devopsFlagRefs(key, ports) {
|
|
66665
|
+
async function devopsFlagRefs(key, args, ports) {
|
|
65923
66666
|
const registry = await registryOf(ports);
|
|
65924
66667
|
const flags = await ports.loadRegistry(registry);
|
|
65925
66668
|
const keys = key !== undefined ? [key] : Object.keys(flags).sort();
|
|
65926
|
-
const
|
|
66669
|
+
const sources = await codeSources(ports, registry);
|
|
66670
|
+
const refs = flagReferences(sources, keys);
|
|
65927
66671
|
for (const ref of refs)
|
|
65928
66672
|
ports.human(`${ref.file}:${ref.line}: ${ref.key}`);
|
|
65929
66673
|
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.`);
|
|
65930
|
-
|
|
66674
|
+
if (!args.report) {
|
|
66675
|
+
ports.emit({ kind: "object", data: { refs, reported: false } });
|
|
66676
|
+
return 0;
|
|
66677
|
+
}
|
|
66678
|
+
const project = args.project;
|
|
66679
|
+
if (project === undefined || project === "")
|
|
66680
|
+
throw reportNeedsProject();
|
|
66681
|
+
const scannedCommit = (await ports.git(["rev-parse", "HEAD"])).trim();
|
|
66682
|
+
if (scannedCommit === "")
|
|
66683
|
+
throw new UsageError("git rev-parse HEAD answered no commit", "Run this command inside a git repository.");
|
|
66684
|
+
const payload = reportedKeys(Object.keys(flags).sort(), sources, refs);
|
|
66685
|
+
const client2 = await ports.client();
|
|
66686
|
+
const report = client2.devops?.projects?.flags?.reportCodeRefs;
|
|
66687
|
+
if (typeof report !== "function")
|
|
66688
|
+
throw reportClientMissing();
|
|
66689
|
+
const answer = await report.call(client2.devops.projects.flags, { path: { project }, body: { scannedCommit, refs: payload } });
|
|
66690
|
+
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(", ")}` : ""}.`);
|
|
66691
|
+
ports.emit({ kind: "object", data: { refs, reported: true, project, scannedCommit, updated: answer.updated, unknownKeys: answer.unknownKeys } });
|
|
65931
66692
|
return 0;
|
|
65932
66693
|
}
|
|
65933
66694
|
async function devopsFlagRemove(key, ports) {
|
|
@@ -66167,9 +66928,9 @@ function refactorRoot(fileRelToCheckout, hasTsconfig) {
|
|
|
66167
66928
|
// src/commands/devops-refactor.ts
|
|
66168
66929
|
function codeRefactorEngine() {
|
|
66169
66930
|
return {
|
|
66170
|
-
rename: async (input) => (await repositoryEngine("devops refactor rename", () => import("@
|
|
66171
|
-
check: async (input) => (await repositoryEngine("devops refactor check", () => import("@
|
|
66172
|
-
apply: async (input) => (await repositoryEngine("devops refactor apply", () => import("@
|
|
66931
|
+
rename: async (input) => (await repositoryEngine("devops refactor rename", () => import("@deepractice-ai/devops-refactor/rename"))).planSemanticRename(input),
|
|
66932
|
+
check: async (input) => (await repositoryEngine("devops refactor check", () => import("@deepractice-ai/devops-refactor/rename"))).inspectRenamePlan(input),
|
|
66933
|
+
apply: async (input) => (await repositoryEngine("devops refactor apply", () => import("@deepractice-ai/devops-refactor/rename"))).applyRenamePlan(input)
|
|
66173
66934
|
};
|
|
66174
66935
|
}
|
|
66175
66936
|
function required(value, argument, use) {
|
|
@@ -68577,6 +69338,7 @@ var FILE_ID = /^file-/;
|
|
|
68577
69338
|
var asRecord = (value) => value !== null && typeof value === "object" && !Array.isArray(value) ? value : undefined;
|
|
68578
69339
|
var isImage = (node2) => node2.type === "image" && typeof node2.url === "string";
|
|
68579
69340
|
var isRef = (node2) => node2.type === "ref" && typeof node2.ref === "string";
|
|
69341
|
+
var NODE_TYPES = new Set(Object.keys(KNOWN_PROPS));
|
|
68580
69342
|
function visit2(value, nodeId, fn) {
|
|
68581
69343
|
if (Array.isArray(value)) {
|
|
68582
69344
|
for (const item of value)
|
|
@@ -68770,6 +69532,8 @@ var warningLine = (warning) => {
|
|
|
68770
69532
|
return `${warning.code}: ${warning.ref} at ${warning.nodeId}`;
|
|
68771
69533
|
case "FRAME_NOT_FOUND":
|
|
68772
69534
|
return `${warning.code}: ${warning.id}`;
|
|
69535
|
+
case "IMAGE_FILE_NOT_FOUND":
|
|
69536
|
+
return `${warning.code}: ${warning.url} (the platform holds no such file) at ${warning.nodeId}`;
|
|
68773
69537
|
default:
|
|
68774
69538
|
return `${warning.code}: ${warning.url}`;
|
|
68775
69539
|
}
|
|
@@ -68877,6 +69641,268 @@ async function canvasImport(args, ports) {
|
|
|
68877
69641
|
return 0;
|
|
68878
69642
|
}
|
|
68879
69643
|
|
|
69644
|
+
// src/commands/events-wait.ts
|
|
69645
|
+
var DEFAULT_AGENT = "R1M9TQ2X";
|
|
69646
|
+
var BASE_BACKOFF_MS = 1000;
|
|
69647
|
+
var MAX_BACKOFF_MS = 60000;
|
|
69648
|
+
var NOTICE_NAMED = 5;
|
|
69649
|
+
var ANNOUNCED_KEEP = 500;
|
|
69650
|
+
function assumeAgentOf(env) {
|
|
69651
|
+
return env.PRAXIS_ASSUME_AGENT?.trim() || DEFAULT_AGENT;
|
|
69652
|
+
}
|
|
69653
|
+
function sessionOf(raw) {
|
|
69654
|
+
if (raw === undefined)
|
|
69655
|
+
return null;
|
|
69656
|
+
const session = raw.trim();
|
|
69657
|
+
if (!/^[A-Za-z0-9_-]{1,128}$/.test(session))
|
|
69658
|
+
throw new Error("--session takes the Claude Code session id (letters, digits, - and _)");
|
|
69659
|
+
return session;
|
|
69660
|
+
}
|
|
69661
|
+
var keyPart = (part) => part.replace(/[^A-Za-z0-9_-]/g, "_");
|
|
69662
|
+
function waitKeyOf(env, agent, session) {
|
|
69663
|
+
return [env, agent, ...session === null ? [] : [session]].map(keyPart).join("-");
|
|
69664
|
+
}
|
|
69665
|
+
function pidOf(raw) {
|
|
69666
|
+
const pid = raw === null ? NaN : Number(raw.trim());
|
|
69667
|
+
return Number.isInteger(pid) && pid > 0 ? pid : null;
|
|
69668
|
+
}
|
|
69669
|
+
function lockDecision(recorded, self, probe) {
|
|
69670
|
+
if (recorded === null || recorded === self || probe === null || !probe.alive)
|
|
69671
|
+
return { kind: "take" };
|
|
69672
|
+
if (!/events\s+wait/.test(probe.command))
|
|
69673
|
+
return { kind: "take" };
|
|
69674
|
+
if (probe.ppid === 1)
|
|
69675
|
+
return { kind: "replace", pid: recorded };
|
|
69676
|
+
return { kind: "refuse", pid: recorded };
|
|
69677
|
+
}
|
|
69678
|
+
function alreadyWaitingNotice(pid) {
|
|
69679
|
+
return `本会话已有 praxis agent events wait 在后台等待(pid ${pid}),不用再启动。`;
|
|
69680
|
+
}
|
|
69681
|
+
async function acquireWaitLock(ports) {
|
|
69682
|
+
for (let attempt = 0;attempt < 3; attempt++) {
|
|
69683
|
+
const recorded = pidOf(await ports.readPid());
|
|
69684
|
+
if (recorded === null) {
|
|
69685
|
+
if (await ports.createPid(String(ports.self)))
|
|
69686
|
+
return null;
|
|
69687
|
+
continue;
|
|
69688
|
+
}
|
|
69689
|
+
const decision = lockDecision(recorded, ports.self, await ports.probe(recorded));
|
|
69690
|
+
if (decision.kind === "refuse")
|
|
69691
|
+
return decision.pid;
|
|
69692
|
+
if (decision.kind === "replace")
|
|
69693
|
+
ports.terminate(decision.pid);
|
|
69694
|
+
await ports.replacePid(String(ports.self));
|
|
69695
|
+
const holder = pidOf(await ports.readPid());
|
|
69696
|
+
return holder === ports.self || holder === null ? null : holder;
|
|
69697
|
+
}
|
|
69698
|
+
return pidOf(await ports.readPid());
|
|
69699
|
+
}
|
|
69700
|
+
function timeoutMsOf(raw) {
|
|
69701
|
+
if (raw === undefined)
|
|
69702
|
+
return null;
|
|
69703
|
+
const seconds = Number(raw);
|
|
69704
|
+
if (!/^\d+(\.\d+)?$/.test(raw.trim()) || !Number.isFinite(seconds) || seconds <= 0)
|
|
69705
|
+
throw new Error("--timeout takes a positive number of seconds");
|
|
69706
|
+
return Math.round(seconds * 1000);
|
|
69707
|
+
}
|
|
69708
|
+
function backoffMs(failures) {
|
|
69709
|
+
if (failures <= 0)
|
|
69710
|
+
return 0;
|
|
69711
|
+
return Math.min(MAX_BACKOFF_MS, BASE_BACKOFF_MS * 2 ** Math.min(failures - 1, 16));
|
|
69712
|
+
}
|
|
69713
|
+
function inboxLettersUrl(apiUrl, agent) {
|
|
69714
|
+
return `${apiUrl}/agent/v1/agents/${encodeURIComponent(agent)}/inbox/letters?unread=true&limit=20`;
|
|
69715
|
+
}
|
|
69716
|
+
function eventsStreamUrl(apiUrl, agent) {
|
|
69717
|
+
return `${apiUrl}/agent/v1/agents/${encodeURIComponent(agent)}/events/stream`;
|
|
69718
|
+
}
|
|
69719
|
+
function streamHeaders(auth, lastEventId) {
|
|
69720
|
+
return { ...auth, Accept: "text/event-stream", ...lastEventId === null ? {} : { "Last-Event-ID": lastEventId } };
|
|
69721
|
+
}
|
|
69722
|
+
function lettersOf(body) {
|
|
69723
|
+
const value = body;
|
|
69724
|
+
if (!value || typeof value.unread !== "number" || !Array.isArray(value.letters))
|
|
69725
|
+
throw new Error("letters answer is not { unread, letters }");
|
|
69726
|
+
const letters = value.letters.filter((letter) => typeof letter === "object" && letter !== null && typeof letter.id === "string" && typeof letter.summary === "string");
|
|
69727
|
+
return { unread: value.unread, letters };
|
|
69728
|
+
}
|
|
69729
|
+
function feedSse(buffer, chunk) {
|
|
69730
|
+
const text2 = (buffer + chunk).replace(/\r\n?/g, `
|
|
69731
|
+
`);
|
|
69732
|
+
const blocks = text2.split(`
|
|
69733
|
+
|
|
69734
|
+
`);
|
|
69735
|
+
const rest = blocks.pop() ?? "";
|
|
69736
|
+
const frames = [];
|
|
69737
|
+
for (const block of blocks) {
|
|
69738
|
+
let event, id;
|
|
69739
|
+
const data = [];
|
|
69740
|
+
for (const line of block.split(`
|
|
69741
|
+
`)) {
|
|
69742
|
+
if (line === "" || line.startsWith(":"))
|
|
69743
|
+
continue;
|
|
69744
|
+
const colon = line.indexOf(":");
|
|
69745
|
+
const field = colon < 0 ? line : line.slice(0, colon);
|
|
69746
|
+
const value = colon < 0 ? "" : line.slice(colon + 1).replace(/^ /, "");
|
|
69747
|
+
if (field === "data")
|
|
69748
|
+
data.push(value);
|
|
69749
|
+
else if (field === "event")
|
|
69750
|
+
event = value;
|
|
69751
|
+
else if (field === "id")
|
|
69752
|
+
id = value;
|
|
69753
|
+
}
|
|
69754
|
+
if (data.length)
|
|
69755
|
+
frames.push({ ...event === undefined ? {} : { event }, ...id === undefined ? {} : { id }, data: data.join(`
|
|
69756
|
+
`) });
|
|
69757
|
+
}
|
|
69758
|
+
return { buffer: rest, frames };
|
|
69759
|
+
}
|
|
69760
|
+
var text2 = (value) => typeof value === "string" && value !== "";
|
|
69761
|
+
function wakeOf(frame) {
|
|
69762
|
+
let event;
|
|
69763
|
+
try {
|
|
69764
|
+
event = JSON.parse(frame.data);
|
|
69765
|
+
} catch {
|
|
69766
|
+
return null;
|
|
69767
|
+
}
|
|
69768
|
+
if (typeof event !== "object" || event === null)
|
|
69769
|
+
return null;
|
|
69770
|
+
if (event.type === "inbox.letter_delivered" && text2(event.letter_id) && typeof event.summary === "string")
|
|
69771
|
+
return { kind: "letter", letter: {
|
|
69772
|
+
id: event.letter_id,
|
|
69773
|
+
sender: typeof event.sender === "string" ? event.sender : "",
|
|
69774
|
+
...text2(event.sender_name) ? { sender_name: event.sender_name } : {},
|
|
69775
|
+
summary: event.summary,
|
|
69776
|
+
thread: typeof event.thread === "string" ? event.thread : null,
|
|
69777
|
+
create_time: typeof event.create_time === "string" ? event.create_time : ""
|
|
69778
|
+
} };
|
|
69779
|
+
if (event.type === "cognition.ritual_held" && text2(event.title))
|
|
69780
|
+
return { kind: "ritual", ritual: {
|
|
69781
|
+
ritual: text2(event.ritual) ? event.ritual : "",
|
|
69782
|
+
owner: text2(event.owner) ? event.owner : "",
|
|
69783
|
+
title: event.title,
|
|
69784
|
+
engram: text2(event.engram) ? event.engram : ""
|
|
69785
|
+
} };
|
|
69786
|
+
return null;
|
|
69787
|
+
}
|
|
69788
|
+
function ritualNotice(ritual) {
|
|
69789
|
+
const origin = [ritual.owner, ritual.ritual].filter(Boolean).join(" 的仪式 ");
|
|
69790
|
+
return `你获得了一段新记忆:「${ritual.title}」${origin ? `(${origin}${ritual.engram ? `,${ritual.engram}` : ""})` : ""}。处理完再在后台运行 praxis agent events wait。`;
|
|
69791
|
+
}
|
|
69792
|
+
function retryableStatus(status) {
|
|
69793
|
+
return status >= 500 || status === 408 || status === 429;
|
|
69794
|
+
}
|
|
69795
|
+
function planNotice(page, announced) {
|
|
69796
|
+
const seen = new Set(announced);
|
|
69797
|
+
const fresh = page.letters.filter((letter) => !seen.has(letter.id));
|
|
69798
|
+
if (!fresh.length)
|
|
69799
|
+
return { announced };
|
|
69800
|
+
const named = fresh.slice(0, NOTICE_NAMED).map((letter) => `${letter.sender_name || letter.sender}:${letter.summary}(${letter.id})`);
|
|
69801
|
+
const more = fresh.length > NOTICE_NAMED ? `;另有 ${fresh.length - NOTICE_NAMED} 封` : "";
|
|
69802
|
+
const notice = `你有 ${fresh.length} 封新信:${named.join(";")}${more}。用 praxis_assume_inbox(action "read")读取并处理,处理完再在后台运行 praxis agent events wait。`;
|
|
69803
|
+
const next = [...announced, ...fresh.map((letter) => letter.id)];
|
|
69804
|
+
return { notice, announced: next.length > ANNOUNCED_KEEP ? next.slice(next.length - ANNOUNCED_KEEP) : next };
|
|
69805
|
+
}
|
|
69806
|
+
function waitStateOf(raw) {
|
|
69807
|
+
if (raw === null)
|
|
69808
|
+
return { announced: [], lastEventId: null };
|
|
69809
|
+
try {
|
|
69810
|
+
const value = JSON.parse(raw);
|
|
69811
|
+
return {
|
|
69812
|
+
announced: Array.isArray(value.announced) ? value.announced.filter((id) => typeof id === "string") : [],
|
|
69813
|
+
lastEventId: typeof value.last_event_id === "string" && /^\d+$/.test(value.last_event_id) ? value.last_event_id : null
|
|
69814
|
+
};
|
|
69815
|
+
} catch {
|
|
69816
|
+
return { announced: [], lastEventId: null };
|
|
69817
|
+
}
|
|
69818
|
+
}
|
|
69819
|
+
function waitStateText(state) {
|
|
69820
|
+
return JSON.stringify({ announced: state.announced, ...state.lastEventId === null ? {} : { last_event_id: state.lastEventId } });
|
|
69821
|
+
}
|
|
69822
|
+
var message = (error) => error instanceof Error ? error.message : String(error);
|
|
69823
|
+
async function runEventsWait(ports) {
|
|
69824
|
+
const stop = new AbortController;
|
|
69825
|
+
let timedOut = false;
|
|
69826
|
+
const timer = ports.timeoutMs === null ? undefined : setTimeout(() => {
|
|
69827
|
+
timedOut = true;
|
|
69828
|
+
stop.abort();
|
|
69829
|
+
}, ports.timeoutMs);
|
|
69830
|
+
const state = await ports.readState();
|
|
69831
|
+
let announced = state.announced;
|
|
69832
|
+
let lastEventId = state.lastEventId;
|
|
69833
|
+
const announceLetters = async (page) => {
|
|
69834
|
+
const planned = planNotice(page, announced);
|
|
69835
|
+
if (!planned.notice)
|
|
69836
|
+
return false;
|
|
69837
|
+
announced = planned.announced;
|
|
69838
|
+
await ports.writeState({ announced, lastEventId });
|
|
69839
|
+
ports.print(planned.notice);
|
|
69840
|
+
return true;
|
|
69841
|
+
};
|
|
69842
|
+
const announce = async () => announceLetters(await ports.fetchLetters());
|
|
69843
|
+
try {
|
|
69844
|
+
try {
|
|
69845
|
+
if (await announce())
|
|
69846
|
+
return 0;
|
|
69847
|
+
} catch (error) {
|
|
69848
|
+
ports.log(`praxis agent events wait: reading letters failed: ${message(error)}`);
|
|
69849
|
+
}
|
|
69850
|
+
ports.log(`praxis agent events wait: waiting for letters to assume agent ${ports.agent}`);
|
|
69851
|
+
let failures = 0;
|
|
69852
|
+
while (!stop.signal.aborted) {
|
|
69853
|
+
if (failures)
|
|
69854
|
+
await ports.sleep(backoffMs(failures), stop.signal);
|
|
69855
|
+
if (stop.signal.aborted)
|
|
69856
|
+
break;
|
|
69857
|
+
try {
|
|
69858
|
+
const opened = await ports.openStream(stop.signal, lastEventId);
|
|
69859
|
+
if (opened.status < 200 || opened.status >= 300 || !opened.chunks) {
|
|
69860
|
+
if (!retryableStatus(opened.status)) {
|
|
69861
|
+
ports.log(`praxis agent events wait: the event stream was refused (HTTP ${opened.status}${opened.reason ? `: ${opened.reason}` : ""})`);
|
|
69862
|
+
return 1;
|
|
69863
|
+
}
|
|
69864
|
+
throw new Error(`HTTP ${opened.status}`);
|
|
69865
|
+
}
|
|
69866
|
+
if (await announce())
|
|
69867
|
+
return 0;
|
|
69868
|
+
if (failures)
|
|
69869
|
+
ports.log("praxis agent events wait: event stream reconnected");
|
|
69870
|
+
failures = 0;
|
|
69871
|
+
let buffer = "";
|
|
69872
|
+
for await (const chunk of opened.chunks) {
|
|
69873
|
+
const fed = feedSse(buffer, chunk);
|
|
69874
|
+
buffer = fed.buffer;
|
|
69875
|
+
for (const frame of fed.frames) {
|
|
69876
|
+
const wake = wakeOf(frame);
|
|
69877
|
+
if (wake !== null && frame.id !== undefined)
|
|
69878
|
+
lastEventId = frame.id;
|
|
69879
|
+
if (wake?.kind === "letter" && await announceLetters({ unread: 1, letters: [wake.letter] }))
|
|
69880
|
+
return 0;
|
|
69881
|
+
if (wake?.kind === "ritual") {
|
|
69882
|
+
await ports.writeState({ announced, lastEventId });
|
|
69883
|
+
ports.print(ritualNotice(wake.ritual));
|
|
69884
|
+
return 0;
|
|
69885
|
+
}
|
|
69886
|
+
}
|
|
69887
|
+
}
|
|
69888
|
+
throw new Error("the event stream ended");
|
|
69889
|
+
} catch (error) {
|
|
69890
|
+
if (stop.signal.aborted)
|
|
69891
|
+
break;
|
|
69892
|
+
failures += 1;
|
|
69893
|
+
ports.log(`praxis agent events wait: ${message(error)} (${failures} in a row, reconnecting in ${backoffMs(failures) / 1000}s)`);
|
|
69894
|
+
}
|
|
69895
|
+
}
|
|
69896
|
+
if (timedOut)
|
|
69897
|
+
ports.print(`${(ports.timeoutMs ?? 0) / 1000} 秒内没有新信。需要继续等待时再在后台运行 praxis agent events wait。`);
|
|
69898
|
+
return 0;
|
|
69899
|
+
} finally {
|
|
69900
|
+
if (timer)
|
|
69901
|
+
clearTimeout(timer);
|
|
69902
|
+
stop.abort();
|
|
69903
|
+
}
|
|
69904
|
+
}
|
|
69905
|
+
|
|
68880
69906
|
// src/main.ts
|
|
68881
69907
|
import { spawnSync } from "node:child_process";
|
|
68882
69908
|
|
|
@@ -68994,15 +70020,15 @@ class ModelStream {
|
|
|
68994
70020
|
finishReason = "unknown";
|
|
68995
70021
|
usage;
|
|
68996
70022
|
add(event) {
|
|
68997
|
-
const data = streamData(event),
|
|
70023
|
+
const data = streamData(event), message2 = record(data.message), response = record(data.response);
|
|
68998
70024
|
this.chunks.push(streamText(event));
|
|
68999
70025
|
const choices = Array.isArray(data.choices) ? data.choices : [];
|
|
69000
|
-
const reason2 = choices.map((c) => record(c).finish_reason).find((r) => typeof r === "string" && r) ?? record(data.delta).stop_reason ??
|
|
70026
|
+
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;
|
|
69001
70027
|
if (typeof reason2 === "string" && reason2)
|
|
69002
70028
|
this.finishReason = reason2;
|
|
69003
70029
|
else if (["response.completed", "response.incomplete", "response.failed"].includes(String(data.type)))
|
|
69004
70030
|
this.finishReason = String(data.type).slice("response.".length);
|
|
69005
|
-
for (const usage of [
|
|
70031
|
+
for (const usage of [message2.usage, data.usage, response.usage]) {
|
|
69006
70032
|
if (usage !== null && typeof usage === "object" && !Array.isArray(usage))
|
|
69007
70033
|
this.usage = { ...this.usage, ...record(usage) };
|
|
69008
70034
|
}
|
|
@@ -69067,8 +70093,8 @@ function isSuccess(verb, ctx) {
|
|
|
69067
70093
|
}
|
|
69068
70094
|
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" };
|
|
69069
70095
|
var deleted = (verb) => /^(delete|remove|purge)(-|$)/.test(verb);
|
|
69070
|
-
function width(
|
|
69071
|
-
return [...
|
|
70096
|
+
function width(text3) {
|
|
70097
|
+
return [...text3].reduce((sum, ch) => {
|
|
69072
70098
|
const cp = ch.codePointAt(0);
|
|
69073
70099
|
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);
|
|
69074
70100
|
}, 0);
|
|
@@ -69076,13 +70102,13 @@ function width(text2) {
|
|
|
69076
70102
|
function truncate(value, size) {
|
|
69077
70103
|
if (width(value) <= size)
|
|
69078
70104
|
return value;
|
|
69079
|
-
let
|
|
70105
|
+
let text3 = "";
|
|
69080
70106
|
for (const ch of value) {
|
|
69081
|
-
if (width(
|
|
70107
|
+
if (width(text3 + ch) > size - 1)
|
|
69082
70108
|
break;
|
|
69083
|
-
|
|
70109
|
+
text3 += ch;
|
|
69084
70110
|
}
|
|
69085
|
-
return
|
|
70111
|
+
return text3 + "…";
|
|
69086
70112
|
}
|
|
69087
70113
|
function table(items, ctx, paint) {
|
|
69088
70114
|
const columns = columnsFor(items);
|
|
@@ -69115,13 +70141,13 @@ function table(items, ctx, paint) {
|
|
|
69115
70141
|
sizes[index]--;
|
|
69116
70142
|
}
|
|
69117
70143
|
const line = (row, header) => row.map((v, i) => {
|
|
69118
|
-
const
|
|
69119
|
-
let styled = header ? paint.dim(
|
|
70144
|
+
const text3 = truncate(v, sizes[i]);
|
|
70145
|
+
let styled = header ? paint.dim(text3) : text3;
|
|
69120
70146
|
if (!header && ["status", "state"].includes(columns[i])) {
|
|
69121
70147
|
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;
|
|
69122
|
-
styled = color(
|
|
70148
|
+
styled = color(text3);
|
|
69123
70149
|
}
|
|
69124
|
-
return styled + (i === row.length - 1 ? "" : " ".repeat(Math.max(0, sizes[i] - width(
|
|
70150
|
+
return styled + (i === row.length - 1 ? "" : " ".repeat(Math.max(0, sizes[i] - width(text3))));
|
|
69125
70151
|
}).join(" ");
|
|
69126
70152
|
return [line(headers, true), ...rows.map((row) => line(row, false))].join(`
|
|
69127
70153
|
`) + `
|
|
@@ -69220,9 +70246,9 @@ function renderHuman(result, ctx) {
|
|
|
69220
70246
|
}
|
|
69221
70247
|
|
|
69222
70248
|
// src/output/agent.ts
|
|
69223
|
-
function cell(
|
|
69224
|
-
const chars = [...
|
|
69225
|
-
const limited = chars.length > 500 ? chars.slice(0, 500).join("") + `…[+${chars.length - 500} chars, use --json]` :
|
|
70249
|
+
function cell(text3) {
|
|
70250
|
+
const chars = [...text3];
|
|
70251
|
+
const limited = chars.length > 500 ? chars.slice(0, 500).join("") + `…[+${chars.length - 500} chars, use --json]` : text3;
|
|
69226
70252
|
return limited.replace(/\\/g, "\\\\").replace(/\|/g, "\\|").replace(/\r?\n/g, "<br>").replace(/\r/g, "<br>");
|
|
69227
70253
|
}
|
|
69228
70254
|
function renderAgent(result, ctx) {
|
|
@@ -69233,9 +70259,9 @@ function renderAgent(result, ctx) {
|
|
|
69233
70259
|
if (modelStream(result.op)) {
|
|
69234
70260
|
if (!result.summary)
|
|
69235
70261
|
return {};
|
|
69236
|
-
const { text:
|
|
69237
|
-
return { stdout: `${
|
|
69238
|
-
`) || !
|
|
70262
|
+
const { text: text3, finish_reason, usage } = result.summary;
|
|
70263
|
+
return { stdout: `${text3}${text3.endsWith(`
|
|
70264
|
+
`) || !text3 ? "" : `
|
|
69239
70265
|
`}finish_reason: ${finish_reason}
|
|
69240
70266
|
${usage ? `usage: ${JSON.stringify(usage)}
|
|
69241
70267
|
` : ""}` };
|
|
@@ -69454,18 +70480,18 @@ function errorInput(error, ctx) {
|
|
|
69454
70480
|
const details = candidate !== null && typeof candidate === "object" && !Array.isArray(candidate) ? candidate : undefined;
|
|
69455
70481
|
const problem = serverProblem(Object.keys(nested).length ? nested : raw);
|
|
69456
70482
|
const serverText = (value) => typeof value === "string" && value.trim() ? value : undefined;
|
|
69457
|
-
let
|
|
69458
|
-
const prefix =
|
|
70483
|
+
let message2 = error instanceof Error ? error.message : "Unexpected error";
|
|
70484
|
+
const prefix = message2.match(/^([A-Z][A-Z0-9_]+):\s*/)?.[1];
|
|
69459
70485
|
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");
|
|
69460
70486
|
let stripped = false;
|
|
69461
|
-
while (
|
|
69462
|
-
|
|
70487
|
+
while (message2.startsWith(`${code}:`)) {
|
|
70488
|
+
message2 = message2.slice(code.length + 1).trimStart();
|
|
69463
70489
|
stripped = true;
|
|
69464
70490
|
}
|
|
69465
70491
|
if (stripped)
|
|
69466
|
-
|
|
70492
|
+
message2 = `${humanize(code)}${message2 ? `: ${message2}` : ""}`;
|
|
69467
70493
|
const status = sdk?.status, request_id = sdk?.requestId;
|
|
69468
|
-
|
|
70494
|
+
message2 = serverText(problem?.detail) ?? serverText(problem?.title) ?? message2;
|
|
69469
70495
|
const authFailure = status === 401 || ["NOT_LOGGED_IN", "UNAUTHENTICATED", "TOKEN_REVOKED", "LOGIN_FAILED", "MANAGED_LOGIN_EXPIRED"].includes(code);
|
|
69470
70496
|
const source = ctx.credentialSource ?? "login";
|
|
69471
70497
|
let hint3 = genericHint;
|
|
@@ -69483,11 +70509,11 @@ function errorInput(error, ctx) {
|
|
|
69483
70509
|
hint3 = "Rate limited; retry later.";
|
|
69484
70510
|
else if (status !== undefined && status >= 500)
|
|
69485
70511
|
hint3 = `Server error; retry later.${request_id ? ` Request id: ${request_id}.` : ""}`;
|
|
69486
|
-
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 } : {} };
|
|
70512
|
+
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 } : {} };
|
|
69487
70513
|
}
|
|
69488
70514
|
|
|
69489
70515
|
// src/output/progress.ts
|
|
69490
|
-
function startProgress(ctx, write = (
|
|
70516
|
+
function startProgress(ctx, write = (text3) => writeOutput({ stderr: text3 })) {
|
|
69491
70517
|
if (ctx.mode !== "human" || !ctx.stderrIsTTY)
|
|
69492
70518
|
return () => {};
|
|
69493
70519
|
let interval;
|
|
@@ -69513,7 +70539,7 @@ function startProgress(ctx, write = (text2) => writeOutput({ stderr: text2 })) {
|
|
|
69513
70539
|
}
|
|
69514
70540
|
|
|
69515
70541
|
// src/main.ts
|
|
69516
|
-
var version = "0.3.0-dev.
|
|
70542
|
+
var version = "0.3.0-dev.c02df8c";
|
|
69517
70543
|
var commands = commandTree(operations);
|
|
69518
70544
|
var manual = [...workflows.map((w) => w.words), [API_WORD]];
|
|
69519
70545
|
function route(argv) {
|
|
@@ -69595,7 +70621,7 @@ var defaults = {
|
|
|
69595
70621
|
return;
|
|
69596
70622
|
const cmd = process.platform === "darwin" ? ["open", url] : process.platform === "win32" ? ["rundll32", "url.dll,FileProtocolHandler", url] : ["xdg-open", url];
|
|
69597
70623
|
await new Promise((resolve12, reject) => {
|
|
69598
|
-
const child =
|
|
70624
|
+
const child = spawn5(cmd[0], cmd.slice(1), { stdio: "ignore" });
|
|
69599
70625
|
child.once("error", reject);
|
|
69600
70626
|
child.once("close", () => resolve12());
|
|
69601
70627
|
});
|
|
@@ -69604,12 +70630,12 @@ var defaults = {
|
|
|
69604
70630
|
wait: (ms) => new Promise((resolve12) => setTimeout(resolve12, ms)),
|
|
69605
70631
|
render,
|
|
69606
70632
|
spawn: (cmd, args, options) => new Promise((resolve12, reject) => {
|
|
69607
|
-
const child =
|
|
70633
|
+
const child = spawn5(cmd, args, { cwd: options.cwd, stdio: ["ignore", 2, 2] });
|
|
69608
70634
|
child.once("error", reject);
|
|
69609
70635
|
child.once("close", (code) => resolve12(code ?? 1));
|
|
69610
70636
|
}),
|
|
69611
70637
|
spawnCapture: (cmd, args, options) => new Promise((resolve12, reject) => {
|
|
69612
|
-
const child =
|
|
70638
|
+
const child = spawn5(cmd, args, { cwd: options.cwd, stdio: ["ignore", "pipe", "pipe"] });
|
|
69613
70639
|
const chunks = [];
|
|
69614
70640
|
child.stdout.on("data", (c) => chunks.push(c));
|
|
69615
70641
|
child.stderr.on("data", (c) => chunks.push(c));
|
|
@@ -69668,7 +70694,7 @@ var appOptions = {
|
|
|
69668
70694
|
{ name: "case", type: "string", description: "Scenario title substring; the engine's `scenario` (case ids are a later slice)." },
|
|
69669
70695
|
{ name: "e2e", type: "boolean", description: "The large end-to-end tests; exactly --size large, so the two cannot be combined." },
|
|
69670
70696
|
{ name: "retries", type: "string", description: "Retries after a failing scenario (default: 0)." },
|
|
69671
|
-
{ name: "ctrf", type: "string", description: "Write the CTRF report here (default: <cwd>/.
|
|
70697
|
+
{ name: "ctrf", type: "string", description: "Write the CTRF report here (default: <cwd>/.praxis/ctrf/<run>.json)." }
|
|
69672
70698
|
],
|
|
69673
70699
|
"devops test report": [
|
|
69674
70700
|
{ name: "id", type: "string", description: "Show one run's detail instead of the recent list." },
|
|
@@ -69688,6 +70714,14 @@ var appOptions = {
|
|
|
69688
70714
|
"devops flag scaffold": [
|
|
69689
70715
|
{ name: "out", type: "string", description: "Directory the paired on/off scenario stubs are written to (default: the current directory)." }
|
|
69690
70716
|
],
|
|
70717
|
+
"devops flag refs": [
|
|
70718
|
+
{ 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)." },
|
|
70719
|
+
{ name: "project", type: "string", description: "With --report: the DevOps project id (dvp_…) whose flags the scan is reported into. Required." }
|
|
70720
|
+
],
|
|
70721
|
+
"agent events wait": [
|
|
70722
|
+
{ name: "timeout", type: "string", description: "Give up after this many seconds, print that nothing arrived and exit 0 (default: wait until a letter arrives)." },
|
|
70723
|
+
{ 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)." }
|
|
70724
|
+
],
|
|
69691
70725
|
"canvas import": [
|
|
69692
70726
|
{ name: "name", type: "string", description: "Name for the new canvas (default: the file name without .pen)." },
|
|
69693
70727
|
{ 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." },
|
|
@@ -69702,17 +70736,19 @@ var appOptions = {
|
|
|
69702
70736
|
};
|
|
69703
70737
|
appOptions["devops engine deploy"] = appOptions["devops deploy"];
|
|
69704
70738
|
var workflowOptions = (words) => words[0] === "skill" ? [{ name: "install", type: "string" }] : appOptions[words.join(" ")] ?? [];
|
|
69705
|
-
function flagPortsFor(ports, context, emit) {
|
|
70739
|
+
function flagPortsFor(ports, context, emit, connect) {
|
|
69706
70740
|
return {
|
|
69707
70741
|
mode: context.mode,
|
|
69708
70742
|
emit,
|
|
69709
|
-
human: (
|
|
70743
|
+
human: (text3) => {
|
|
69710
70744
|
if (context.mode === "human")
|
|
69711
|
-
emit({ kind: "message", channel: "stdout", text:
|
|
70745
|
+
emit({ kind: "message", channel: "stdout", text: text3 });
|
|
69712
70746
|
},
|
|
69713
70747
|
cwd: ports.cwd,
|
|
69714
70748
|
readFile: ports.readFile,
|
|
69715
|
-
|
|
70749
|
+
git: async (args) => (await ports.spawnCapture("git", [...args], { cwd: ports.cwd })).output,
|
|
70750
|
+
client: connect,
|
|
70751
|
+
writeFile: (path, text3) => writeFile5(path, text3, "utf8"),
|
|
69716
70752
|
mkdir: async (path) => {
|
|
69717
70753
|
await mkdir4(path, { recursive: true });
|
|
69718
70754
|
},
|
|
@@ -69736,9 +70772,9 @@ function toolPortsFor(ports, context, emit) {
|
|
|
69736
70772
|
return {
|
|
69737
70773
|
mode: context.mode,
|
|
69738
70774
|
emit,
|
|
69739
|
-
human: (
|
|
70775
|
+
human: (text3) => {
|
|
69740
70776
|
if (context.mode === "human")
|
|
69741
|
-
emit({ kind: "message", channel: "stdout", text:
|
|
70777
|
+
emit({ kind: "message", channel: "stdout", text: text3 });
|
|
69742
70778
|
},
|
|
69743
70779
|
cwd: ports.cwd,
|
|
69744
70780
|
readFile: ports.readFile,
|
|
@@ -69753,7 +70789,7 @@ function toolPortsFor(ports, context, emit) {
|
|
|
69753
70789
|
},
|
|
69754
70790
|
git: (args, cwd) => ports.spawnCapture("git", args, { cwd }),
|
|
69755
70791
|
run: (cmd, args, cwd) => new Promise((resolve12, reject) => {
|
|
69756
|
-
const child =
|
|
70792
|
+
const child = spawn5(cmd, args, { cwd, stdio: "inherit" });
|
|
69757
70793
|
child.once("error", reject);
|
|
69758
70794
|
child.once("close", (code) => resolve12(code ?? 1));
|
|
69759
70795
|
}),
|
|
@@ -70048,9 +71084,9 @@ Examples:
|
|
|
70048
71084
|
},
|
|
70049
71085
|
mode: ctx.mode,
|
|
70050
71086
|
emit,
|
|
70051
|
-
human: (
|
|
71087
|
+
human: (text3) => {
|
|
70052
71088
|
if (ctx.mode === "human")
|
|
70053
|
-
emit({ kind: "message", channel: "stdout", text:
|
|
71089
|
+
emit({ kind: "message", channel: "stdout", text: text3 });
|
|
70054
71090
|
},
|
|
70055
71091
|
cwd: ports.cwd
|
|
70056
71092
|
});
|
|
@@ -70077,14 +71113,14 @@ Examples:
|
|
|
70077
71113
|
}, {
|
|
70078
71114
|
mode: ctx.mode,
|
|
70079
71115
|
emit,
|
|
70080
|
-
human: (
|
|
71116
|
+
human: (text3) => {
|
|
70081
71117
|
if (ctx.mode === "human")
|
|
70082
|
-
emit({ kind: "message", channel: "stdout", text:
|
|
71118
|
+
emit({ kind: "message", channel: "stdout", text: text3 });
|
|
70083
71119
|
},
|
|
70084
71120
|
engine: codeRefactorEngine(),
|
|
70085
71121
|
hasFile: (path2) => existsSync4(path2),
|
|
70086
71122
|
readFile: ports.readFile,
|
|
70087
|
-
writeFile: (path2,
|
|
71123
|
+
writeFile: (path2, text3) => writeFile5(path2, text3, "utf8"),
|
|
70088
71124
|
mkdir: async (path2) => {
|
|
70089
71125
|
await mkdir4(path2, { recursive: true });
|
|
70090
71126
|
},
|
|
@@ -70101,9 +71137,9 @@ Examples:
|
|
|
70101
71137
|
const shellPorts = {
|
|
70102
71138
|
mode: ctx.mode,
|
|
70103
71139
|
emit,
|
|
70104
|
-
human: (
|
|
71140
|
+
human: (text3) => {
|
|
70105
71141
|
if (ctx.mode === "human")
|
|
70106
|
-
emit({ kind: "message", channel: "stdout", text:
|
|
71142
|
+
emit({ kind: "message", channel: "stdout", text: text3 });
|
|
70107
71143
|
},
|
|
70108
71144
|
engine: await repositoryEngine(name, () => localEngine(ports.cwd)),
|
|
70109
71145
|
...localFilePorts(ports.cwd)
|
|
@@ -70116,9 +71152,9 @@ Examples:
|
|
|
70116
71152
|
const testPorts = {
|
|
70117
71153
|
mode: ctx.mode,
|
|
70118
71154
|
emit,
|
|
70119
|
-
human: (
|
|
71155
|
+
human: (text3) => {
|
|
70120
71156
|
if (ctx.mode === "human")
|
|
70121
|
-
emit({ kind: "message", channel: "stdout", text:
|
|
71157
|
+
emit({ kind: "message", channel: "stdout", text: text3 });
|
|
70122
71158
|
},
|
|
70123
71159
|
engine: await repositoryEngine(name, () => localEngine(ports.cwd)),
|
|
70124
71160
|
checkout: await localCheckout(ports.cwd, (cmd, args, options) => ports.spawnCapture(cmd, args, options))
|
|
@@ -70127,9 +71163,9 @@ Examples:
|
|
|
70127
71163
|
return await devopsTestReport({ path: parsed.positional[0], id: parsed.flags.id?.[0], upload: Boolean(parsed.flags.upload), project: parsed.flags.project?.[0] }, testPorts, {
|
|
70128
71164
|
mode: ctx.mode,
|
|
70129
71165
|
emit,
|
|
70130
|
-
human: (
|
|
71166
|
+
human: (text3) => {
|
|
70131
71167
|
if (ctx.mode === "human")
|
|
70132
|
-
emit({ kind: "message", channel: "stdout", text:
|
|
71168
|
+
emit({ kind: "message", channel: "stdout", text: text3 });
|
|
70133
71169
|
},
|
|
70134
71170
|
root: async () => await checkoutRoot(ports.cwd, ports.readFile),
|
|
70135
71171
|
readFile: ports.readFile,
|
|
@@ -70159,13 +71195,13 @@ Examples:
|
|
|
70159
71195
|
git: (args) => ports.spawnCapture("git", args, { cwd: ports.cwd }),
|
|
70160
71196
|
mode: ctx.mode,
|
|
70161
71197
|
emit,
|
|
70162
|
-
human: (
|
|
71198
|
+
human: (text3) => {
|
|
70163
71199
|
if (ctx.mode === "human")
|
|
70164
|
-
emit({ kind: "message", channel: "stdout", text:
|
|
71200
|
+
emit({ kind: "message", channel: "stdout", text: text3 });
|
|
70165
71201
|
}
|
|
70166
71202
|
});
|
|
70167
71203
|
}
|
|
70168
|
-
const flagPorts = flagPortsFor(ports, ctx, emit);
|
|
71204
|
+
const flagPorts = flagPortsFor(ports, ctx, emit, async () => await auth.client(org));
|
|
70169
71205
|
if (name === "devops flag sync")
|
|
70170
71206
|
return await devopsFlagSync({ check: Boolean(parsed.flags.check) }, flagPorts);
|
|
70171
71207
|
if (name === "devops flag check")
|
|
@@ -70173,7 +71209,7 @@ Examples:
|
|
|
70173
71209
|
if (name === "devops flag scaffold")
|
|
70174
71210
|
return await devopsFlagScaffold(parsed.positional[0], { out: parsed.flags.out?.[0] }, flagPorts);
|
|
70175
71211
|
if (name === "devops flag refs")
|
|
70176
|
-
return await devopsFlagRefs(parsed.positional[0], flagPorts);
|
|
71212
|
+
return await devopsFlagRefs(parsed.positional[0], { report: Boolean(parsed.flags.report), project: parsed.flags.project?.[0] }, flagPorts);
|
|
70177
71213
|
return await devopsFlagRemove(parsed.positional[0], flagPorts);
|
|
70178
71214
|
}
|
|
70179
71215
|
if (!quiet)
|
|
@@ -70211,9 +71247,9 @@ Examples:
|
|
|
70211
71247
|
emit({ kind: "object", data: await auth.switchOrganization(parsed.positional[0]) });
|
|
70212
71248
|
break;
|
|
70213
71249
|
case "app create": {
|
|
70214
|
-
const appPorts = { ...ports, mode: ctx.mode, emit, human: (
|
|
71250
|
+
const appPorts = { ...ports, mode: ctx.mode, emit, human: (text3) => {
|
|
70215
71251
|
if (ctx.mode === "human")
|
|
70216
|
-
emit({ kind: "message", channel: "stdout", text:
|
|
71252
|
+
emit({ kind: "message", channel: "stdout", text: text3 });
|
|
70217
71253
|
}, random: randomSecret };
|
|
70218
71254
|
await appCreate({ name: parsed.positional[0], dir: parsed.flags.dir?.[0], template: parsed.flags.template?.[0], install: !parsed.flags["no-install"] }, config.env, appPorts);
|
|
70219
71255
|
break;
|
|
@@ -70242,13 +71278,129 @@ Examples:
|
|
|
70242
71278
|
wait: ports.wait,
|
|
70243
71279
|
mode: ctx.mode,
|
|
70244
71280
|
emit,
|
|
70245
|
-
human: (
|
|
71281
|
+
human: (text3) => {
|
|
70246
71282
|
if (ctx.mode === "human")
|
|
70247
|
-
emit({ kind: "message", channel: "stdout", text:
|
|
71283
|
+
emit({ kind: "message", channel: "stdout", text: text3 });
|
|
70248
71284
|
},
|
|
70249
71285
|
cwd: ports.cwd
|
|
70250
71286
|
});
|
|
70251
71287
|
}
|
|
71288
|
+
case "agent events wait": {
|
|
71289
|
+
const agent = assumeAgentOf(ports.env);
|
|
71290
|
+
const timeoutMs = (() => {
|
|
71291
|
+
try {
|
|
71292
|
+
return timeoutMsOf(parsed.flags.timeout?.[0]);
|
|
71293
|
+
} catch (error) {
|
|
71294
|
+
throw new UsageError(error.message, "Example: praxis agent events wait --timeout 3600");
|
|
71295
|
+
}
|
|
71296
|
+
})();
|
|
71297
|
+
const headers = async () => {
|
|
71298
|
+
const credential = await auth.get(org);
|
|
71299
|
+
return { Authorization: `Bearer ${credential.token}`, ...credential.source === "api-key" ? { "X-API-Key": credential.token } : {} };
|
|
71300
|
+
};
|
|
71301
|
+
const failure2 = (status, body) => `HTTP ${status}${body?.error?.code ? ` ${body.error.code}` : ""}${body?.error?.message ? `: ${String(redact(body.error.message, secrets))}` : ""}`;
|
|
71302
|
+
const session = (() => {
|
|
71303
|
+
try {
|
|
71304
|
+
return sessionOf(parsed.flags.session?.[0]);
|
|
71305
|
+
} catch (error) {
|
|
71306
|
+
throw new UsageError(error.message, "Example: praxis agent events wait --session 0f6c…");
|
|
71307
|
+
}
|
|
71308
|
+
})();
|
|
71309
|
+
const key = waitKeyOf(config.env, agent, session);
|
|
71310
|
+
const waitDir = join12(ports.env.HOME || homedir3(), ".praxis", "cli", "events-wait");
|
|
71311
|
+
const statePath = join12(waitDir, `${key}.json`);
|
|
71312
|
+
const pidPath = join12(waitDir, `${key}.pid`);
|
|
71313
|
+
await mkdir4(waitDir, { recursive: true, mode: 448 });
|
|
71314
|
+
const holder = await acquireWaitLock({
|
|
71315
|
+
self: process.pid,
|
|
71316
|
+
readPid: () => readFile7(pidPath, "utf8").catch(() => null),
|
|
71317
|
+
createPid: (text3) => writeFile5(pidPath, text3, { mode: 384, flag: "wx" }).then(() => true, () => false),
|
|
71318
|
+
replacePid: (text3) => writeFile5(pidPath, text3, { mode: 384 }),
|
|
71319
|
+
probe: async (pid) => {
|
|
71320
|
+
try {
|
|
71321
|
+
process.kill(pid, 0);
|
|
71322
|
+
} catch (error) {
|
|
71323
|
+
if (error.code !== "EPERM")
|
|
71324
|
+
return { alive: false };
|
|
71325
|
+
}
|
|
71326
|
+
const ps = spawnSync("ps", ["-o", "ppid=,command=", "-p", String(pid)], { encoding: "utf8" });
|
|
71327
|
+
const line = ps.stdout?.trim() ?? "";
|
|
71328
|
+
const match = /^(\d+)\s+(.*)$/.exec(line);
|
|
71329
|
+
return match ? { alive: true, ppid: Number(match[1]), command: match[2] } : { alive: false };
|
|
71330
|
+
},
|
|
71331
|
+
terminate: (pid) => {
|
|
71332
|
+
try {
|
|
71333
|
+
process.kill(pid, "SIGTERM");
|
|
71334
|
+
} catch {}
|
|
71335
|
+
}
|
|
71336
|
+
});
|
|
71337
|
+
if (holder !== null) {
|
|
71338
|
+
process.stdout.write(alreadyWaitingNotice(holder) + `
|
|
71339
|
+
`);
|
|
71340
|
+
return 0;
|
|
71341
|
+
}
|
|
71342
|
+
const release = () => {
|
|
71343
|
+
try {
|
|
71344
|
+
if (pidOf(readFileSync3(pidPath, "utf8")) === process.pid)
|
|
71345
|
+
unlinkSync(pidPath);
|
|
71346
|
+
} catch {}
|
|
71347
|
+
};
|
|
71348
|
+
const onSignal = (signal) => {
|
|
71349
|
+
release();
|
|
71350
|
+
process.exit(signal === "SIGINT" ? 130 : 143);
|
|
71351
|
+
};
|
|
71352
|
+
for (const signal of ["SIGTERM", "SIGINT", "SIGHUP"])
|
|
71353
|
+
process.once(signal, onSignal);
|
|
71354
|
+
try {
|
|
71355
|
+
return await runEventsWait({
|
|
71356
|
+
agent,
|
|
71357
|
+
timeoutMs,
|
|
71358
|
+
fetchLetters: async () => {
|
|
71359
|
+
const response = await wireFetch(inboxLettersUrl(config.apiUrl, agent), { headers: await headers(), signal: AbortSignal.timeout(30000), redirect: "error" });
|
|
71360
|
+
const body = await response.json().catch(() => null);
|
|
71361
|
+
if (!response.ok)
|
|
71362
|
+
throw new Error(failure2(response.status, body));
|
|
71363
|
+
return lettersOf(body);
|
|
71364
|
+
},
|
|
71365
|
+
openStream: async (signal, lastEventId) => {
|
|
71366
|
+
const response = await wireFetch(eventsStreamUrl(config.apiUrl, agent), {
|
|
71367
|
+
headers: streamHeaders(await headers(), lastEventId),
|
|
71368
|
+
signal,
|
|
71369
|
+
redirect: "error"
|
|
71370
|
+
});
|
|
71371
|
+
if (!response.ok || !response.body) {
|
|
71372
|
+
const body = await response.json().catch(() => null);
|
|
71373
|
+
return { status: response.status, reason: failure2(response.status, body) };
|
|
71374
|
+
}
|
|
71375
|
+
return { status: response.status, chunks: response.body.pipeThrough(new TextDecoderStream) };
|
|
71376
|
+
},
|
|
71377
|
+
readState: async () => waitStateOf(await readFile7(statePath, "utf8").catch(() => null)),
|
|
71378
|
+
writeState: async (next) => {
|
|
71379
|
+
await mkdir4(dirname10(statePath), { recursive: true, mode: 448 });
|
|
71380
|
+
await writeFile5(statePath, waitStateText(next), { mode: 384 });
|
|
71381
|
+
},
|
|
71382
|
+
print: (line) => {
|
|
71383
|
+
process.stdout.write(line + `
|
|
71384
|
+
`);
|
|
71385
|
+
},
|
|
71386
|
+
log: (line) => {
|
|
71387
|
+
process.stderr.write(String(redact(line, secrets)) + `
|
|
71388
|
+
`);
|
|
71389
|
+
},
|
|
71390
|
+
sleep: (ms, signal) => new Promise((resolve12) => {
|
|
71391
|
+
const timer = setTimeout(resolve12, ms);
|
|
71392
|
+
signal.addEventListener("abort", () => {
|
|
71393
|
+
clearTimeout(timer);
|
|
71394
|
+
resolve12();
|
|
71395
|
+
}, { once: true });
|
|
71396
|
+
})
|
|
71397
|
+
});
|
|
71398
|
+
} finally {
|
|
71399
|
+
release();
|
|
71400
|
+
for (const signal of ["SIGTERM", "SIGINT", "SIGHUP"])
|
|
71401
|
+
process.removeListener(signal, onSignal);
|
|
71402
|
+
}
|
|
71403
|
+
}
|
|
70252
71404
|
case "canvas import": {
|
|
70253
71405
|
const authorize = async () => {
|
|
70254
71406
|
const credential = await auth.get(org);
|
|
@@ -70304,9 +71456,9 @@ Examples:
|
|
|
70304
71456
|
cwd: ports.cwd,
|
|
70305
71457
|
rpc,
|
|
70306
71458
|
upload,
|
|
70307
|
-
human: (
|
|
71459
|
+
human: (text3) => {
|
|
70308
71460
|
if (ctx.mode === "human")
|
|
70309
|
-
emit({ kind: "message", channel: "stdout", text:
|
|
71461
|
+
emit({ kind: "message", channel: "stdout", text: text3 });
|
|
70310
71462
|
}
|
|
70311
71463
|
});
|
|
70312
71464
|
}
|
|
@@ -70338,7 +71490,8 @@ if (true) {
|
|
|
70338
71490
|
process.exit(0);
|
|
70339
71491
|
throw error;
|
|
70340
71492
|
});
|
|
70341
|
-
|
|
71493
|
+
const argv = process.argv.slice(2);
|
|
71494
|
+
process.exitCode = isDevopsTestRun(route(argv).words) && needsCacheOffReexec(process.env) ? await reexecWithCacheOff() : await main3(argv);
|
|
70342
71495
|
}
|
|
70343
71496
|
export {
|
|
70344
71497
|
main3 as main
|