@deepraxis/cli 0.3.0-dev.c070526 → 0.3.0-dev.c81a93f
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 +13 -3
- package/dist/praxis.js +1572 -117
- package/package.json +1 -1
package/dist/praxis.js
CHANGED
|
@@ -13983,9 +13983,18 @@ var FLAGS;
|
|
|
13983
13983
|
var init_flag_registry_generated = __esm(() => {
|
|
13984
13984
|
FLAGS = {
|
|
13985
13985
|
"agent-cognition-idle-wake": { kind: "RELEASE", type: "BOOLEAN", default: false, owner: "genius", ticket: 540, expires: "2026-11-30", system: "flagship" },
|
|
13986
|
+
"cognition-per-agent": { kind: "RELEASE", type: "BOOLEAN", default: false, owner: "usr_t60d4g5z82rhbtbfrfxfbdxe", ticket: 2506, expires: "2026-11-30", system: "devops" },
|
|
13986
13987
|
"cognition-weight-driven": { kind: "RELEASE", type: "BOOLEAN", default: false, owner: "praxis-bd", ticket: 1760, expires: "2026-12-05", system: "devops" },
|
|
13988
|
+
"computer-archive-volume": { kind: "RELEASE", type: "BOOLEAN", default: false, owner: "usr_t60d4g5z82rhbtbfrfxfbdxe", ticket: 2419, expires: "2026-11-30", system: "devops" },
|
|
13989
|
+
crm: { kind: "RELEASE", type: "BOOLEAN", default: false, owner: "usr_rv860m7z9h8szkgma56cd14n", ticket: 2179, expires: "2026-12-31", system: "devops" },
|
|
13990
|
+
"delivery-rules-v2": { kind: "RELEASE", type: "BOOLEAN", default: false, owner: "usr_t60d4g5z82rhbtbfrfxfbdxe", ticket: 2048, expires: "2026-11-28", system: "devops" },
|
|
13991
|
+
"end-users": { kind: "RELEASE", type: "BOOLEAN", default: false, owner: "usr_t60d4g5z82rhbtbfrfxfbdxe", ticket: 2312, expires: "2026-12-15", system: "devops" },
|
|
13987
13992
|
"model-access-gate": { kind: "RELEASE", type: "BOOLEAN", default: false, owner: "usr_t60d4g5z82rhbtbfrfxfbdxe", ticket: 1933, expires: "2026-12-15", system: "devops" },
|
|
13988
13993
|
"open-project": { kind: "RELEASE", type: "BOOLEAN", default: false, owner: "praxis-51", ticket: 1488, expires: "2026-11-25", system: "devops" },
|
|
13994
|
+
"requests-never-hold": { kind: "RELEASE", type: "BOOLEAN", default: false, owner: "usr_t60d4g5z82rhbtbfrfxfbdxe", ticket: 2119, expires: "2026-11-29", system: "devops" },
|
|
13995
|
+
"requests-v1": { kind: "RELEASE", type: "BOOLEAN", default: false, owner: "usr_t60d4g5z82rhbtbfrfxfbdxe", ticket: 2057, expires: "2026-11-28", system: "devops" },
|
|
13996
|
+
"router-precommit-hedge": { kind: "RELEASE", type: "BOOLEAN", default: false, owner: "usr_t60d4g5z82rhbtbfrfxfbdxe", ticket: 2052, expires: "2026-11-28", system: "devops" },
|
|
13997
|
+
"router-responses-hedge": { kind: "RELEASE", type: "BOOLEAN", default: false, owner: "usr_t60d4g5z82rhbtbfrfxfbdxe", ticket: 2149, expires: "2026-11-28", system: "devops" },
|
|
13989
13998
|
"search-provider-routing": { kind: "RELEASE", type: "BOOLEAN", default: false, owner: "praxis-98", ticket: 716, expires: "2026-12-31", system: "devops" },
|
|
13990
13999
|
"unit-live-probe": { kind: "RELEASE", type: "BOOLEAN", default: false, owner: "usr_t60d4g5z82rhbtbfrfxfbdxe", ticket: null, expires: "2026-11-19", system: "devops" }
|
|
13991
14000
|
};
|
|
@@ -14012,7 +14021,7 @@ function checkFlags(files, registry, today = new Date().toISOString().slice(0, 1
|
|
|
14012
14021
|
}
|
|
14013
14022
|
const registryFile = production.find((f) => f.path.endsWith("flag-registry.generated.ts"));
|
|
14014
14023
|
const registryLine = (key) => registryFile ? lineOf(registryFile.text, Math.max(0, registryFile.text.indexOf(`"${key}":`))) : 1;
|
|
14015
|
-
const add = (file, offset,
|
|
14024
|
+
const add = (file, offset, message2) => issues.push({ file: file.path, line: lineOf(file.text, offset), message: message2 });
|
|
14016
14025
|
const referencedKeysIn = (file) => {
|
|
14017
14026
|
for (const key of registered) {
|
|
14018
14027
|
const literal = new RegExp(`(?:"|')${key.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}(?:"|')`);
|
|
@@ -14031,6 +14040,8 @@ function checkFlags(files, registry, today = new Date().toISOString().slice(0, 1
|
|
|
14031
14040
|
add(f, browserList.index + entry.index, `unregistered browser flag key "${entry[1]}"`);
|
|
14032
14041
|
}
|
|
14033
14042
|
}
|
|
14043
|
+
if (/\.generated\.[cm]?[jt]sx?$/.test(f.path))
|
|
14044
|
+
continue;
|
|
14034
14045
|
const calls = /(\.bool|\breadBrowserFlag|\buseBrowserFlag)\s*\(\s*([^,)\n]+)/g;
|
|
14035
14046
|
for (const m of f.text.matchAll(calls)) {
|
|
14036
14047
|
if (/function\s*$/.test(f.text.slice(Math.max(0, m.index - 20), m.index)))
|
|
@@ -14099,7 +14110,7 @@ async function main() {
|
|
|
14099
14110
|
else
|
|
14100
14111
|
console.log(`Feature flag registry check passed (${Object.keys(FLAGS).length} registered flags).`);
|
|
14101
14112
|
}
|
|
14102
|
-
var isTest = (path) => /(^|\/)(spec|__tests__)(\/|$)|\.(test|spec)\.[cm]?[jt]sx?$/.test(path), lineOf = (
|
|
14113
|
+
var isTest = (path) => /(^|\/)(spec|__tests__)(\/|$)|\.(test|spec)\.[cm]?[jt]sx?$/.test(path), lineOf = (text3, offset) => text3.slice(0, offset).split(`
|
|
14103
14114
|
`).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
14115
|
var init_check_flags = __esm(() => {
|
|
14105
14116
|
init_flag_registry_generated();
|
|
@@ -14297,7 +14308,7 @@ async function checkRegistrySync(ports = {}) {
|
|
|
14297
14308
|
}
|
|
14298
14309
|
async function syncFlags(ports = {}) {
|
|
14299
14310
|
const registry = ports.registry ?? registryUrl;
|
|
14300
|
-
const write = ports.write ?? ((target,
|
|
14311
|
+
const write = ports.write ?? ((target, text3) => writeFile4(target, text3));
|
|
14301
14312
|
const log = ports.log ?? console.log;
|
|
14302
14313
|
const error = ports.error ?? console.error;
|
|
14303
14314
|
const devops = await (ports.devops ?? readDevopsFlags)();
|
|
@@ -14534,12 +14545,13 @@ async function runEngineDelegation(delegation, options) {
|
|
|
14534
14545
|
}
|
|
14535
14546
|
|
|
14536
14547
|
// src/main.ts
|
|
14537
|
-
import { existsSync as existsSync4 } from "node:fs";
|
|
14548
|
+
import { existsSync as existsSync4, readFileSync as readFileSync3, unlinkSync } from "node:fs";
|
|
14538
14549
|
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";
|
|
14550
|
+
import { dirname as dirname10, join as join12, resolve as resolve11 } from "node:path";
|
|
14551
|
+
import { homedir as homedir3 } from "node:os";
|
|
14540
14552
|
import { pathToFileURL } from "node:url";
|
|
14541
14553
|
import { createHash as createHash5 } from "node:crypto";
|
|
14542
|
-
import { spawn as
|
|
14554
|
+
import { spawn as spawn5 } from "node:child_process";
|
|
14543
14555
|
import { createInterface } from "node:readline";
|
|
14544
14556
|
|
|
14545
14557
|
// ../../packages/sdk/typescript/src/operations.generated.ts
|
|
@@ -15594,8 +15606,8 @@ Idempotent. Access tokens revoked while the customer was blocked stay revoked; s
|
|
|
15594
15606
|
{
|
|
15595
15607
|
resource: "agent.agents.events",
|
|
15596
15608
|
method: "stream",
|
|
15597
|
-
summary: "Follow
|
|
15598
|
-
description: "Follow
|
|
15609
|
+
summary: "Follow an agent live",
|
|
15610
|
+
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
15611
|
http: "GET",
|
|
15600
15612
|
path: "/agent/v1/agents/{agent_id}/events/stream",
|
|
15601
15613
|
streaming: "always",
|
|
@@ -15621,6 +15633,40 @@ Idempotent. Access tokens revoked while the customer was blocked stay revoked; s
|
|
|
15621
15633
|
}
|
|
15622
15634
|
]
|
|
15623
15635
|
},
|
|
15636
|
+
{
|
|
15637
|
+
resource: "agent.agents.inbox.letters",
|
|
15638
|
+
method: "list",
|
|
15639
|
+
summary: "List an assume agent's waiting letters",
|
|
15640
|
+
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.",
|
|
15641
|
+
http: "GET",
|
|
15642
|
+
path: "/agent/v1/agents/{agent_id}/inbox/letters",
|
|
15643
|
+
streaming: "no",
|
|
15644
|
+
pagination: false,
|
|
15645
|
+
pathParams: [
|
|
15646
|
+
{
|
|
15647
|
+
name: "agent_id",
|
|
15648
|
+
sdkName: "agent_id",
|
|
15649
|
+
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_…."
|
|
15650
|
+
}
|
|
15651
|
+
],
|
|
15652
|
+
query: [
|
|
15653
|
+
{
|
|
15654
|
+
name: "unread",
|
|
15655
|
+
type: "boolean",
|
|
15656
|
+
enum: [
|
|
15657
|
+
true
|
|
15658
|
+
],
|
|
15659
|
+
required: false,
|
|
15660
|
+
description: "Only true is accepted, which is also the default; this read lists waiting (unread) letters and nothing else."
|
|
15661
|
+
},
|
|
15662
|
+
{
|
|
15663
|
+
name: "limit",
|
|
15664
|
+
type: "integer",
|
|
15665
|
+
required: false,
|
|
15666
|
+
description: "How many of the newest unread letters to return, 1 to 50 (default 20); unread always counts every waiting letter."
|
|
15667
|
+
}
|
|
15668
|
+
]
|
|
15669
|
+
},
|
|
15624
15670
|
{
|
|
15625
15671
|
resource: "agent.agents.unarchive",
|
|
15626
15672
|
method: "create",
|
|
@@ -15983,18 +16029,14 @@ Praxis extension: the preview conversion endpoint. The browser never parses an u
|
|
|
15983
16029
|
description: "Computer id (cmp_...), as returned by computers.create or computers.list."
|
|
15984
16030
|
}
|
|
15985
16031
|
],
|
|
15986
|
-
query: [
|
|
15987
|
-
|
|
15988
|
-
|
|
15989
|
-
|
|
15990
|
-
|
|
15991
|
-
|
|
15992
|
-
|
|
15993
|
-
|
|
15994
|
-
description: "Name of the entry or object."
|
|
15995
|
-
}
|
|
15996
|
-
]
|
|
15997
|
-
}
|
|
16032
|
+
query: [
|
|
16033
|
+
{
|
|
16034
|
+
name: "path",
|
|
16035
|
+
type: "string",
|
|
16036
|
+
required: true,
|
|
16037
|
+
description: "Absolute path of the document on the computer, for example /home/user/workspace/deck.pptx. The request has no body."
|
|
16038
|
+
}
|
|
16039
|
+
]
|
|
15998
16040
|
},
|
|
15999
16041
|
{
|
|
16000
16042
|
resource: "agent.computers.leases",
|
|
@@ -16986,6 +17028,68 @@ delete it. Omit the field to preserve.`
|
|
|
16986
17028
|
],
|
|
16987
17029
|
query: []
|
|
16988
17030
|
},
|
|
17031
|
+
{
|
|
17032
|
+
resource: "agent.sessions.artifacts",
|
|
17033
|
+
method: "list",
|
|
17034
|
+
summary: "List Session Artifacts (Extension)",
|
|
17035
|
+
description: `List the files this session delivered; an end-customer token reads its own session.
|
|
17036
|
+
|
|
17037
|
+
Own-face extension. Returns { data: Artifact[] } ordered by create_time. Each artifact is one file in the session outputs directory, or one canvas or media asset the reply pointed at (a part with kind object carrying object_type, object_id and href; one artifact per object, pointing at it again adds no version), with id, name, version, parts, source_hrefs, create_time and update_time. Delivering the same path again keeps the id and adds one to version. Files are captured seconds after the turn ends, so artifacts appear after session.status_idle; also watch the agent.artifact_delivered event. Whoever may read the session may read its artifacts; a session that is missing or not yours returns 404.`,
|
|
17038
|
+
http: "GET",
|
|
17039
|
+
path: "/agent/v1/sessions/{session_id}/artifacts",
|
|
17040
|
+
streaming: "no",
|
|
17041
|
+
pagination: false,
|
|
17042
|
+
pathParams: [
|
|
17043
|
+
{
|
|
17044
|
+
name: "session_id",
|
|
17045
|
+
sdkName: "session_id",
|
|
17046
|
+
description: "Session id from session creation or listing."
|
|
17047
|
+
}
|
|
17048
|
+
],
|
|
17049
|
+
query: []
|
|
17050
|
+
},
|
|
17051
|
+
{
|
|
17052
|
+
resource: "agent.sessions.artifacts.contentUrl",
|
|
17053
|
+
method: "create",
|
|
17054
|
+
summary: "Create Artifact Content URL (Extension)",
|
|
17055
|
+
description: `Mint a short-lived download address for one file of an artifact.
|
|
17056
|
+
|
|
17057
|
+
Own-face extension. The body is optional: part (index into the artifact parts, default 0) and ttl_seconds (60 to 300, default 300). Returns { url, expire_time }. The address works for minutes; do not store or log it. For an object part the address serves a snapshot picture of a canvas or the own bytes of the asset; an object that no longer exists returns 404 ARTIFACT_NOT_FOUND and a failing share service returns 502. An unknown artifact or an out-of-range part returns 404 ARTIFACT_NOT_FOUND, a session that is missing or not yours returns 404, and a ttl_seconds outside 60 to 300 returns 400.`,
|
|
17058
|
+
http: "POST",
|
|
17059
|
+
path: "/agent/v1/sessions/{session_id}/artifacts/{artifact_id}/content_url",
|
|
17060
|
+
streaming: "no",
|
|
17061
|
+
pagination: false,
|
|
17062
|
+
pathParams: [
|
|
17063
|
+
{
|
|
17064
|
+
name: "session_id",
|
|
17065
|
+
sdkName: "session_id",
|
|
17066
|
+
description: "Session id from session creation or listing."
|
|
17067
|
+
},
|
|
17068
|
+
{
|
|
17069
|
+
name: "artifact_id",
|
|
17070
|
+
sdkName: "artifact_id",
|
|
17071
|
+
description: "Artifact id (art_...) from the artifact list or an agent.artifact_delivered event."
|
|
17072
|
+
}
|
|
17073
|
+
],
|
|
17074
|
+
query: [],
|
|
17075
|
+
body: {
|
|
17076
|
+
required: false,
|
|
17077
|
+
fields: [
|
|
17078
|
+
{
|
|
17079
|
+
name: "part",
|
|
17080
|
+
type: "integer",
|
|
17081
|
+
required: false,
|
|
17082
|
+
description: "Index into the artifact's parts; defaults to 0."
|
|
17083
|
+
},
|
|
17084
|
+
{
|
|
17085
|
+
name: "ttl_seconds",
|
|
17086
|
+
type: "integer",
|
|
17087
|
+
required: false,
|
|
17088
|
+
description: "How long the address works, 60 to 300 seconds; defaults to 300."
|
|
17089
|
+
}
|
|
17090
|
+
]
|
|
17091
|
+
}
|
|
17092
|
+
},
|
|
16989
17093
|
{
|
|
16990
17094
|
resource: "agent.sessions.backgroundTasks",
|
|
16991
17095
|
method: "list",
|
|
@@ -17169,7 +17273,7 @@ Praxis extension available only on /agent/v1, following Claude Agent SDK getCont
|
|
|
17169
17273
|
resource: "agent.sessions.events",
|
|
17170
17274
|
method: "list",
|
|
17171
17275
|
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.",
|
|
17276
|
+
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
17277
|
http: "GET",
|
|
17174
17278
|
path: "/agent/v1/sessions/{session_id}/events",
|
|
17175
17279
|
streaming: "no",
|
|
@@ -17328,6 +17432,26 @@ Available only on /agent/v1. Use the message_id field from own-face events, not
|
|
|
17328
17432
|
]
|
|
17329
17433
|
}
|
|
17330
17434
|
},
|
|
17435
|
+
{
|
|
17436
|
+
resource: "agent.sessions.requests",
|
|
17437
|
+
method: "list",
|
|
17438
|
+
summary: "List Session Requests (Extension)",
|
|
17439
|
+
description: `List the requests a session is waiting on; an end-customer token reads its own session.
|
|
17440
|
+
|
|
17441
|
+
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.`,
|
|
17442
|
+
http: "GET",
|
|
17443
|
+
path: "/agent/v1/sessions/{session_id}/requests",
|
|
17444
|
+
streaming: "no",
|
|
17445
|
+
pagination: false,
|
|
17446
|
+
pathParams: [
|
|
17447
|
+
{
|
|
17448
|
+
name: "session_id",
|
|
17449
|
+
sdkName: "session_id",
|
|
17450
|
+
description: "Session id from session creation or listing."
|
|
17451
|
+
}
|
|
17452
|
+
],
|
|
17453
|
+
query: []
|
|
17454
|
+
},
|
|
17331
17455
|
{
|
|
17332
17456
|
resource: "agent.sessions.resources",
|
|
17333
17457
|
method: "list",
|
|
@@ -25380,6 +25504,12 @@ Published at https://docs.deepraxis.com/docs/developers/cut/script-reference wit
|
|
|
25380
25504
|
- \`RippleDeleteRange\` — Cut a time range and close the gap.
|
|
25381
25505
|
- \`DeleteWords\` — Cut transcript words and ripple every track, keeping a breath.
|
|
25382
25506
|
- \`RemoveFillers\` — List and delete filler words by media's own labels; dryRun first.
|
|
25507
|
+
- \`Matte\` — Replace the clip's background with media's matte of its source, read as a luma mask.
|
|
25508
|
+
- \`EnhanceVoice\` — Replace a clip's sound with media's enhanced speech on its own audio track.
|
|
25509
|
+
- \`AlignByAudio\` — Line two recordings of the same sound up by media's measurement of their offset.
|
|
25510
|
+
- \`Reframe\` — Swap the clip's media for media's reframed take at the aspect you ask for.
|
|
25511
|
+
- \`Upscale\` — Swap the clip's media for media's upscaled take at the height you ask for.
|
|
25512
|
+
- \`Redact\` — Pixelate the faces, QR codes or text media marks, leaving the rest of the frame plain.
|
|
25383
25513
|
- \`AddTrack\` — Add a video, audio or caption track.
|
|
25384
25514
|
- \`MoveTrack\` — Move a track between layers; 0 is the topmost.
|
|
25385
25515
|
- \`UpdateTrack\` — Change a track's name, lock, gain or role.
|
|
@@ -25483,6 +25613,9 @@ Published at https://docs.deepraxis.com/docs/developers/cut/script-reference wit
|
|
|
25483
25613
|
- \`MEDIA_OFFLINE\` — The asset cannot be fetched right now.
|
|
25484
25614
|
- \`MEDIA_UNAVAILABLE\` — The asset is not usable for rendering.
|
|
25485
25615
|
- \`MEDIA_IMPORT_FAILED\` — Importing media failed.
|
|
25616
|
+
- \`MEDIA_PROCESSING\` — Media is still processing the clip; wait for the job and rerun.
|
|
25617
|
+
- \`MEDIA_PROCESSING_FAILED\` — Media's processing job failed; nothing changed.
|
|
25618
|
+
- \`ALIGNMENT_UNCERTAIN\` — \`AlignByAudio\` confidence too low; nothing changed.
|
|
25486
25619
|
- \`FRAME_OUT_OF_RANGE\` — The preview time is outside the project.
|
|
25487
25620
|
- \`PROJECT_TOO_LARGE\` — The project exceeds the size limit.
|
|
25488
25621
|
- \`RESPONSE_TOO_LARGE\` — The response would exceed its budget.
|
|
@@ -27006,7 +27139,7 @@ The default is return=minimal: success returns HTTP 201 with an empty body. Send
|
|
|
27006
27139
|
resource: "devops.flags",
|
|
27007
27140
|
method: "archive",
|
|
27008
27141
|
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
|
|
27142
|
+
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
27143
|
http: "POST",
|
|
27011
27144
|
path: "/devops/v1/flags/{id}:archive",
|
|
27012
27145
|
streaming: "no",
|
|
@@ -27870,6 +28003,42 @@ The default is return=minimal: success returns HTTP 201 with an empty body. Send
|
|
|
27870
28003
|
}
|
|
27871
28004
|
}
|
|
27872
28005
|
},
|
|
28006
|
+
{
|
|
28007
|
+
resource: "devops.projects.flags",
|
|
28008
|
+
method: "reportCodeRefs",
|
|
28009
|
+
summary: "Report a project's flag code references",
|
|
28010
|
+
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.",
|
|
28011
|
+
http: "POST",
|
|
28012
|
+
path: "/devops/v1/projects/{project}/flags/code-refs",
|
|
28013
|
+
streaming: "no",
|
|
28014
|
+
pagination: false,
|
|
28015
|
+
pathParams: [
|
|
28016
|
+
{
|
|
28017
|
+
name: "project",
|
|
28018
|
+
sdkName: "project",
|
|
28019
|
+
description: "Identifies the project whose data you are reading, from the project list or create answer."
|
|
28020
|
+
}
|
|
28021
|
+
],
|
|
28022
|
+
query: [],
|
|
28023
|
+
body: {
|
|
28024
|
+
required: true,
|
|
28025
|
+
fields: [
|
|
28026
|
+
{
|
|
28027
|
+
name: "scannedCommit",
|
|
28028
|
+
type: "string",
|
|
28029
|
+
required: true,
|
|
28030
|
+
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."
|
|
28031
|
+
},
|
|
28032
|
+
{
|
|
28033
|
+
name: "refs",
|
|
28034
|
+
type: "array",
|
|
28035
|
+
itemType: "object",
|
|
28036
|
+
required: true,
|
|
28037
|
+
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."
|
|
28038
|
+
}
|
|
28039
|
+
]
|
|
28040
|
+
}
|
|
28041
|
+
},
|
|
27873
28042
|
{
|
|
27874
28043
|
resource: "devops.projects.promotions",
|
|
27875
28044
|
method: "list",
|
|
@@ -29806,7 +29975,7 @@ The default is return=minimal: success returns HTTP 201 with an empty body. Send
|
|
|
29806
29975
|
resource: "devops.units",
|
|
29807
29976
|
method: "push",
|
|
29808
29977
|
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
|
|
29978
|
+
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
29979
|
http: "POST",
|
|
29811
29980
|
path: "/devops/v1/units/{id}:push",
|
|
29812
29981
|
streaming: "no",
|
|
@@ -30142,7 +30311,7 @@ The default is return=minimal: success returns HTTP 201 with an empty body. Send
|
|
|
30142
30311
|
resource: "file.uploads",
|
|
30143
30312
|
method: "createSigned",
|
|
30144
30313
|
summary: "Create a one-time upload URL",
|
|
30145
|
-
description: "Upload a local file of up to 20 GiB from a coding agent without sending bytes through the model. Provide filename (the stored basename), exact byte count and MIME type. Up to 104857600 bytes, PUT the file to url with curl -T photo.png -H 'Content-Type: image/png' '<url>'; success returns 201 with the file object, and reuse returns 410 CAPABILITY_USED. Above that threshold, split the file into part_size chunks (default 64000000 bytes) and PUT each chunk to its numbered parts[].url in any order; an interrupted client GETs status_url to see the received parts and resends only what is missing, then POSTs complete_url without a body. Part PUTs return 200; completion returns 201 with the file object, including its state, or 400 if a part is missing. A processing file can be polled with files.retrieve until active. Identical part bytes may be retried; changed bytes at the same number return 400. Completion reuse returns 410 CAPABILITY_USED. Each PUT requires the exact signed Content-Length; single-PUT Content-Type must match content_type or be omitted. Expired, revoked, invalid
|
|
30314
|
+
description: "Upload a local file of up to 20 GiB from a coding agent without sending bytes through the model. Provide filename (the stored basename), exact byte count and MIME type. Up to 104857600 bytes, PUT the file to url with curl -T photo.png -H 'Content-Type: image/png' '<url>'; success returns 201 with the file object, and reuse returns 410 CAPABILITY_USED. Above that threshold, split the file into part_size chunks (default 64000000 bytes) and PUT each chunk to its numbered parts[].url in any order; an interrupted client GETs status_url to see the received parts and resends only what is missing, then POSTs complete_url without a body. Part PUTs return 200; completion returns 201 with the file object, including its state, or 400 if a part is missing. A processing file can be polled with files.retrieve until active. Identical part bytes may be retried; changed bytes at the same number return 400. Completion reuse returns 410 CAPABILITY_USED. Each PUT requires the exact signed Content-Length; single-PUT Content-Type must match content_type or be omitted. Expired, revoked, invalid or cross-organization URLs return 404, and so does a link whose upload record no longer exists. A URL that is authentic but names another action returns 403 CAPABILITY_MISMATCH: a status link posted to complete_url answers it, and so does a completion link fetched as status_url. URL lifetime defaults to 900 seconds for single PUT or 604800 (7 days) for multipart, at most 604800; all multipart URLs, including status_url, share an expiry. Multipart creation reserves storage quota. Issuance requires the same unscoped credential as direct file creation. Each issuance creates a new upload and is not idempotent. Example body: {\"filename\":\"photo.png\",\"bytes\":2048,\"content_type\":\"image/png\"}.",
|
|
30146
30315
|
http: "POST",
|
|
30147
30316
|
path: "/file/v1/uploads/signed",
|
|
30148
30317
|
streaming: "no",
|
|
@@ -31712,11 +31881,57 @@ The default is return=minimal: success returns HTTP 201 with an empty body. Send
|
|
|
31712
31881
|
]
|
|
31713
31882
|
}
|
|
31714
31883
|
},
|
|
31884
|
+
{
|
|
31885
|
+
resource: "media.libraries.assets.align",
|
|
31886
|
+
method: "create",
|
|
31887
|
+
summary: "Align asset",
|
|
31888
|
+
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}.",
|
|
31889
|
+
http: "POST",
|
|
31890
|
+
path: "/media/v1/libraries/{library_id}/assets/{asset_id}/align",
|
|
31891
|
+
streaming: "no",
|
|
31892
|
+
pagination: false,
|
|
31893
|
+
pathParams: [
|
|
31894
|
+
{
|
|
31895
|
+
name: "library_id",
|
|
31896
|
+
sdkName: "library_id",
|
|
31897
|
+
description: "Library ID returned by creation."
|
|
31898
|
+
},
|
|
31899
|
+
{
|
|
31900
|
+
name: "asset_id",
|
|
31901
|
+
sdkName: "asset_id",
|
|
31902
|
+
description: "32-character asset ID."
|
|
31903
|
+
}
|
|
31904
|
+
],
|
|
31905
|
+
query: [],
|
|
31906
|
+
body: {
|
|
31907
|
+
required: true,
|
|
31908
|
+
fields: [
|
|
31909
|
+
{
|
|
31910
|
+
name: "reference_asset_id",
|
|
31911
|
+
type: "string",
|
|
31912
|
+
required: true,
|
|
31913
|
+
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."
|
|
31914
|
+
},
|
|
31915
|
+
{
|
|
31916
|
+
name: "max_offset_seconds",
|
|
31917
|
+
type: "number",
|
|
31918
|
+
required: false,
|
|
31919
|
+
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."
|
|
31920
|
+
},
|
|
31921
|
+
{
|
|
31922
|
+
name: "idempotency_key",
|
|
31923
|
+
type: "string",
|
|
31924
|
+
required: false,
|
|
31925
|
+
description: "Stable key so a retried request reuses the same job instead of analysing and charging again; reusing it with different content is rejected."
|
|
31926
|
+
}
|
|
31927
|
+
]
|
|
31928
|
+
}
|
|
31929
|
+
},
|
|
31715
31930
|
{
|
|
31716
31931
|
resource: "media.assets",
|
|
31717
31932
|
method: "edit",
|
|
31718
31933
|
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
|
|
31934
|
+
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
31935
|
http: "POST",
|
|
31721
31936
|
path: "/media/v1/libraries/{library_id}/assets/{asset_id}/edits",
|
|
31722
31937
|
streaming: "no",
|
|
@@ -31741,7 +31956,7 @@ The default is return=minimal: success returns HTTP 201 with an empty body. Send
|
|
|
31741
31956
|
name: "operation",
|
|
31742
31957
|
type: "object",
|
|
31743
31958
|
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."
|
|
31959
|
+
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
31960
|
},
|
|
31746
31961
|
{
|
|
31747
31962
|
name: "model",
|
|
@@ -34774,6 +34989,7 @@ for more details.`
|
|
|
34774
34989
|
"openai.images.generations",
|
|
34775
34990
|
"openai.responses",
|
|
34776
34991
|
"openai.videos",
|
|
34992
|
+
"praxis.media.process",
|
|
34777
34993
|
"praxis.video.matting",
|
|
34778
34994
|
"typesafe.systemone",
|
|
34779
34995
|
"volcengine.music",
|
|
@@ -40449,6 +40665,131 @@ for more details.`
|
|
|
40449
40665
|
]
|
|
40450
40666
|
}
|
|
40451
40667
|
},
|
|
40668
|
+
{
|
|
40669
|
+
resource: "share.permissions",
|
|
40670
|
+
method: "list",
|
|
40671
|
+
summary: "List shares",
|
|
40672
|
+
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.",
|
|
40673
|
+
http: "GET",
|
|
40674
|
+
path: "/share/v1/permissions",
|
|
40675
|
+
streaming: "no",
|
|
40676
|
+
pagination: false,
|
|
40677
|
+
pathParams: [],
|
|
40678
|
+
query: [
|
|
40679
|
+
{
|
|
40680
|
+
name: "resource_type",
|
|
40681
|
+
type: "string",
|
|
40682
|
+
enum: [
|
|
40683
|
+
"file",
|
|
40684
|
+
"artifact",
|
|
40685
|
+
"canvas",
|
|
40686
|
+
"media_asset"
|
|
40687
|
+
],
|
|
40688
|
+
required: false,
|
|
40689
|
+
description: "Only shares of this object type; file, canvas and media_asset create today."
|
|
40690
|
+
},
|
|
40691
|
+
{
|
|
40692
|
+
name: "resource_id",
|
|
40693
|
+
type: "string",
|
|
40694
|
+
required: false,
|
|
40695
|
+
description: "Only shares of the object with this id, for example a file id from the File API or a media asset's library_id/asset_id; combine with resource_type."
|
|
40696
|
+
},
|
|
40697
|
+
{
|
|
40698
|
+
name: "status",
|
|
40699
|
+
type: "string",
|
|
40700
|
+
enum: [
|
|
40701
|
+
"active",
|
|
40702
|
+
"expired",
|
|
40703
|
+
"revoked"
|
|
40704
|
+
],
|
|
40705
|
+
required: false,
|
|
40706
|
+
description: "Only shares in this state; omit to list every state."
|
|
40707
|
+
},
|
|
40708
|
+
{
|
|
40709
|
+
name: "page_size",
|
|
40710
|
+
type: "integer",
|
|
40711
|
+
required: false,
|
|
40712
|
+
description: "Maximum shares in one page, from 1 to 100; defaults to 50."
|
|
40713
|
+
},
|
|
40714
|
+
{
|
|
40715
|
+
name: "page_token",
|
|
40716
|
+
type: "string",
|
|
40717
|
+
required: false,
|
|
40718
|
+
description: "Opaque next_page_token from the preceding page with the same filters; omit on the first request."
|
|
40719
|
+
}
|
|
40720
|
+
]
|
|
40721
|
+
},
|
|
40722
|
+
{
|
|
40723
|
+
resource: "share.permissions",
|
|
40724
|
+
method: "create",
|
|
40725
|
+
summary: "Create share",
|
|
40726
|
+
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.",
|
|
40727
|
+
http: "POST",
|
|
40728
|
+
path: "/share/v1/permissions",
|
|
40729
|
+
streaming: "no",
|
|
40730
|
+
pagination: false,
|
|
40731
|
+
pathParams: [],
|
|
40732
|
+
query: [],
|
|
40733
|
+
body: {
|
|
40734
|
+
required: true,
|
|
40735
|
+
fields: [
|
|
40736
|
+
{
|
|
40737
|
+
name: "resource",
|
|
40738
|
+
type: "object",
|
|
40739
|
+
required: true,
|
|
40740
|
+
description: "The object a share exposes, named by a type and an id."
|
|
40741
|
+
},
|
|
40742
|
+
{
|
|
40743
|
+
name: "expire_time",
|
|
40744
|
+
type: "string",
|
|
40745
|
+
required: false,
|
|
40746
|
+
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."
|
|
40747
|
+
},
|
|
40748
|
+
{
|
|
40749
|
+
name: "prevents_download",
|
|
40750
|
+
type: "boolean",
|
|
40751
|
+
required: false,
|
|
40752
|
+
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."
|
|
40753
|
+
}
|
|
40754
|
+
]
|
|
40755
|
+
}
|
|
40756
|
+
},
|
|
40757
|
+
{
|
|
40758
|
+
resource: "share.permissions",
|
|
40759
|
+
method: "delete",
|
|
40760
|
+
summary: "Delete share",
|
|
40761
|
+
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.",
|
|
40762
|
+
http: "DELETE",
|
|
40763
|
+
path: "/share/v1/permissions/{id}",
|
|
40764
|
+
streaming: "no",
|
|
40765
|
+
pagination: false,
|
|
40766
|
+
pathParams: [
|
|
40767
|
+
{
|
|
40768
|
+
name: "id",
|
|
40769
|
+
sdkName: "id",
|
|
40770
|
+
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."
|
|
40771
|
+
}
|
|
40772
|
+
],
|
|
40773
|
+
query: []
|
|
40774
|
+
},
|
|
40775
|
+
{
|
|
40776
|
+
resource: "share.permissions",
|
|
40777
|
+
method: "retrieve",
|
|
40778
|
+
summary: "Retrieve share",
|
|
40779
|
+
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.",
|
|
40780
|
+
http: "GET",
|
|
40781
|
+
path: "/share/v1/permissions/{id}",
|
|
40782
|
+
streaming: "no",
|
|
40783
|
+
pagination: false,
|
|
40784
|
+
pathParams: [
|
|
40785
|
+
{
|
|
40786
|
+
name: "id",
|
|
40787
|
+
sdkName: "id",
|
|
40788
|
+
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."
|
|
40789
|
+
}
|
|
40790
|
+
],
|
|
40791
|
+
query: []
|
|
40792
|
+
},
|
|
40452
40793
|
{
|
|
40453
40794
|
resource: "studio.codexes",
|
|
40454
40795
|
method: "list",
|
|
@@ -46923,6 +47264,19 @@ var getAgentConsolidation = (options) => (options.client ?? client).get({
|
|
|
46923
47264
|
url: "/agent/v1/agents/{agent_id}/consolidations/{consolidation_id}",
|
|
46924
47265
|
...options
|
|
46925
47266
|
});
|
|
47267
|
+
var listAgentInboxLetters = (options) => (options.client ?? client).get({
|
|
47268
|
+
security: [{
|
|
47269
|
+
key: "BearerAuth",
|
|
47270
|
+
scheme: "bearer",
|
|
47271
|
+
type: "http"
|
|
47272
|
+
}, {
|
|
47273
|
+
key: "ApiKeyAuth",
|
|
47274
|
+
name: "X-API-Key",
|
|
47275
|
+
type: "apiKey"
|
|
47276
|
+
}],
|
|
47277
|
+
url: "/agent/v1/agents/{agent_id}/inbox/letters",
|
|
47278
|
+
...options
|
|
47279
|
+
});
|
|
46926
47280
|
var applyAgentVersion = (options) => (options.client ?? client).post({
|
|
46927
47281
|
security: [{
|
|
46928
47282
|
key: "BearerAuth",
|
|
@@ -47275,11 +47629,7 @@ var computersFilesConvert = (options) => (options.client ?? client).post({
|
|
|
47275
47629
|
type: "apiKey"
|
|
47276
47630
|
}],
|
|
47277
47631
|
url: "/agent/v1/computers/{computer_id}/files/convert",
|
|
47278
|
-
...options
|
|
47279
|
-
headers: {
|
|
47280
|
-
"Content-Type": "application/json",
|
|
47281
|
-
...options.headers
|
|
47282
|
-
}
|
|
47632
|
+
...options
|
|
47283
47633
|
});
|
|
47284
47634
|
var connectComputer = (options) => (options.client ?? client).post({
|
|
47285
47635
|
security: [{
|
|
@@ -47367,6 +47717,49 @@ var forkSession = (options) => (options.client ?? client).post({
|
|
|
47367
47717
|
...options.headers
|
|
47368
47718
|
}
|
|
47369
47719
|
});
|
|
47720
|
+
var listSessionArtifacts = (options) => (options.client ?? client).get({
|
|
47721
|
+
security: [{
|
|
47722
|
+
key: "BearerAuth",
|
|
47723
|
+
scheme: "bearer",
|
|
47724
|
+
type: "http"
|
|
47725
|
+
}, {
|
|
47726
|
+
key: "ApiKeyAuth",
|
|
47727
|
+
name: "X-API-Key",
|
|
47728
|
+
type: "apiKey"
|
|
47729
|
+
}],
|
|
47730
|
+
url: "/agent/v1/sessions/{session_id}/artifacts",
|
|
47731
|
+
...options
|
|
47732
|
+
});
|
|
47733
|
+
var createSessionArtifactContentUrl = (options) => (options.client ?? client).post({
|
|
47734
|
+
security: [{
|
|
47735
|
+
key: "BearerAuth",
|
|
47736
|
+
scheme: "bearer",
|
|
47737
|
+
type: "http"
|
|
47738
|
+
}, {
|
|
47739
|
+
key: "ApiKeyAuth",
|
|
47740
|
+
name: "X-API-Key",
|
|
47741
|
+
type: "apiKey"
|
|
47742
|
+
}],
|
|
47743
|
+
url: "/agent/v1/sessions/{session_id}/artifacts/{artifact_id}/content_url",
|
|
47744
|
+
...options,
|
|
47745
|
+
headers: {
|
|
47746
|
+
"Content-Type": "application/json",
|
|
47747
|
+
...options.headers
|
|
47748
|
+
}
|
|
47749
|
+
});
|
|
47750
|
+
var listSessionRequests = (options) => (options.client ?? client).get({
|
|
47751
|
+
security: [{
|
|
47752
|
+
key: "BearerAuth",
|
|
47753
|
+
scheme: "bearer",
|
|
47754
|
+
type: "http"
|
|
47755
|
+
}, {
|
|
47756
|
+
key: "ApiKeyAuth",
|
|
47757
|
+
name: "X-API-Key",
|
|
47758
|
+
type: "apiKey"
|
|
47759
|
+
}],
|
|
47760
|
+
url: "/agent/v1/sessions/{session_id}/requests",
|
|
47761
|
+
...options
|
|
47762
|
+
});
|
|
47370
47763
|
var listSessionBackgroundTasks = (options) => (options.client ?? client).get({
|
|
47371
47764
|
security: [{
|
|
47372
47765
|
key: "BearerAuth",
|
|
@@ -53251,6 +53644,19 @@ var devopsFlagsCreate = (options) => (options.client ?? client).post({
|
|
|
53251
53644
|
...options.headers
|
|
53252
53645
|
}
|
|
53253
53646
|
});
|
|
53647
|
+
var devopsFlagsReportCodeRefs = (options) => (options.client ?? client).post({
|
|
53648
|
+
security: [{
|
|
53649
|
+
key: "devops-bearerAuth",
|
|
53650
|
+
scheme: "bearer",
|
|
53651
|
+
type: "http"
|
|
53652
|
+
}],
|
|
53653
|
+
url: "/devops/v1/projects/{project}/flags/code-refs",
|
|
53654
|
+
...options,
|
|
53655
|
+
headers: {
|
|
53656
|
+
"Content-Type": "application/json",
|
|
53657
|
+
...options.headers
|
|
53658
|
+
}
|
|
53659
|
+
});
|
|
53254
53660
|
var devopsFlagsGet = (options) => (options.client ?? client).get({
|
|
53255
53661
|
security: [{
|
|
53256
53662
|
key: "devops-bearerAuth",
|
|
@@ -54464,6 +54870,19 @@ var mediaGetGenerationCapabilities = (options) => (options?.client ?? client).ge
|
|
|
54464
54870
|
url: "/media/v1/generation/capabilities",
|
|
54465
54871
|
...options
|
|
54466
54872
|
});
|
|
54873
|
+
var mediaAlignAsset = (options) => (options.client ?? client).post({
|
|
54874
|
+
security: [{
|
|
54875
|
+
key: "media-BearerAuth",
|
|
54876
|
+
scheme: "bearer",
|
|
54877
|
+
type: "http"
|
|
54878
|
+
}],
|
|
54879
|
+
url: "/media/v1/libraries/{library_id}/assets/{asset_id}/align",
|
|
54880
|
+
...options,
|
|
54881
|
+
headers: {
|
|
54882
|
+
"Content-Type": "application/json",
|
|
54883
|
+
...options.headers
|
|
54884
|
+
}
|
|
54885
|
+
});
|
|
54467
54886
|
var ontologyListTypes = (options) => (options?.client ?? client).get({
|
|
54468
54887
|
security: [{
|
|
54469
54888
|
key: "ontology-bearerAuth",
|
|
@@ -55596,6 +56015,46 @@ var searchMap = (options) => (options.client ?? client).post({
|
|
|
55596
56015
|
...options.headers
|
|
55597
56016
|
}
|
|
55598
56017
|
});
|
|
56018
|
+
var shareListPermissions = (options) => (options?.client ?? client).get({
|
|
56019
|
+
security: [{
|
|
56020
|
+
key: "share-bearerAuth",
|
|
56021
|
+
scheme: "bearer",
|
|
56022
|
+
type: "http"
|
|
56023
|
+
}],
|
|
56024
|
+
url: "/share/v1/permissions",
|
|
56025
|
+
...options
|
|
56026
|
+
});
|
|
56027
|
+
var shareCreatePermission = (options) => (options.client ?? client).post({
|
|
56028
|
+
security: [{
|
|
56029
|
+
key: "share-bearerAuth",
|
|
56030
|
+
scheme: "bearer",
|
|
56031
|
+
type: "http"
|
|
56032
|
+
}],
|
|
56033
|
+
url: "/share/v1/permissions",
|
|
56034
|
+
...options,
|
|
56035
|
+
headers: {
|
|
56036
|
+
"Content-Type": "application/json",
|
|
56037
|
+
...options.headers
|
|
56038
|
+
}
|
|
56039
|
+
});
|
|
56040
|
+
var shareDeletePermission = (options) => (options.client ?? client).delete({
|
|
56041
|
+
security: [{
|
|
56042
|
+
key: "share-bearerAuth",
|
|
56043
|
+
scheme: "bearer",
|
|
56044
|
+
type: "http"
|
|
56045
|
+
}],
|
|
56046
|
+
url: "/share/v1/permissions/{id}",
|
|
56047
|
+
...options
|
|
56048
|
+
});
|
|
56049
|
+
var shareRetrievePermission = (options) => (options.client ?? client).get({
|
|
56050
|
+
security: [{
|
|
56051
|
+
key: "share-bearerAuth",
|
|
56052
|
+
scheme: "bearer",
|
|
56053
|
+
type: "http"
|
|
56054
|
+
}],
|
|
56055
|
+
url: "/share/v1/permissions/{id}",
|
|
56056
|
+
...options
|
|
56057
|
+
});
|
|
55599
56058
|
var studioGenresList = (options) => (options?.client ?? client).get({
|
|
55600
56059
|
security: [{
|
|
55601
56060
|
key: "BearerAuth",
|
|
@@ -57632,6 +58091,11 @@ function createAgent(transport) {
|
|
|
57632
58091
|
send: bind(transport, sendAgentEvents),
|
|
57633
58092
|
stream: bindStream(transport, streamAgentEvents)
|
|
57634
58093
|
},
|
|
58094
|
+
inbox: {
|
|
58095
|
+
letters: {
|
|
58096
|
+
list: bind(transport, listAgentInboxLetters)
|
|
58097
|
+
}
|
|
58098
|
+
},
|
|
57635
58099
|
list: bind(transport, agentsList),
|
|
57636
58100
|
retrieve: bind(transport, agentsRetrieve),
|
|
57637
58101
|
retrieveAppearance: bind(transport, getAgentAppearance),
|
|
@@ -57696,6 +58160,12 @@ function createAgent(transport) {
|
|
|
57696
58160
|
},
|
|
57697
58161
|
sessions: {
|
|
57698
58162
|
archive: bind(transport, sessionsArchive),
|
|
58163
|
+
artifacts: {
|
|
58164
|
+
contentUrl: {
|
|
58165
|
+
create: bind(transport, createSessionArtifactContentUrl)
|
|
58166
|
+
},
|
|
58167
|
+
list: bind(transport, listSessionArtifacts)
|
|
58168
|
+
},
|
|
57699
58169
|
backgroundTasks: {
|
|
57700
58170
|
list: bind(transport, listSessionBackgroundTasks),
|
|
57701
58171
|
retrieveOutput: bind(transport, getSessionBackgroundTaskOutput),
|
|
@@ -57714,6 +58184,9 @@ function createAgent(transport) {
|
|
|
57714
58184
|
},
|
|
57715
58185
|
fork: bind(transport, forkSession),
|
|
57716
58186
|
list: bind(transport, sessionsList),
|
|
58187
|
+
requests: {
|
|
58188
|
+
list: bind(transport, listSessionRequests)
|
|
58189
|
+
},
|
|
57717
58190
|
resources: {
|
|
57718
58191
|
create: bind(transport, sessionsResourcesAdd),
|
|
57719
58192
|
delete: bind(transport, aliasOperation(sessionsResourcesDelete, { query: { session_id: "query_session_id" } })),
|
|
@@ -58226,7 +58699,8 @@ function createDevops(transport) {
|
|
|
58226
58699
|
},
|
|
58227
58700
|
flags: {
|
|
58228
58701
|
create: bind(transport, devopsFlagsCreate),
|
|
58229
|
-
list: bind(transport, devopsFlagsList)
|
|
58702
|
+
list: bind(transport, devopsFlagsList),
|
|
58703
|
+
reportCodeRefs: bind(transport, devopsFlagsReportCodeRefs)
|
|
58230
58704
|
},
|
|
58231
58705
|
list: bind(transport, devopsProjectsList),
|
|
58232
58706
|
promotions: {
|
|
@@ -58430,6 +58904,9 @@ function createMedia(transport) {
|
|
|
58430
58904
|
},
|
|
58431
58905
|
libraries: {
|
|
58432
58906
|
assets: {
|
|
58907
|
+
align: {
|
|
58908
|
+
create: bind(transport, mediaAlignAsset)
|
|
58909
|
+
},
|
|
58433
58910
|
batch: bind(transport, mediaBatchAssets),
|
|
58434
58911
|
create: bind(transport, (options) => mediaUploadAsset({ ...options, bodySerializer: multipartBodySerializer, headers: { "Content-Type": null, ...options.headers } })),
|
|
58435
58912
|
delete: bind(transport, mediaDeleteAsset),
|
|
@@ -58871,6 +59348,16 @@ function createSearch(transport) {
|
|
|
58871
59348
|
}
|
|
58872
59349
|
};
|
|
58873
59350
|
}
|
|
59351
|
+
function createShare(transport) {
|
|
59352
|
+
return {
|
|
59353
|
+
permissions: {
|
|
59354
|
+
create: bind(transport, shareCreatePermission),
|
|
59355
|
+
delete: bind(transport, shareDeletePermission),
|
|
59356
|
+
list: bind(transport, shareListPermissions),
|
|
59357
|
+
retrieve: bind(transport, shareRetrievePermission)
|
|
59358
|
+
}
|
|
59359
|
+
};
|
|
59360
|
+
}
|
|
58874
59361
|
function createStudio(transport) {
|
|
58875
59362
|
return {
|
|
58876
59363
|
codexes: {
|
|
@@ -59141,6 +59628,7 @@ var resourceFactories = {
|
|
|
59141
59628
|
organization: createOrganization,
|
|
59142
59629
|
sandbox: createSandbox,
|
|
59143
59630
|
search: createSearch,
|
|
59631
|
+
share: createShare,
|
|
59144
59632
|
studio: createStudio,
|
|
59145
59633
|
ticket: createTicket,
|
|
59146
59634
|
vault: createVault
|
|
@@ -60958,7 +61446,7 @@ function help(commands, prefix, command) {
|
|
|
60958
61446
|
...[...operationOptions(command.op), ...bodyDataOption(command.op), ...globalOptions].map((s) => ` ${describeOption(s, s.required && fieldRequired(command.op, s, s.location ?? "query"))}`),
|
|
60959
61447
|
...command.op.body?.fields.filter((f) => !operationOptions(command.op).some((s) => s.location === "body" && s.field === f) && (f.type === "object" || f.type === "array" && !["string", "number", "integer", "boolean"].includes(f.itemType ?? ""))).map((f) => ` --data: ${f.name} (${f.type}${f.required ? ", required" : ""})`) ?? [],
|
|
60960
61448
|
" -h is an alias of --help",
|
|
60961
|
-
"PRAXIS_ENV=develop
|
|
61449
|
+
"PRAXIS_ENV=production|develop (default: production; develop must be named); no --env option.",
|
|
60962
61450
|
"",
|
|
60963
61451
|
"Examples:",
|
|
60964
61452
|
` ${example(command)}`
|
|
@@ -60970,7 +61458,7 @@ function help(commands, prefix, command) {
|
|
|
60970
61458
|
"Global options:",
|
|
60971
61459
|
...globalOptions.map((s) => ` ${describeOption(s)}`),
|
|
60972
61460
|
" -h is an alias of --help",
|
|
60973
|
-
"PRAXIS_ENV=develop
|
|
61461
|
+
"PRAXIS_ENV=production|develop (default: production; develop must be named); no --env option.",
|
|
60974
61462
|
""
|
|
60975
61463
|
];
|
|
60976
61464
|
const sample = matching.find((c) => c.words.at(-1) === "list") ?? matching[0];
|
|
@@ -61417,30 +61905,31 @@ var workflows = [
|
|
|
61417
61905
|
{
|
|
61418
61906
|
words: ["devops", "flag", "refs"],
|
|
61419
61907
|
requires: "checkout",
|
|
61420
|
-
usage: "devops flag refs [key]",
|
|
61421
|
-
summary: "Where each flag key is referenced in this checkout: file and line, for every registered key or one named key.",
|
|
61422
|
-
example: "praxis devops flag refs",
|
|
61908
|
+
usage: "devops flag refs [key] [--report --project <dvp_…>]",
|
|
61909
|
+
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.",
|
|
61910
|
+
example: "praxis devops flag refs --report --project dvp_…",
|
|
61423
61911
|
examples: [
|
|
61424
61912
|
"praxis devops flag refs",
|
|
61425
|
-
"praxis devops flag refs run-page-v2"
|
|
61913
|
+
"praxis devops flag refs run-page-v2",
|
|
61914
|
+
"praxis devops flag refs --report --project dvp_…"
|
|
61426
61915
|
],
|
|
61427
61916
|
group: "local",
|
|
61428
|
-
network: "
|
|
61429
|
-
platform: "
|
|
61917
|
+
network: "Offline. --report: needs a login and sends this checkout's references to the platform",
|
|
61918
|
+
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).",
|
|
61430
61919
|
docs: "https://docs.deepraxis.com/docs/cli"
|
|
61431
61920
|
},
|
|
61432
61921
|
{
|
|
61433
61922
|
words: ["devops", "flag", "remove"],
|
|
61434
61923
|
requires: "checkout",
|
|
61435
61924
|
usage: "devops flag remove <key>",
|
|
61436
|
-
summary: "The local step of removing a flag: list the remaining references, or the steps that follow once none remain. Order:
|
|
61925
|
+
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.",
|
|
61437
61926
|
example: "praxis devops flag remove run-page-v2",
|
|
61438
61927
|
examples: [
|
|
61439
61928
|
"praxis devops flag remove run-page-v2"
|
|
61440
61929
|
],
|
|
61441
61930
|
group: "local",
|
|
61442
61931
|
network: "offline",
|
|
61443
|
-
platform: "praxis api devops flag archive — retires the flag on the platform after the code that named it is deployed away
|
|
61932
|
+
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).",
|
|
61444
61933
|
docs: "https://docs.deepraxis.com/docs/cli"
|
|
61445
61934
|
},
|
|
61446
61935
|
{
|
|
@@ -61457,6 +61946,41 @@ var workflows = [
|
|
|
61457
61946
|
platform: "praxis api devops project change create — the platform creates and names a Change; the CLI only lands its branch (ADR-125 §5).",
|
|
61458
61947
|
docs: "https://docs.deepraxis.com/docs/cli"
|
|
61459
61948
|
},
|
|
61949
|
+
{
|
|
61950
|
+
words: ["agent", "events", "wait"],
|
|
61951
|
+
usage: "agent events wait [--timeout <seconds>]",
|
|
61952
|
+
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.",
|
|
61953
|
+
example: "PRAXIS_ASSUME_AGENT=R1M9TQ2X praxis agent events wait",
|
|
61954
|
+
network: "online"
|
|
61955
|
+
},
|
|
61956
|
+
{
|
|
61957
|
+
words: ["agent", "memory"],
|
|
61958
|
+
usage: "agent memory [--hook SessionStart|UserPromptSubmit]",
|
|
61959
|
+
summary: "Print your assume agent's memory as it stands now (PRAXIS_ASSUME_AGENT): who it is, its post, manager, duties and the charters it works under, drawn from its organization. With --hook it reads the Claude Code hook input on stdin and prints the hook's JSON: the whole memory at SessionStart, only what is new since that session last read it at UserPromptSubmit; it never fails the hook.",
|
|
61960
|
+
example: "praxis agent memory",
|
|
61961
|
+
network: "online"
|
|
61962
|
+
},
|
|
61963
|
+
{
|
|
61964
|
+
words: ["agent", "recall"],
|
|
61965
|
+
usage: "agent recall [--words <w,w>] [--handles <id,id>]",
|
|
61966
|
+
summary: "Recall from your assume agent's memory: with no flags, what else comes to mind; with words, what was filed under them; with handles, that entry and its original.",
|
|
61967
|
+
example: "praxis agent recall --words 章程,运维部",
|
|
61968
|
+
network: "online"
|
|
61969
|
+
},
|
|
61970
|
+
{
|
|
61971
|
+
words: ["agent", "remember"],
|
|
61972
|
+
usage: "agent remember --text <experience> [--about <id,id>]",
|
|
61973
|
+
summary: "Keep an experience in your assume agent's memory: it is consolidated in the background like a lived conversation, and recall finds it afterwards.",
|
|
61974
|
+
example: 'praxis agent remember --text "Sean 定了副总裁用钩子载入认知"',
|
|
61975
|
+
network: "online"
|
|
61976
|
+
},
|
|
61977
|
+
{
|
|
61978
|
+
words: ["agent", "events", "channel"],
|
|
61979
|
+
usage: "agent events channel",
|
|
61980
|
+
summary: "Run as a Claude Code channel (a stdio MCP server declaring claude/channel, no tools): pushes the waiting letters once, then every new letter and new memory of your assume agent (PRAXIS_ASSUME_AGENT, default R1M9TQ2X) into the running session. Started by the assume-agent plugin, not by hand; stdout carries MCP frames only, logs go to stderr.",
|
|
61981
|
+
example: "claude --dangerously-load-development-channels plugin:assume-agent@deepraxis",
|
|
61982
|
+
network: "online"
|
|
61983
|
+
},
|
|
61460
61984
|
{ 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"' },
|
|
61461
61985
|
{ words: ["skill"], usage: "skill [--install <dir>]", summary: "Print the AI skill, or write <dir>/praxis-cli/SKILL.md." },
|
|
61462
61986
|
{
|
|
@@ -61526,7 +62050,7 @@ function workflowHelp(workflow, options) {
|
|
|
61526
62050
|
"Options:",
|
|
61527
62051
|
...[...options, ...globalOptions].map((s) => ` ${describeOption(s)}`),
|
|
61528
62052
|
" -h is an alias of --help",
|
|
61529
|
-
"PRAXIS_ENV=develop
|
|
62053
|
+
"PRAXIS_ENV=production|develop (default: production; develop must be named); no --env option.",
|
|
61530
62054
|
...workflow.requires === "checkout" ? [`Requires: ${CHECKOUT_REQUIREMENT}`] : [],
|
|
61531
62055
|
...workflow.notes?.length ? ["", ...workflow.notes] : [],
|
|
61532
62056
|
...workflow.network ? ["", `Network: ${workflow.network}`] : [],
|
|
@@ -63049,6 +63573,101 @@ function wranglerEdges(nodes) {
|
|
|
63049
63573
|
}
|
|
63050
63574
|
return edges;
|
|
63051
63575
|
}
|
|
63576
|
+
// ../../packages/praxis/deploy-core/src/lambda-function.ts
|
|
63577
|
+
var LAMBDA_FUNCTIONS_ROOT = "services/lambda/functions";
|
|
63578
|
+
var UPSTREAM = "aliyun-fc";
|
|
63579
|
+
var RECIPE_PATH = /^services\/lambda\/functions\/([^/]+)\/function\.json$/;
|
|
63580
|
+
var isText = (value) => typeof value === "string" && value !== "";
|
|
63581
|
+
var isCount = (value, min, max) => typeof value === "number" && Number.isInteger(value) && value >= min && value <= max;
|
|
63582
|
+
function lambdaFunctionOf(text) {
|
|
63583
|
+
const parsed = text === null ? null : parseJsonc2(text);
|
|
63584
|
+
if (parsed === null)
|
|
63585
|
+
return null;
|
|
63586
|
+
if (!isText(parsed.name) || !isText(parsed.upstream))
|
|
63587
|
+
return null;
|
|
63588
|
+
if (!Array.isArray(parsed.regions) || parsed.regions.length === 0 || !parsed.regions.every(isText))
|
|
63589
|
+
return null;
|
|
63590
|
+
if (parsed.gpu !== undefined && !isText(parsed.gpu))
|
|
63591
|
+
return null;
|
|
63592
|
+
if (!isCount(parsed.cpu, 1, 256))
|
|
63593
|
+
return null;
|
|
63594
|
+
if (!isCount(parsed.memoryMb, 128, 32 * 1024))
|
|
63595
|
+
return null;
|
|
63596
|
+
if (!isCount(parsed.timeoutSeconds, 1, 24 * 3600))
|
|
63597
|
+
return null;
|
|
63598
|
+
if (!isCount(parsed.concurrency, 1, 1024))
|
|
63599
|
+
return null;
|
|
63600
|
+
return {
|
|
63601
|
+
name: parsed.name,
|
|
63602
|
+
upstream: parsed.upstream,
|
|
63603
|
+
regions: [...parsed.regions],
|
|
63604
|
+
...parsed.gpu === undefined ? {} : { gpu: parsed.gpu },
|
|
63605
|
+
cpu: parsed.cpu,
|
|
63606
|
+
memoryMb: parsed.memoryMb,
|
|
63607
|
+
timeoutSeconds: parsed.timeoutSeconds,
|
|
63608
|
+
concurrency: parsed.concurrency
|
|
63609
|
+
};
|
|
63610
|
+
}
|
|
63611
|
+
function lambdaFunctionTarget(recipe) {
|
|
63612
|
+
return { path: `${LAMBDA_FUNCTIONS_ROOT}/${recipe.name}`, name: `lambda-${recipe.name}` };
|
|
63613
|
+
}
|
|
63614
|
+
function lambdaFunctionOwner(path) {
|
|
63615
|
+
return path.split("/").slice(0, -2).join("/");
|
|
63616
|
+
}
|
|
63617
|
+
async function scanRecipes(facts) {
|
|
63618
|
+
const found = [];
|
|
63619
|
+
const warnings = [];
|
|
63620
|
+
for (const path of [...facts.tree].sort()) {
|
|
63621
|
+
const match = RECIPE_PATH.exec(path);
|
|
63622
|
+
if (match === null)
|
|
63623
|
+
continue;
|
|
63624
|
+
const dir = path.slice(0, -"/function.json".length);
|
|
63625
|
+
const recipe = lambdaFunctionOf(await facts.read(path));
|
|
63626
|
+
if (recipe === null) {
|
|
63627
|
+
warnings.push(`${dir}: function.json is not a recipe`);
|
|
63628
|
+
continue;
|
|
63629
|
+
}
|
|
63630
|
+
if (recipe.upstream !== UPSTREAM)
|
|
63631
|
+
continue;
|
|
63632
|
+
if (recipe.name !== match[1]) {
|
|
63633
|
+
warnings.push(`${dir}: function.json names ${JSON.stringify(recipe.name)}, not the directory name`);
|
|
63634
|
+
continue;
|
|
63635
|
+
}
|
|
63636
|
+
found.push(recipe);
|
|
63637
|
+
}
|
|
63638
|
+
return { found, warnings };
|
|
63639
|
+
}
|
|
63640
|
+
function lambdaFunctionProvider(_options = {}) {
|
|
63641
|
+
return {
|
|
63642
|
+
id: "lambda-function",
|
|
63643
|
+
async detect(facts) {
|
|
63644
|
+
return (await scanRecipes(facts)).found.length > 0 ? "certain" : "none";
|
|
63645
|
+
},
|
|
63646
|
+
async plan(facts, partial) {
|
|
63647
|
+
const claimed = new Set(partial.targets.map((target) => target.path));
|
|
63648
|
+
const scan = await scanRecipes(facts);
|
|
63649
|
+
const targets = [];
|
|
63650
|
+
const byOwner = new Map;
|
|
63651
|
+
for (const recipe of scan.found) {
|
|
63652
|
+
const { path, name } = lambdaFunctionTarget(recipe);
|
|
63653
|
+
if (claimed.has(path))
|
|
63654
|
+
continue;
|
|
63655
|
+
targets.push({ path, name, destination: "aliyun-fc", production: true, onTrain: true });
|
|
63656
|
+
const owner = lambdaFunctionOwner(path);
|
|
63657
|
+
byOwner.set(owner, [...byOwner.get(owner) ?? [], path]);
|
|
63658
|
+
}
|
|
63659
|
+
const refined = partial.targets.map((target) => {
|
|
63660
|
+
const paths = byOwner.get(target.path);
|
|
63661
|
+
return paths === undefined ? target : { ...target, dependsOn: [...new Set([...target.dependsOn ?? [], ...paths])] };
|
|
63662
|
+
});
|
|
63663
|
+
return {
|
|
63664
|
+
targets: [...refined, ...targets],
|
|
63665
|
+
...scan.warnings.length === 0 ? {} : { warnings: [...partial.warnings ?? [], ...scan.warnings] }
|
|
63666
|
+
};
|
|
63667
|
+
}
|
|
63668
|
+
};
|
|
63669
|
+
}
|
|
63670
|
+
var lambdaFunction = lambdaFunctionProvider();
|
|
63052
63671
|
// ../../packages/praxis/deploy-core/src/package-manifest.ts
|
|
63053
63672
|
function packageManifestOf(text) {
|
|
63054
63673
|
const parsed = text === null ? null : parseJsonc2(text);
|
|
@@ -63383,7 +64002,11 @@ function workspaceCloudflareProvider(options = {}) {
|
|
|
63383
64002
|
};
|
|
63384
64003
|
}
|
|
63385
64004
|
var workspaceCloudflare = workspaceCloudflareProvider();
|
|
63386
|
-
var BUILTIN_PROVIDERS = [
|
|
64005
|
+
var BUILTIN_PROVIDERS = [
|
|
64006
|
+
workspaceCloudflare,
|
|
64007
|
+
workspaceNpmProvider(),
|
|
64008
|
+
lambdaFunctionProvider()
|
|
64009
|
+
];
|
|
63387
64010
|
function directoriesOfPackageNames(workspaces) {
|
|
63388
64011
|
const byName = new Map;
|
|
63389
64012
|
for (const workspace of workspaces)
|
|
@@ -63410,15 +64033,23 @@ function workspaceClosureOf(target, byName, dependenciesOf) {
|
|
|
63410
64033
|
// ../../packages/praxis/deploy-core/src/plan.ts
|
|
63411
64034
|
async function planRepository(facts, providers = BUILTIN_PROVIDERS, options = {}) {
|
|
63412
64035
|
let partial = { targets: [] };
|
|
64036
|
+
const warnings = [];
|
|
63413
64037
|
for (const provider of providers) {
|
|
63414
64038
|
const confidence = await provider.detect(facts);
|
|
63415
64039
|
if (confidence === "none")
|
|
63416
64040
|
continue;
|
|
63417
64041
|
partial = await provider.plan(facts, partial);
|
|
64042
|
+
for (const warning of partial.warnings ?? [])
|
|
64043
|
+
if (!warnings.includes(warning))
|
|
64044
|
+
warnings.push(warning);
|
|
63418
64045
|
}
|
|
63419
64046
|
const drafts = partial.targets.filter((draft) => draft.deploy !== false);
|
|
63420
64047
|
const workspaces = await readWorkspaces(facts, options);
|
|
63421
|
-
return {
|
|
64048
|
+
return {
|
|
64049
|
+
commit: facts.commit,
|
|
64050
|
+
targets: closePlan(drafts, workspaces),
|
|
64051
|
+
...warnings.length === 0 ? {} : { warnings }
|
|
64052
|
+
};
|
|
63422
64053
|
}
|
|
63423
64054
|
function closePlan(drafts, workspaces) {
|
|
63424
64055
|
const configOf = new Map(workspaces.map((workspace) => [workspace.dir, workspace.config]));
|
|
@@ -63440,7 +64071,7 @@ function closePlan(drafts, workspaces) {
|
|
|
63440
64071
|
path: draft.path,
|
|
63441
64072
|
name: draft.name,
|
|
63442
64073
|
destination: draft.destination,
|
|
63443
|
-
dependsOn: edges.get(draft.path) ?? [],
|
|
64074
|
+
dependsOn: [...new Set([...edges.get(draft.path) ?? [], ...draft.dependsOn ?? []])],
|
|
63444
64075
|
...draft.environments === undefined ? {} : { environments: draft.environments },
|
|
63445
64076
|
production: draft.production === true,
|
|
63446
64077
|
onTrain: draft.onTrain !== false,
|
|
@@ -65436,6 +66067,30 @@ function bunTestRun(packagePath, code, output) {
|
|
|
65436
66067
|
}
|
|
65437
66068
|
|
|
65438
66069
|
// src/commands/devops-test.ts
|
|
66070
|
+
import { spawn as spawn4 } from "node:child_process";
|
|
66071
|
+
var CACHE_OFF_REEXEC_ENV = "PRAXIS_DEVOPS_TEST_CACHE_OFF";
|
|
66072
|
+
function needsCacheOffReexec(env) {
|
|
66073
|
+
return env.BUN_RUNTIME_TRANSPILER_CACHE_PATH !== "0" && !env[CACHE_OFF_REEXEC_ENV];
|
|
66074
|
+
}
|
|
66075
|
+
function isDevopsTestRun(words) {
|
|
66076
|
+
return words.join(" ") === "devops test";
|
|
66077
|
+
}
|
|
66078
|
+
function spawnInherit(cmd, args, options) {
|
|
66079
|
+
return new Promise((resolveCode) => {
|
|
66080
|
+
const child = spawn4(cmd, [...args], { cwd: options.cwd, env: options.env, stdio: "inherit" });
|
|
66081
|
+
child.once("error", (error) => {
|
|
66082
|
+
console.error(error instanceof Error ? error.message : String(error));
|
|
66083
|
+
resolveCode(1);
|
|
66084
|
+
});
|
|
66085
|
+
child.once("close", (code) => resolveCode(code ?? 1));
|
|
66086
|
+
});
|
|
66087
|
+
}
|
|
66088
|
+
function reexecWithCacheOff(options = {}) {
|
|
66089
|
+
return (options.spawn ?? spawnInherit)(process.execPath, options.argv ?? process.argv.slice(1), {
|
|
66090
|
+
cwd: options.cwd ?? process.cwd(),
|
|
66091
|
+
env: { ...options.env ?? process.env, BUN_RUNTIME_TRANSPILER_CACHE_PATH: "0", [CACHE_OFF_REEXEC_ENV]: "1" }
|
|
66092
|
+
});
|
|
66093
|
+
}
|
|
65439
66094
|
async function devopsTest(flags, paths, ports) {
|
|
65440
66095
|
const plan = planTest(flags, paths);
|
|
65441
66096
|
if (plan.mode.kind === "affected")
|
|
@@ -65706,8 +66361,8 @@ async function localEngine(cwd) {
|
|
|
65706
66361
|
})
|
|
65707
66362
|
};
|
|
65708
66363
|
}
|
|
65709
|
-
async function localCheckout(cwd,
|
|
65710
|
-
const git2 = (args) =>
|
|
66364
|
+
async function localCheckout(cwd, spawn5) {
|
|
66365
|
+
const git2 = (args) => spawn5("git", [...args], { cwd });
|
|
65711
66366
|
const required = async (args) => {
|
|
65712
66367
|
const result = await git2(args);
|
|
65713
66368
|
if (result.code !== 0)
|
|
@@ -65758,7 +66413,7 @@ async function localCheckout(cwd, spawn4) {
|
|
|
65758
66413
|
await walk(packagePath);
|
|
65759
66414
|
return files;
|
|
65760
66415
|
},
|
|
65761
|
-
runTests: (packagePath, files) =>
|
|
66416
|
+
runTests: (packagePath, files) => spawn5("nice", ["-n", "10", "bun", "test", ...files], { cwd: packagePath })
|
|
65762
66417
|
};
|
|
65763
66418
|
}
|
|
65764
66419
|
async function withEngineStdoutOnStderr(body) {
|
|
@@ -65935,7 +66590,7 @@ function removalSteps(key) {
|
|
|
65935
66590
|
`No code references ${key}. The rest is not this command's to do:`,
|
|
65936
66591
|
` 1. Deploy the code that removed the references (deploy never writes the trunk).`,
|
|
65937
66592
|
` 2. Retire the flag on the platform: praxis api devops flag archive <flg_…> — the terminal state.`,
|
|
65938
|
-
` Archiving keeps the key reserved and
|
|
66593
|
+
` 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).`,
|
|
65939
66594
|
` 3. Regenerate the registry: praxis devops flag sync`
|
|
65940
66595
|
].join(`
|
|
65941
66596
|
`);
|
|
@@ -65965,6 +66620,25 @@ async function repositoryRoot(cwd, read) {
|
|
|
65965
66620
|
dir = parent;
|
|
65966
66621
|
}
|
|
65967
66622
|
}
|
|
66623
|
+
var SNIPPET_LIMIT = 200;
|
|
66624
|
+
function snippetOf(text2, line) {
|
|
66625
|
+
const trimmed = (text2.split(`
|
|
66626
|
+
`)[line - 1] ?? "").trim();
|
|
66627
|
+
return trimmed.length > SNIPPET_LIMIT ? trimmed.slice(0, SNIPPET_LIMIT) : trimmed;
|
|
66628
|
+
}
|
|
66629
|
+
function reportedKeys(keys, sources, refs) {
|
|
66630
|
+
const texts = new Map(sources.map((file) => [file.path, file.text]));
|
|
66631
|
+
return keys.map((flagKey) => ({
|
|
66632
|
+
flagKey,
|
|
66633
|
+
items: refs.filter((ref) => ref.key === flagKey).map((ref) => ({ path: ref.file, line: ref.line, snippet: snippetOf(texts.get(ref.file) ?? "", ref.line) }))
|
|
66634
|
+
}));
|
|
66635
|
+
}
|
|
66636
|
+
function reportNeedsProject() {
|
|
66637
|
+
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.");
|
|
66638
|
+
}
|
|
66639
|
+
function reportClientMissing() {
|
|
66640
|
+
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.");
|
|
66641
|
+
}
|
|
65968
66642
|
async function codeSources(ports, registry) {
|
|
65969
66643
|
const suffix = registry.replace(/^\.\//, "");
|
|
65970
66644
|
return (await ports.sources()).filter((file) => !file.path.replace(/^\.\//, "").endsWith(suffix));
|
|
@@ -66021,15 +66695,33 @@ async function devopsFlagScaffold(key, args, ports) {
|
|
|
66021
66695
|
ports.emit({ kind: "object", data: { key, registry, file, call: scaffoldCall(key) } });
|
|
66022
66696
|
return 0;
|
|
66023
66697
|
}
|
|
66024
|
-
async function devopsFlagRefs(key, ports) {
|
|
66698
|
+
async function devopsFlagRefs(key, args, ports) {
|
|
66025
66699
|
const registry = await registryOf(ports);
|
|
66026
66700
|
const flags = await ports.loadRegistry(registry);
|
|
66027
66701
|
const keys = key !== undefined ? [key] : Object.keys(flags).sort();
|
|
66028
|
-
const
|
|
66702
|
+
const sources = await codeSources(ports, registry);
|
|
66703
|
+
const refs = flagReferences(sources, keys);
|
|
66029
66704
|
for (const ref of refs)
|
|
66030
66705
|
ports.human(`${ref.file}:${ref.line}: ${ref.key}`);
|
|
66031
66706
|
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.`);
|
|
66032
|
-
|
|
66707
|
+
if (!args.report) {
|
|
66708
|
+
ports.emit({ kind: "object", data: { refs, reported: false } });
|
|
66709
|
+
return 0;
|
|
66710
|
+
}
|
|
66711
|
+
const project = args.project;
|
|
66712
|
+
if (project === undefined || project === "")
|
|
66713
|
+
throw reportNeedsProject();
|
|
66714
|
+
const scannedCommit = (await ports.git(["rev-parse", "HEAD"])).trim();
|
|
66715
|
+
if (scannedCommit === "")
|
|
66716
|
+
throw new UsageError("git rev-parse HEAD answered no commit", "Run this command inside a git repository.");
|
|
66717
|
+
const payload = reportedKeys(Object.keys(flags).sort(), sources, refs);
|
|
66718
|
+
const client2 = await ports.client();
|
|
66719
|
+
const report = client2.devops?.projects?.flags?.reportCodeRefs;
|
|
66720
|
+
if (typeof report !== "function")
|
|
66721
|
+
throw reportClientMissing();
|
|
66722
|
+
const answer = await report.call(client2.devops.projects.flags, { path: { project }, body: { scannedCommit, refs: payload } });
|
|
66723
|
+
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(", ")}` : ""}.`);
|
|
66724
|
+
ports.emit({ kind: "object", data: { refs, reported: true, project, scannedCommit, updated: answer.updated, unknownKeys: answer.unknownKeys } });
|
|
66033
66725
|
return 0;
|
|
66034
66726
|
}
|
|
66035
66727
|
async function devopsFlagRemove(key, ports) {
|
|
@@ -68679,6 +69371,7 @@ var FILE_ID = /^file-/;
|
|
|
68679
69371
|
var asRecord = (value) => value !== null && typeof value === "object" && !Array.isArray(value) ? value : undefined;
|
|
68680
69372
|
var isImage = (node2) => node2.type === "image" && typeof node2.url === "string";
|
|
68681
69373
|
var isRef = (node2) => node2.type === "ref" && typeof node2.ref === "string";
|
|
69374
|
+
var NODE_TYPES = new Set(Object.keys(KNOWN_PROPS));
|
|
68682
69375
|
function visit2(value, nodeId, fn) {
|
|
68683
69376
|
if (Array.isArray(value)) {
|
|
68684
69377
|
for (const item of value)
|
|
@@ -68872,6 +69565,8 @@ var warningLine = (warning) => {
|
|
|
68872
69565
|
return `${warning.code}: ${warning.ref} at ${warning.nodeId}`;
|
|
68873
69566
|
case "FRAME_NOT_FOUND":
|
|
68874
69567
|
return `${warning.code}: ${warning.id}`;
|
|
69568
|
+
case "IMAGE_FILE_NOT_FOUND":
|
|
69569
|
+
return `${warning.code}: ${warning.url} (the platform holds no such file) at ${warning.nodeId}`;
|
|
68875
69570
|
default:
|
|
68876
69571
|
return `${warning.code}: ${warning.url}`;
|
|
68877
69572
|
}
|
|
@@ -68979,6 +69674,537 @@ async function canvasImport(args, ports) {
|
|
|
68979
69674
|
return 0;
|
|
68980
69675
|
}
|
|
68981
69676
|
|
|
69677
|
+
// src/commands/events-wait.ts
|
|
69678
|
+
var DEFAULT_AGENT = "R1M9TQ2X";
|
|
69679
|
+
var BASE_BACKOFF_MS = 1000;
|
|
69680
|
+
var MAX_BACKOFF_MS = 60000;
|
|
69681
|
+
var NOTICE_NAMED = 5;
|
|
69682
|
+
var ANNOUNCED_KEEP = 500;
|
|
69683
|
+
function assumeAgentOf(env) {
|
|
69684
|
+
return env.PRAXIS_ASSUME_AGENT?.trim() || DEFAULT_AGENT;
|
|
69685
|
+
}
|
|
69686
|
+
function sessionOf(raw) {
|
|
69687
|
+
if (raw === undefined)
|
|
69688
|
+
return null;
|
|
69689
|
+
const session = raw.trim();
|
|
69690
|
+
if (!/^[A-Za-z0-9_-]{1,128}$/.test(session))
|
|
69691
|
+
throw new Error("--session takes the Claude Code session id (letters, digits, - and _)");
|
|
69692
|
+
return session;
|
|
69693
|
+
}
|
|
69694
|
+
var keyPart = (part) => part.replace(/[^A-Za-z0-9_-]/g, "_");
|
|
69695
|
+
function waitKeyOf(env, agent, session) {
|
|
69696
|
+
return [env, agent, ...session === null ? [] : [session]].map(keyPart).join("-");
|
|
69697
|
+
}
|
|
69698
|
+
function pidOf(raw) {
|
|
69699
|
+
const pid = raw === null ? NaN : Number(raw.trim());
|
|
69700
|
+
return Number.isInteger(pid) && pid > 0 ? pid : null;
|
|
69701
|
+
}
|
|
69702
|
+
function lockDecision(recorded, self, probe) {
|
|
69703
|
+
if (recorded === null || recorded === self || probe === null || !probe.alive)
|
|
69704
|
+
return { kind: "take" };
|
|
69705
|
+
if (!/events\s+wait/.test(probe.command))
|
|
69706
|
+
return { kind: "take" };
|
|
69707
|
+
if (probe.ppid === 1)
|
|
69708
|
+
return { kind: "replace", pid: recorded };
|
|
69709
|
+
return { kind: "refuse", pid: recorded };
|
|
69710
|
+
}
|
|
69711
|
+
function alreadyWaitingNotice(pid) {
|
|
69712
|
+
return `本会话已有 praxis agent events wait 在后台等待(pid ${pid}),不用再启动。`;
|
|
69713
|
+
}
|
|
69714
|
+
async function acquireWaitLock(ports) {
|
|
69715
|
+
for (let attempt = 0;attempt < 3; attempt++) {
|
|
69716
|
+
const recorded = pidOf(await ports.readPid());
|
|
69717
|
+
if (recorded === null) {
|
|
69718
|
+
if (await ports.createPid(String(ports.self)))
|
|
69719
|
+
return null;
|
|
69720
|
+
continue;
|
|
69721
|
+
}
|
|
69722
|
+
const decision = lockDecision(recorded, ports.self, await ports.probe(recorded));
|
|
69723
|
+
if (decision.kind === "refuse")
|
|
69724
|
+
return decision.pid;
|
|
69725
|
+
if (decision.kind === "replace")
|
|
69726
|
+
ports.terminate(decision.pid);
|
|
69727
|
+
await ports.replacePid(String(ports.self));
|
|
69728
|
+
const holder = pidOf(await ports.readPid());
|
|
69729
|
+
return holder === ports.self || holder === null ? null : holder;
|
|
69730
|
+
}
|
|
69731
|
+
return pidOf(await ports.readPid());
|
|
69732
|
+
}
|
|
69733
|
+
function timeoutMsOf(raw) {
|
|
69734
|
+
if (raw === undefined)
|
|
69735
|
+
return null;
|
|
69736
|
+
const seconds = Number(raw);
|
|
69737
|
+
if (!/^\d+(\.\d+)?$/.test(raw.trim()) || !Number.isFinite(seconds) || seconds <= 0)
|
|
69738
|
+
throw new Error("--timeout takes a positive number of seconds");
|
|
69739
|
+
return Math.round(seconds * 1000);
|
|
69740
|
+
}
|
|
69741
|
+
function backoffMs(failures) {
|
|
69742
|
+
if (failures <= 0)
|
|
69743
|
+
return 0;
|
|
69744
|
+
return Math.min(MAX_BACKOFF_MS, BASE_BACKOFF_MS * 2 ** Math.min(failures - 1, 16));
|
|
69745
|
+
}
|
|
69746
|
+
function inboxLettersUrl(apiUrl, agent) {
|
|
69747
|
+
return `${apiUrl}/agent/v1/agents/${encodeURIComponent(agent)}/inbox/letters?unread=true&limit=20`;
|
|
69748
|
+
}
|
|
69749
|
+
function eventsStreamUrl(apiUrl, agent) {
|
|
69750
|
+
return `${apiUrl}/agent/v1/agents/${encodeURIComponent(agent)}/events/stream`;
|
|
69751
|
+
}
|
|
69752
|
+
function streamHeaders(auth, lastEventId) {
|
|
69753
|
+
return { ...auth, Accept: "text/event-stream", ...lastEventId === null ? {} : { "Last-Event-ID": lastEventId } };
|
|
69754
|
+
}
|
|
69755
|
+
function lettersOf(body) {
|
|
69756
|
+
const value = body;
|
|
69757
|
+
if (!value || typeof value.unread !== "number" || !Array.isArray(value.letters))
|
|
69758
|
+
throw new Error("letters answer is not { unread, letters }");
|
|
69759
|
+
const letters = value.letters.filter((letter) => typeof letter === "object" && letter !== null && typeof letter.id === "string" && typeof letter.summary === "string");
|
|
69760
|
+
return { unread: value.unread, letters };
|
|
69761
|
+
}
|
|
69762
|
+
function feedSse(buffer, chunk) {
|
|
69763
|
+
const text2 = (buffer + chunk).replace(/\r\n?/g, `
|
|
69764
|
+
`);
|
|
69765
|
+
const blocks = text2.split(`
|
|
69766
|
+
|
|
69767
|
+
`);
|
|
69768
|
+
const rest = blocks.pop() ?? "";
|
|
69769
|
+
const frames = [];
|
|
69770
|
+
for (const block of blocks) {
|
|
69771
|
+
let event, id;
|
|
69772
|
+
const data = [];
|
|
69773
|
+
for (const line of block.split(`
|
|
69774
|
+
`)) {
|
|
69775
|
+
if (line === "" || line.startsWith(":"))
|
|
69776
|
+
continue;
|
|
69777
|
+
const colon = line.indexOf(":");
|
|
69778
|
+
const field = colon < 0 ? line : line.slice(0, colon);
|
|
69779
|
+
const value = colon < 0 ? "" : line.slice(colon + 1).replace(/^ /, "");
|
|
69780
|
+
if (field === "data")
|
|
69781
|
+
data.push(value);
|
|
69782
|
+
else if (field === "event")
|
|
69783
|
+
event = value;
|
|
69784
|
+
else if (field === "id")
|
|
69785
|
+
id = value;
|
|
69786
|
+
}
|
|
69787
|
+
if (data.length)
|
|
69788
|
+
frames.push({ ...event === undefined ? {} : { event }, ...id === undefined ? {} : { id }, data: data.join(`
|
|
69789
|
+
`) });
|
|
69790
|
+
}
|
|
69791
|
+
return { buffer: rest, frames };
|
|
69792
|
+
}
|
|
69793
|
+
var text2 = (value) => typeof value === "string" && value !== "";
|
|
69794
|
+
function wakeOf(frame) {
|
|
69795
|
+
let event;
|
|
69796
|
+
try {
|
|
69797
|
+
event = JSON.parse(frame.data);
|
|
69798
|
+
} catch {
|
|
69799
|
+
return null;
|
|
69800
|
+
}
|
|
69801
|
+
if (typeof event !== "object" || event === null)
|
|
69802
|
+
return null;
|
|
69803
|
+
if (event.type === "inbox.letter_delivered" && text2(event.letter_id) && typeof event.summary === "string")
|
|
69804
|
+
return { kind: "letter", letter: {
|
|
69805
|
+
id: event.letter_id,
|
|
69806
|
+
sender: typeof event.sender === "string" ? event.sender : "",
|
|
69807
|
+
...text2(event.sender_name) ? { sender_name: event.sender_name } : {},
|
|
69808
|
+
summary: event.summary,
|
|
69809
|
+
thread: typeof event.thread === "string" ? event.thread : null,
|
|
69810
|
+
create_time: typeof event.create_time === "string" ? event.create_time : ""
|
|
69811
|
+
} };
|
|
69812
|
+
if (event.type === "cognition.ritual_held" && text2(event.title))
|
|
69813
|
+
return { kind: "ritual", ritual: {
|
|
69814
|
+
ritual: text2(event.ritual) ? event.ritual : "",
|
|
69815
|
+
owner: text2(event.owner) ? event.owner : "",
|
|
69816
|
+
title: event.title,
|
|
69817
|
+
engram: text2(event.engram) ? event.engram : ""
|
|
69818
|
+
} };
|
|
69819
|
+
return null;
|
|
69820
|
+
}
|
|
69821
|
+
function ritualNotice(ritual) {
|
|
69822
|
+
const origin = [ritual.owner, ritual.ritual].filter(Boolean).join(" 的仪式 ");
|
|
69823
|
+
return `你获得了一段新记忆:「${ritual.title}」${origin ? `(${origin}${ritual.engram ? `,${ritual.engram}` : ""})` : ""}。处理完再在后台运行 praxis agent events wait。`;
|
|
69824
|
+
}
|
|
69825
|
+
function retryableStatus(status) {
|
|
69826
|
+
return status >= 500 || status === 408 || status === 429;
|
|
69827
|
+
}
|
|
69828
|
+
function planNotice(page, announced) {
|
|
69829
|
+
const seen = new Set(announced);
|
|
69830
|
+
const fresh = page.letters.filter((letter) => !seen.has(letter.id));
|
|
69831
|
+
if (!fresh.length)
|
|
69832
|
+
return { announced };
|
|
69833
|
+
const named = fresh.slice(0, NOTICE_NAMED).map((letter) => `${letter.sender_name || letter.sender}:${letter.summary}(${letter.id})`);
|
|
69834
|
+
const more = fresh.length > NOTICE_NAMED ? `;另有 ${fresh.length - NOTICE_NAMED} 封` : "";
|
|
69835
|
+
const notice = `你有 ${fresh.length} 封新信:${named.join(";")}${more}。用 praxis_assume_inbox(action "read")读取并处理,处理完再在后台运行 praxis agent events wait。`;
|
|
69836
|
+
const next = [...announced, ...fresh.map((letter) => letter.id)];
|
|
69837
|
+
return { notice, announced: next.length > ANNOUNCED_KEEP ? next.slice(next.length - ANNOUNCED_KEEP) : next };
|
|
69838
|
+
}
|
|
69839
|
+
function waitStateOf(raw) {
|
|
69840
|
+
if (raw === null)
|
|
69841
|
+
return { announced: [], lastEventId: null };
|
|
69842
|
+
try {
|
|
69843
|
+
const value = JSON.parse(raw);
|
|
69844
|
+
return {
|
|
69845
|
+
announced: Array.isArray(value.announced) ? value.announced.filter((id) => typeof id === "string") : [],
|
|
69846
|
+
lastEventId: typeof value.last_event_id === "string" && /^\d+$/.test(value.last_event_id) ? value.last_event_id : null
|
|
69847
|
+
};
|
|
69848
|
+
} catch {
|
|
69849
|
+
return { announced: [], lastEventId: null };
|
|
69850
|
+
}
|
|
69851
|
+
}
|
|
69852
|
+
function waitStateText(state) {
|
|
69853
|
+
return JSON.stringify({ announced: state.announced, ...state.lastEventId === null ? {} : { last_event_id: state.lastEventId } });
|
|
69854
|
+
}
|
|
69855
|
+
var message = (error) => error instanceof Error ? error.message : String(error);
|
|
69856
|
+
async function runEventsWait(ports) {
|
|
69857
|
+
const stop = new AbortController;
|
|
69858
|
+
let timedOut = false;
|
|
69859
|
+
const timer = ports.timeoutMs === null ? undefined : setTimeout(() => {
|
|
69860
|
+
timedOut = true;
|
|
69861
|
+
stop.abort();
|
|
69862
|
+
}, ports.timeoutMs);
|
|
69863
|
+
const state = await ports.readState();
|
|
69864
|
+
let announced = state.announced;
|
|
69865
|
+
let lastEventId = state.lastEventId;
|
|
69866
|
+
const announceLetters = async (page) => {
|
|
69867
|
+
const planned = planNotice(page, announced);
|
|
69868
|
+
if (!planned.notice)
|
|
69869
|
+
return false;
|
|
69870
|
+
announced = planned.announced;
|
|
69871
|
+
await ports.writeState({ announced, lastEventId });
|
|
69872
|
+
ports.print(planned.notice);
|
|
69873
|
+
return true;
|
|
69874
|
+
};
|
|
69875
|
+
const announce = async () => announceLetters(await ports.fetchLetters());
|
|
69876
|
+
try {
|
|
69877
|
+
try {
|
|
69878
|
+
if (await announce())
|
|
69879
|
+
return 0;
|
|
69880
|
+
} catch (error) {
|
|
69881
|
+
ports.log(`praxis agent events wait: reading letters failed: ${message(error)}`);
|
|
69882
|
+
}
|
|
69883
|
+
ports.log(`praxis agent events wait: waiting for letters to assume agent ${ports.agent}`);
|
|
69884
|
+
let failures = 0;
|
|
69885
|
+
while (!stop.signal.aborted) {
|
|
69886
|
+
if (failures)
|
|
69887
|
+
await ports.sleep(backoffMs(failures), stop.signal);
|
|
69888
|
+
if (stop.signal.aborted)
|
|
69889
|
+
break;
|
|
69890
|
+
try {
|
|
69891
|
+
const opened = await ports.openStream(stop.signal, lastEventId);
|
|
69892
|
+
if (opened.status < 200 || opened.status >= 300 || !opened.chunks) {
|
|
69893
|
+
if (!retryableStatus(opened.status)) {
|
|
69894
|
+
ports.log(`praxis agent events wait: the event stream was refused (HTTP ${opened.status}${opened.reason ? `: ${opened.reason}` : ""})`);
|
|
69895
|
+
return 1;
|
|
69896
|
+
}
|
|
69897
|
+
throw new Error(`HTTP ${opened.status}`);
|
|
69898
|
+
}
|
|
69899
|
+
if (await announce())
|
|
69900
|
+
return 0;
|
|
69901
|
+
if (failures)
|
|
69902
|
+
ports.log("praxis agent events wait: event stream reconnected");
|
|
69903
|
+
failures = 0;
|
|
69904
|
+
let buffer = "";
|
|
69905
|
+
for await (const chunk of opened.chunks) {
|
|
69906
|
+
const fed = feedSse(buffer, chunk);
|
|
69907
|
+
buffer = fed.buffer;
|
|
69908
|
+
for (const frame of fed.frames) {
|
|
69909
|
+
const wake = wakeOf(frame);
|
|
69910
|
+
if (wake !== null && frame.id !== undefined)
|
|
69911
|
+
lastEventId = frame.id;
|
|
69912
|
+
if (wake?.kind === "letter" && await announceLetters({ unread: 1, letters: [wake.letter] }))
|
|
69913
|
+
return 0;
|
|
69914
|
+
if (wake?.kind === "ritual") {
|
|
69915
|
+
await ports.writeState({ announced, lastEventId });
|
|
69916
|
+
ports.print(ritualNotice(wake.ritual));
|
|
69917
|
+
return 0;
|
|
69918
|
+
}
|
|
69919
|
+
}
|
|
69920
|
+
}
|
|
69921
|
+
throw new Error("the event stream ended");
|
|
69922
|
+
} catch (error) {
|
|
69923
|
+
if (stop.signal.aborted)
|
|
69924
|
+
break;
|
|
69925
|
+
failures += 1;
|
|
69926
|
+
ports.log(`praxis agent events wait: ${message(error)} (${failures} in a row, reconnecting in ${backoffMs(failures) / 1000}s)`);
|
|
69927
|
+
}
|
|
69928
|
+
}
|
|
69929
|
+
if (timedOut)
|
|
69930
|
+
ports.print(`${(ports.timeoutMs ?? 0) / 1000} 秒内没有新信。需要继续等待时再在后台运行 praxis agent events wait。`);
|
|
69931
|
+
return 0;
|
|
69932
|
+
} finally {
|
|
69933
|
+
if (timer)
|
|
69934
|
+
clearTimeout(timer);
|
|
69935
|
+
stop.abort();
|
|
69936
|
+
}
|
|
69937
|
+
}
|
|
69938
|
+
|
|
69939
|
+
// src/commands/events-channel.ts
|
|
69940
|
+
var CHANNEL_SOURCE = "assume-agent";
|
|
69941
|
+
var SERVER_NAME = "assume-channel";
|
|
69942
|
+
var DEFAULT_PROTOCOL_VERSION = "2025-06-18";
|
|
69943
|
+
var BACKLOG_NAMED = 5;
|
|
69944
|
+
function channelInstructions(agent) {
|
|
69945
|
+
return [
|
|
69946
|
+
`Events from your Praxis assume agent ${agent} arrive as <channel source="${CHANNEL_SOURCE}" kind="letter" letter_id="…" sender="…">.`,
|
|
69947
|
+
'kind="letter": a letter reached the agent. The content names the sender and the summary; read the letters with the praxis_assume_inbox tool (action "read") and handle them.',
|
|
69948
|
+
'kind="ritual": the agent was given a new memory (a ritual was held); its knowledge is refreshed, nothing to reply to.',
|
|
69949
|
+
"The channel is one-way: answer through the praxis_assume_* tools, not back through the channel."
|
|
69950
|
+
].join(`
|
|
69951
|
+
`);
|
|
69952
|
+
}
|
|
69953
|
+
function initializeResult(params, agent) {
|
|
69954
|
+
const asked = params?.protocolVersion;
|
|
69955
|
+
return {
|
|
69956
|
+
protocolVersion: typeof asked === "string" ? asked : DEFAULT_PROTOCOL_VERSION,
|
|
69957
|
+
capabilities: { experimental: { "claude/channel": {} } },
|
|
69958
|
+
serverInfo: { name: SERVER_NAME, version: "0.1.0" },
|
|
69959
|
+
instructions: channelInstructions(agent)
|
|
69960
|
+
};
|
|
69961
|
+
}
|
|
69962
|
+
function replyTo(message2, agent) {
|
|
69963
|
+
if (message2.id === undefined || message2.id === null || typeof message2.method !== "string")
|
|
69964
|
+
return null;
|
|
69965
|
+
const reply = (body) => ({ jsonrpc: "2.0", id: message2.id, ...body });
|
|
69966
|
+
switch (message2.method) {
|
|
69967
|
+
case "initialize":
|
|
69968
|
+
return reply({ result: initializeResult(message2.params, agent) });
|
|
69969
|
+
case "ping":
|
|
69970
|
+
return reply({ result: {} });
|
|
69971
|
+
default:
|
|
69972
|
+
return reply({ error: { code: -32601, message: `Method not found: ${message2.method}` } });
|
|
69973
|
+
}
|
|
69974
|
+
}
|
|
69975
|
+
var sender = (letter) => letter.sender_name || letter.sender;
|
|
69976
|
+
var readHint = 'Read it with praxis_assume_inbox (action "read").';
|
|
69977
|
+
var frame = (content, meta) => ({ jsonrpc: "2.0", method: "notifications/claude/channel", params: { content, meta } });
|
|
69978
|
+
function letterNotification(letter) {
|
|
69979
|
+
return frame(`${sender(letter)}: ${letter.summary}
|
|
69980
|
+
${readHint}`, { kind: "letter", letter_id: letter.id, sender: letter.sender, ...letter.sender_name ? { sender_name: letter.sender_name } : {} });
|
|
69981
|
+
}
|
|
69982
|
+
function backlogNotification(letters) {
|
|
69983
|
+
const named = letters.slice(0, BACKLOG_NAMED).map((letter) => `${sender(letter)}: ${letter.summary} (${letter.id})`);
|
|
69984
|
+
const more = letters.length > BACKLOG_NAMED ? `; ${letters.length - BACKLOG_NAMED} more` : "";
|
|
69985
|
+
return frame(`${letters.length} unread letter(s) waiting: ${named.join("; ")}${more}
|
|
69986
|
+
${readHint}`, { kind: "letter", letter_id: letters[0].id, sender: letters[0].sender, count: String(letters.length) });
|
|
69987
|
+
}
|
|
69988
|
+
function ritualNotification(ritual) {
|
|
69989
|
+
return frame(`New memory: "${ritual.title}"${ritual.owner ? ` (${ritual.owner}${ritual.ritual ? ` ${ritual.ritual}` : ""})` : ""}. Your knowledge is refreshed.`, { kind: "ritual", ...ritual.ritual ? { ritual: ritual.ritual } : {}, ...ritual.engram ? { engram: ritual.engram } : {} });
|
|
69990
|
+
}
|
|
69991
|
+
async function runChannel(ports) {
|
|
69992
|
+
const stop = new AbortController;
|
|
69993
|
+
const seen = new Set;
|
|
69994
|
+
let lastEventId = null;
|
|
69995
|
+
let follower = null;
|
|
69996
|
+
const fresh = (letters) => letters.filter((letter) => !seen.has(letter.id) && (seen.add(letter.id), true));
|
|
69997
|
+
const catchUp = async () => {
|
|
69998
|
+
const letters = fresh((await ports.fetchLetters()).letters);
|
|
69999
|
+
if (letters.length)
|
|
70000
|
+
ports.send(backlogNotification(letters));
|
|
70001
|
+
};
|
|
70002
|
+
const follow = async () => {
|
|
70003
|
+
let failures = 0;
|
|
70004
|
+
while (!stop.signal.aborted) {
|
|
70005
|
+
if (failures)
|
|
70006
|
+
await ports.sleep(backoffMs(failures), stop.signal);
|
|
70007
|
+
if (stop.signal.aborted)
|
|
70008
|
+
break;
|
|
70009
|
+
try {
|
|
70010
|
+
const opened = await ports.openStream(stop.signal, lastEventId);
|
|
70011
|
+
if (opened.status < 200 || opened.status >= 300 || !opened.chunks) {
|
|
70012
|
+
if (!retryableStatus(opened.status)) {
|
|
70013
|
+
ports.log(`assume-channel: the event stream was refused (HTTP ${opened.status}${opened.reason ? `: ${opened.reason}` : ""})`);
|
|
70014
|
+
return;
|
|
70015
|
+
}
|
|
70016
|
+
throw new Error(`HTTP ${opened.status}`);
|
|
70017
|
+
}
|
|
70018
|
+
try {
|
|
70019
|
+
await catchUp();
|
|
70020
|
+
} catch (error) {
|
|
70021
|
+
ports.log(`assume-channel: reading letters failed: ${error instanceof Error ? error.message : error}`);
|
|
70022
|
+
}
|
|
70023
|
+
if (failures)
|
|
70024
|
+
ports.log("assume-channel: event stream reconnected");
|
|
70025
|
+
failures = 0;
|
|
70026
|
+
let buffer2 = "";
|
|
70027
|
+
for await (const chunk of opened.chunks) {
|
|
70028
|
+
const fed = feedSse(buffer2, chunk);
|
|
70029
|
+
buffer2 = fed.buffer;
|
|
70030
|
+
for (const raw of fed.frames) {
|
|
70031
|
+
const wake = wakeOf(raw);
|
|
70032
|
+
if (wake === null)
|
|
70033
|
+
continue;
|
|
70034
|
+
if (raw.id !== undefined)
|
|
70035
|
+
lastEventId = raw.id;
|
|
70036
|
+
if (wake.kind === "letter") {
|
|
70037
|
+
if (fresh([wake.letter]).length)
|
|
70038
|
+
ports.send(letterNotification(wake.letter));
|
|
70039
|
+
} else
|
|
70040
|
+
ports.send(ritualNotification(wake.ritual));
|
|
70041
|
+
}
|
|
70042
|
+
}
|
|
70043
|
+
throw new Error("the event stream ended");
|
|
70044
|
+
} catch (error) {
|
|
70045
|
+
if (stop.signal.aborted)
|
|
70046
|
+
break;
|
|
70047
|
+
failures += 1;
|
|
70048
|
+
ports.log(`assume-channel: ${error instanceof Error ? error.message : error} (${failures} in a row, reconnecting in ${backoffMs(failures) / 1000}s)`);
|
|
70049
|
+
}
|
|
70050
|
+
}
|
|
70051
|
+
};
|
|
70052
|
+
let buffer = "";
|
|
70053
|
+
const handle = (line) => {
|
|
70054
|
+
if (!line.trim())
|
|
70055
|
+
return;
|
|
70056
|
+
let message2;
|
|
70057
|
+
try {
|
|
70058
|
+
message2 = JSON.parse(line);
|
|
70059
|
+
} catch {
|
|
70060
|
+
ports.log("assume-channel: ignored a line that is not JSON");
|
|
70061
|
+
return;
|
|
70062
|
+
}
|
|
70063
|
+
const reply = replyTo(message2, ports.agent);
|
|
70064
|
+
if (reply)
|
|
70065
|
+
ports.send(reply);
|
|
70066
|
+
if (message2.method === "notifications/initialized" && follower === null)
|
|
70067
|
+
follower = follow();
|
|
70068
|
+
};
|
|
70069
|
+
for await (const chunk of ports.input) {
|
|
70070
|
+
buffer += chunk;
|
|
70071
|
+
const lines = buffer.split(`
|
|
70072
|
+
`);
|
|
70073
|
+
buffer = lines.pop() ?? "";
|
|
70074
|
+
for (const line of lines)
|
|
70075
|
+
handle(line);
|
|
70076
|
+
}
|
|
70077
|
+
handle(buffer);
|
|
70078
|
+
stop.abort();
|
|
70079
|
+
await follower;
|
|
70080
|
+
return 0;
|
|
70081
|
+
}
|
|
70082
|
+
|
|
70083
|
+
// src/commands/agent-memory.ts
|
|
70084
|
+
var MEMORY_TOOL = "praxis_assume_memory";
|
|
70085
|
+
var RECALL_TOOL = "praxis_assume_recall";
|
|
70086
|
+
var REMEMBER_TOOL = "praxis_assume_remember";
|
|
70087
|
+
function mcpUrl(apiUrl, agent) {
|
|
70088
|
+
return `${apiUrl}/agent/v1/agents/${encodeURIComponent(agent)}/mcp`;
|
|
70089
|
+
}
|
|
70090
|
+
function rpcAnswerOf(body, id) {
|
|
70091
|
+
const candidates2 = body.trimStart().startsWith("{") ? [body] : body.split(`
|
|
70092
|
+
`).filter((line) => line.startsWith("data:")).map((line) => line.slice(5).trim());
|
|
70093
|
+
for (const candidate of candidates2) {
|
|
70094
|
+
try {
|
|
70095
|
+
const parsed = JSON.parse(candidate);
|
|
70096
|
+
if (parsed.id === id)
|
|
70097
|
+
return parsed;
|
|
70098
|
+
} catch {}
|
|
70099
|
+
}
|
|
70100
|
+
return null;
|
|
70101
|
+
}
|
|
70102
|
+
function toolTextOf(result) {
|
|
70103
|
+
const value = result;
|
|
70104
|
+
const text3 = (value?.content ?? []).filter((part) => part.type === "text" && typeof part.text === "string").map((part) => part.text).join(`
|
|
70105
|
+
`).trim();
|
|
70106
|
+
return value?.isError === true ? { ok: false, reason: text3 || "the tool refused" } : { ok: true, text: text3 };
|
|
70107
|
+
}
|
|
70108
|
+
async function callAgentTool(ports, url, name, args, signal) {
|
|
70109
|
+
const base = { ...await ports.headers(), "Content-Type": "application/json", Accept: "application/json, text/event-stream" };
|
|
70110
|
+
const post = (body, session2) => ports.fetch(url, {
|
|
70111
|
+
method: "POST",
|
|
70112
|
+
headers: { ...base, ...session2 === undefined ? {} : { "Mcp-Session-Id": session2 } },
|
|
70113
|
+
body: JSON.stringify(body),
|
|
70114
|
+
...signal === undefined ? {} : { signal },
|
|
70115
|
+
redirect: "error"
|
|
70116
|
+
});
|
|
70117
|
+
const init = await post({ jsonrpc: "2.0", id: 1, method: "initialize", params: {
|
|
70118
|
+
protocolVersion: "2025-06-18",
|
|
70119
|
+
capabilities: {},
|
|
70120
|
+
clientInfo: { name: "praxis-cli-memory", version: "1" }
|
|
70121
|
+
} });
|
|
70122
|
+
const initBody = await init.text();
|
|
70123
|
+
if (!init.ok)
|
|
70124
|
+
throw new Error(`HTTP ${init.status} on initialize`);
|
|
70125
|
+
const session = init.headers.get("Mcp-Session-Id") ?? undefined;
|
|
70126
|
+
const initAnswer = rpcAnswerOf(initBody, 1);
|
|
70127
|
+
if (initAnswer?.error)
|
|
70128
|
+
throw new Error(initAnswer.error.message ?? "initialize failed");
|
|
70129
|
+
await post({ jsonrpc: "2.0", method: "notifications/initialized" }, session).then((r) => r.text()).catch(() => "");
|
|
70130
|
+
const call3 = await post({ jsonrpc: "2.0", id: 2, method: "tools/call", params: { name, arguments: args } }, session);
|
|
70131
|
+
const callBody = await call3.text();
|
|
70132
|
+
if (!call3.ok)
|
|
70133
|
+
throw new Error(`HTTP ${call3.status} on ${name}`);
|
|
70134
|
+
const answer = rpcAnswerOf(callBody, 2);
|
|
70135
|
+
if (answer === null)
|
|
70136
|
+
throw new Error(`no answer from ${name}`);
|
|
70137
|
+
if (answer.error)
|
|
70138
|
+
throw new Error(answer.error.message ?? `${name} failed`);
|
|
70139
|
+
const text3 = toolTextOf(answer.result);
|
|
70140
|
+
if (!text3.ok)
|
|
70141
|
+
throw new Error(text3.reason);
|
|
70142
|
+
return text3.text;
|
|
70143
|
+
}
|
|
70144
|
+
function memoryBodyOf(text3) {
|
|
70145
|
+
return text3.split(`
|
|
70146
|
+
`).filter((line) => {
|
|
70147
|
+
const trimmed = line.trim();
|
|
70148
|
+
return !/^shell: acon_/.test(trimmed) && !/^你有 \d+ 封未读信/.test(trimmed) && !/^You have \d+ unread letter/.test(trimmed);
|
|
70149
|
+
}).join(`
|
|
70150
|
+
`).trim();
|
|
70151
|
+
}
|
|
70152
|
+
function paragraphKey(paragraph) {
|
|
70153
|
+
return paragraph.replace(/\s*\[n\d+\]/g, "").replace(/\s+/g, " ").trim();
|
|
70154
|
+
}
|
|
70155
|
+
function newParagraphs(memory, seen) {
|
|
70156
|
+
const seenKeys = new Set([...seen].map(paragraphKey));
|
|
70157
|
+
return memory.split(/\n{2,}/).map((part) => part.trim()).filter((part) => part !== "" && !seenKeys.has(paragraphKey(part)));
|
|
70158
|
+
}
|
|
70159
|
+
var MEMORY_FRAME = (body) => `<memory source="praxis-assume" note="your memory as this agent, drawn from your organization just now; recall with praxis_assume_recall">
|
|
70160
|
+
${body}
|
|
70161
|
+
</memory>`;
|
|
70162
|
+
var MEMORY_CHANGED_FRAME = (body) => `<memory_since_start source="praxis-assume" note="what came to mind since this conversation last read your memory">
|
|
70163
|
+
${body}
|
|
70164
|
+
</memory_since_start>`;
|
|
70165
|
+
function hookOutput(event, context) {
|
|
70166
|
+
if (context === null || context.trim() === "")
|
|
70167
|
+
return null;
|
|
70168
|
+
return JSON.stringify({ hookSpecificOutput: { hookEventName: event, additionalContext: context } });
|
|
70169
|
+
}
|
|
70170
|
+
function hookInputOf(raw) {
|
|
70171
|
+
try {
|
|
70172
|
+
const parsed = JSON.parse(raw);
|
|
70173
|
+
const sessionId = typeof parsed.session_id === "string" && /^[A-Za-z0-9_-]{1,128}$/.test(parsed.session_id) ? parsed.session_id : null;
|
|
70174
|
+
return { sessionId, source: typeof parsed.source === "string" ? parsed.source : null };
|
|
70175
|
+
} catch {
|
|
70176
|
+
return { sessionId: null, source: null };
|
|
70177
|
+
}
|
|
70178
|
+
}
|
|
70179
|
+
async function runMemoryHook(event, input, ports) {
|
|
70180
|
+
try {
|
|
70181
|
+
const memory = memoryBodyOf(await callAgentTool(ports, ports.url, MEMORY_TOOL, {}, AbortSignal.timeout(ports.timeoutMs)));
|
|
70182
|
+
if (memory === "")
|
|
70183
|
+
return null;
|
|
70184
|
+
const all = newParagraphs(memory, new Set);
|
|
70185
|
+
if (event === "SessionStart") {
|
|
70186
|
+
if (input.sessionId !== null)
|
|
70187
|
+
await ports.writeSeen(input.sessionId, all).catch(() => {
|
|
70188
|
+
return;
|
|
70189
|
+
});
|
|
70190
|
+
return hookOutput(event, MEMORY_FRAME(memory));
|
|
70191
|
+
}
|
|
70192
|
+
const seen = input.sessionId === null ? [] : await ports.readSeen(input.sessionId).catch(() => []);
|
|
70193
|
+
const fresh = newParagraphs(memory, new Set(seen));
|
|
70194
|
+
if (fresh.length === 0)
|
|
70195
|
+
return null;
|
|
70196
|
+
if (input.sessionId !== null)
|
|
70197
|
+
await ports.writeSeen(input.sessionId, [...seen, ...fresh]).catch(() => {
|
|
70198
|
+
return;
|
|
70199
|
+
});
|
|
70200
|
+
return hookOutput(event, MEMORY_CHANGED_FRAME(fresh.join(`
|
|
70201
|
+
|
|
70202
|
+
`)));
|
|
70203
|
+
} catch {
|
|
70204
|
+
return null;
|
|
70205
|
+
}
|
|
70206
|
+
}
|
|
70207
|
+
|
|
68982
70208
|
// src/main.ts
|
|
68983
70209
|
import { spawnSync } from "node:child_process";
|
|
68984
70210
|
|
|
@@ -69096,15 +70322,15 @@ class ModelStream {
|
|
|
69096
70322
|
finishReason = "unknown";
|
|
69097
70323
|
usage;
|
|
69098
70324
|
add(event) {
|
|
69099
|
-
const data = streamData(event),
|
|
70325
|
+
const data = streamData(event), message2 = record(data.message), response = record(data.response);
|
|
69100
70326
|
this.chunks.push(streamText(event));
|
|
69101
70327
|
const choices = Array.isArray(data.choices) ? data.choices : [];
|
|
69102
|
-
const reason2 = choices.map((c) => record(c).finish_reason).find((r) => typeof r === "string" && r) ?? record(data.delta).stop_reason ??
|
|
70328
|
+
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;
|
|
69103
70329
|
if (typeof reason2 === "string" && reason2)
|
|
69104
70330
|
this.finishReason = reason2;
|
|
69105
70331
|
else if (["response.completed", "response.incomplete", "response.failed"].includes(String(data.type)))
|
|
69106
70332
|
this.finishReason = String(data.type).slice("response.".length);
|
|
69107
|
-
for (const usage of [
|
|
70333
|
+
for (const usage of [message2.usage, data.usage, response.usage]) {
|
|
69108
70334
|
if (usage !== null && typeof usage === "object" && !Array.isArray(usage))
|
|
69109
70335
|
this.usage = { ...this.usage, ...record(usage) };
|
|
69110
70336
|
}
|
|
@@ -69169,8 +70395,8 @@ function isSuccess(verb, ctx) {
|
|
|
69169
70395
|
}
|
|
69170
70396
|
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" };
|
|
69171
70397
|
var deleted = (verb) => /^(delete|remove|purge)(-|$)/.test(verb);
|
|
69172
|
-
function width(
|
|
69173
|
-
return [...
|
|
70398
|
+
function width(text3) {
|
|
70399
|
+
return [...text3].reduce((sum, ch) => {
|
|
69174
70400
|
const cp = ch.codePointAt(0);
|
|
69175
70401
|
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);
|
|
69176
70402
|
}, 0);
|
|
@@ -69178,13 +70404,13 @@ function width(text2) {
|
|
|
69178
70404
|
function truncate(value, size) {
|
|
69179
70405
|
if (width(value) <= size)
|
|
69180
70406
|
return value;
|
|
69181
|
-
let
|
|
70407
|
+
let text3 = "";
|
|
69182
70408
|
for (const ch of value) {
|
|
69183
|
-
if (width(
|
|
70409
|
+
if (width(text3 + ch) > size - 1)
|
|
69184
70410
|
break;
|
|
69185
|
-
|
|
70411
|
+
text3 += ch;
|
|
69186
70412
|
}
|
|
69187
|
-
return
|
|
70413
|
+
return text3 + "…";
|
|
69188
70414
|
}
|
|
69189
70415
|
function table(items, ctx, paint) {
|
|
69190
70416
|
const columns = columnsFor(items);
|
|
@@ -69217,13 +70443,13 @@ function table(items, ctx, paint) {
|
|
|
69217
70443
|
sizes[index]--;
|
|
69218
70444
|
}
|
|
69219
70445
|
const line = (row, header) => row.map((v, i) => {
|
|
69220
|
-
const
|
|
69221
|
-
let styled = header ? paint.dim(
|
|
70446
|
+
const text3 = truncate(v, sizes[i]);
|
|
70447
|
+
let styled = header ? paint.dim(text3) : text3;
|
|
69222
70448
|
if (!header && ["status", "state"].includes(columns[i])) {
|
|
69223
70449
|
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;
|
|
69224
|
-
styled = color(
|
|
70450
|
+
styled = color(text3);
|
|
69225
70451
|
}
|
|
69226
|
-
return styled + (i === row.length - 1 ? "" : " ".repeat(Math.max(0, sizes[i] - width(
|
|
70452
|
+
return styled + (i === row.length - 1 ? "" : " ".repeat(Math.max(0, sizes[i] - width(text3))));
|
|
69227
70453
|
}).join(" ");
|
|
69228
70454
|
return [line(headers, true), ...rows.map((row) => line(row, false))].join(`
|
|
69229
70455
|
`) + `
|
|
@@ -69322,9 +70548,9 @@ function renderHuman(result, ctx) {
|
|
|
69322
70548
|
}
|
|
69323
70549
|
|
|
69324
70550
|
// src/output/agent.ts
|
|
69325
|
-
function cell(
|
|
69326
|
-
const chars = [...
|
|
69327
|
-
const limited = chars.length > 500 ? chars.slice(0, 500).join("") + `…[+${chars.length - 500} chars, use --json]` :
|
|
70551
|
+
function cell(text3) {
|
|
70552
|
+
const chars = [...text3];
|
|
70553
|
+
const limited = chars.length > 500 ? chars.slice(0, 500).join("") + `…[+${chars.length - 500} chars, use --json]` : text3;
|
|
69328
70554
|
return limited.replace(/\\/g, "\\\\").replace(/\|/g, "\\|").replace(/\r?\n/g, "<br>").replace(/\r/g, "<br>");
|
|
69329
70555
|
}
|
|
69330
70556
|
function renderAgent(result, ctx) {
|
|
@@ -69335,9 +70561,9 @@ function renderAgent(result, ctx) {
|
|
|
69335
70561
|
if (modelStream(result.op)) {
|
|
69336
70562
|
if (!result.summary)
|
|
69337
70563
|
return {};
|
|
69338
|
-
const { text:
|
|
69339
|
-
return { stdout: `${
|
|
69340
|
-
`) || !
|
|
70564
|
+
const { text: text3, finish_reason, usage } = result.summary;
|
|
70565
|
+
return { stdout: `${text3}${text3.endsWith(`
|
|
70566
|
+
`) || !text3 ? "" : `
|
|
69341
70567
|
`}finish_reason: ${finish_reason}
|
|
69342
70568
|
${usage ? `usage: ${JSON.stringify(usage)}
|
|
69343
70569
|
` : ""}` };
|
|
@@ -69556,18 +70782,18 @@ function errorInput(error, ctx) {
|
|
|
69556
70782
|
const details = candidate !== null && typeof candidate === "object" && !Array.isArray(candidate) ? candidate : undefined;
|
|
69557
70783
|
const problem = serverProblem(Object.keys(nested).length ? nested : raw);
|
|
69558
70784
|
const serverText = (value) => typeof value === "string" && value.trim() ? value : undefined;
|
|
69559
|
-
let
|
|
69560
|
-
const prefix =
|
|
70785
|
+
let message2 = error instanceof Error ? error.message : "Unexpected error";
|
|
70786
|
+
const prefix = message2.match(/^([A-Z][A-Z0-9_]+):\s*/)?.[1];
|
|
69561
70787
|
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");
|
|
69562
70788
|
let stripped = false;
|
|
69563
|
-
while (
|
|
69564
|
-
|
|
70789
|
+
while (message2.startsWith(`${code}:`)) {
|
|
70790
|
+
message2 = message2.slice(code.length + 1).trimStart();
|
|
69565
70791
|
stripped = true;
|
|
69566
70792
|
}
|
|
69567
70793
|
if (stripped)
|
|
69568
|
-
|
|
70794
|
+
message2 = `${humanize(code)}${message2 ? `: ${message2}` : ""}`;
|
|
69569
70795
|
const status = sdk?.status, request_id = sdk?.requestId;
|
|
69570
|
-
|
|
70796
|
+
message2 = serverText(problem?.detail) ?? serverText(problem?.title) ?? message2;
|
|
69571
70797
|
const authFailure = status === 401 || ["NOT_LOGGED_IN", "UNAUTHENTICATED", "TOKEN_REVOKED", "LOGIN_FAILED", "MANAGED_LOGIN_EXPIRED"].includes(code);
|
|
69572
70798
|
const source = ctx.credentialSource ?? "login";
|
|
69573
70799
|
let hint3 = genericHint;
|
|
@@ -69585,19 +70811,19 @@ function errorInput(error, ctx) {
|
|
|
69585
70811
|
hint3 = "Rate limited; retry later.";
|
|
69586
70812
|
else if (status !== undefined && status >= 500)
|
|
69587
70813
|
hint3 = `Server error; retry later.${request_id ? ` Request id: ${request_id}.` : ""}`;
|
|
69588
|
-
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 } : {} };
|
|
70814
|
+
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 } : {} };
|
|
69589
70815
|
}
|
|
69590
70816
|
|
|
69591
70817
|
// src/output/progress.ts
|
|
69592
|
-
function startProgress(ctx, write = (
|
|
70818
|
+
function startProgress(ctx, write = (text3) => writeOutput({ stderr: text3 })) {
|
|
69593
70819
|
if (ctx.mode !== "human" || !ctx.stderrIsTTY)
|
|
69594
70820
|
return () => {};
|
|
69595
70821
|
let interval;
|
|
69596
|
-
let shown = false,
|
|
70822
|
+
let shown = false, frame2 = 0;
|
|
69597
70823
|
const frames = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"];
|
|
69598
70824
|
const tick = () => {
|
|
69599
70825
|
shown = true;
|
|
69600
|
-
write(`\r${frames[
|
|
70826
|
+
write(`\r${frames[frame2++ % frames.length]} Loading…`);
|
|
69601
70827
|
};
|
|
69602
70828
|
const timer = setTimeout(() => {
|
|
69603
70829
|
tick();
|
|
@@ -69615,7 +70841,7 @@ function startProgress(ctx, write = (text2) => writeOutput({ stderr: text2 })) {
|
|
|
69615
70841
|
}
|
|
69616
70842
|
|
|
69617
70843
|
// src/main.ts
|
|
69618
|
-
var version = "0.3.0-dev.
|
|
70844
|
+
var version = "0.3.0-dev.c81a93f";
|
|
69619
70845
|
var commands = commandTree(operations);
|
|
69620
70846
|
var manual = [...workflows.map((w) => w.words), [API_WORD]];
|
|
69621
70847
|
function route(argv) {
|
|
@@ -69697,7 +70923,7 @@ var defaults = {
|
|
|
69697
70923
|
return;
|
|
69698
70924
|
const cmd = process.platform === "darwin" ? ["open", url] : process.platform === "win32" ? ["rundll32", "url.dll,FileProtocolHandler", url] : ["xdg-open", url];
|
|
69699
70925
|
await new Promise((resolve12, reject) => {
|
|
69700
|
-
const child =
|
|
70926
|
+
const child = spawn5(cmd[0], cmd.slice(1), { stdio: "ignore" });
|
|
69701
70927
|
child.once("error", reject);
|
|
69702
70928
|
child.once("close", () => resolve12());
|
|
69703
70929
|
});
|
|
@@ -69706,12 +70932,12 @@ var defaults = {
|
|
|
69706
70932
|
wait: (ms) => new Promise((resolve12) => setTimeout(resolve12, ms)),
|
|
69707
70933
|
render,
|
|
69708
70934
|
spawn: (cmd, args, options) => new Promise((resolve12, reject) => {
|
|
69709
|
-
const child =
|
|
70935
|
+
const child = spawn5(cmd, args, { cwd: options.cwd, stdio: ["ignore", 2, 2] });
|
|
69710
70936
|
child.once("error", reject);
|
|
69711
70937
|
child.once("close", (code) => resolve12(code ?? 1));
|
|
69712
70938
|
}),
|
|
69713
70939
|
spawnCapture: (cmd, args, options) => new Promise((resolve12, reject) => {
|
|
69714
|
-
const child =
|
|
70940
|
+
const child = spawn5(cmd, args, { cwd: options.cwd, stdio: ["ignore", "pipe", "pipe"] });
|
|
69715
70941
|
const chunks = [];
|
|
69716
70942
|
child.stdout.on("data", (c) => chunks.push(c));
|
|
69717
70943
|
child.stderr.on("data", (c) => chunks.push(c));
|
|
@@ -69790,6 +71016,25 @@ var appOptions = {
|
|
|
69790
71016
|
"devops flag scaffold": [
|
|
69791
71017
|
{ name: "out", type: "string", description: "Directory the paired on/off scenario stubs are written to (default: the current directory)." }
|
|
69792
71018
|
],
|
|
71019
|
+
"devops flag refs": [
|
|
71020
|
+
{ 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)." },
|
|
71021
|
+
{ name: "project", type: "string", description: "With --report: the DevOps project id (dvp_…) whose flags the scan is reported into. Required." }
|
|
71022
|
+
],
|
|
71023
|
+
"agent memory": [
|
|
71024
|
+
{ name: "hook", type: "string", description: "Run as a Claude Code hook (SessionStart or UserPromptSubmit): read the hook input on stdin, print the hook JSON or nothing, always exit 0." }
|
|
71025
|
+
],
|
|
71026
|
+
"agent recall": [
|
|
71027
|
+
{ name: "words", type: "string", repeated: true, description: "Distinctive words to recall by, comma-separated or repeated." },
|
|
71028
|
+
{ name: "handles", type: "string", repeated: true, description: "Entry handles or ids from memory to recall, comma-separated or repeated." }
|
|
71029
|
+
],
|
|
71030
|
+
"agent remember": [
|
|
71031
|
+
{ name: "text", type: "string", description: "The experience, in your own words: what happened, who, what was decided and why, what is still open." },
|
|
71032
|
+
{ name: "about", type: "string", repeated: true, description: "Ids of entities it is about, comma-separated or repeated." }
|
|
71033
|
+
],
|
|
71034
|
+
"agent events wait": [
|
|
71035
|
+
{ name: "timeout", type: "string", description: "Give up after this many seconds, print that nothing arrived and exit 0 (default: wait until a letter arrives)." },
|
|
71036
|
+
{ 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)." }
|
|
71037
|
+
],
|
|
69793
71038
|
"canvas import": [
|
|
69794
71039
|
{ name: "name", type: "string", description: "Name for the new canvas (default: the file name without .pen)." },
|
|
69795
71040
|
{ 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." },
|
|
@@ -69804,17 +71049,19 @@ var appOptions = {
|
|
|
69804
71049
|
};
|
|
69805
71050
|
appOptions["devops engine deploy"] = appOptions["devops deploy"];
|
|
69806
71051
|
var workflowOptions = (words) => words[0] === "skill" ? [{ name: "install", type: "string" }] : appOptions[words.join(" ")] ?? [];
|
|
69807
|
-
function flagPortsFor(ports, context, emit) {
|
|
71052
|
+
function flagPortsFor(ports, context, emit, connect) {
|
|
69808
71053
|
return {
|
|
69809
71054
|
mode: context.mode,
|
|
69810
71055
|
emit,
|
|
69811
|
-
human: (
|
|
71056
|
+
human: (text3) => {
|
|
69812
71057
|
if (context.mode === "human")
|
|
69813
|
-
emit({ kind: "message", channel: "stdout", text:
|
|
71058
|
+
emit({ kind: "message", channel: "stdout", text: text3 });
|
|
69814
71059
|
},
|
|
69815
71060
|
cwd: ports.cwd,
|
|
69816
71061
|
readFile: ports.readFile,
|
|
69817
|
-
|
|
71062
|
+
git: async (args) => (await ports.spawnCapture("git", [...args], { cwd: ports.cwd })).output,
|
|
71063
|
+
client: connect,
|
|
71064
|
+
writeFile: (path, text3) => writeFile5(path, text3, "utf8"),
|
|
69818
71065
|
mkdir: async (path) => {
|
|
69819
71066
|
await mkdir4(path, { recursive: true });
|
|
69820
71067
|
},
|
|
@@ -69838,9 +71085,9 @@ function toolPortsFor(ports, context, emit) {
|
|
|
69838
71085
|
return {
|
|
69839
71086
|
mode: context.mode,
|
|
69840
71087
|
emit,
|
|
69841
|
-
human: (
|
|
71088
|
+
human: (text3) => {
|
|
69842
71089
|
if (context.mode === "human")
|
|
69843
|
-
emit({ kind: "message", channel: "stdout", text:
|
|
71090
|
+
emit({ kind: "message", channel: "stdout", text: text3 });
|
|
69844
71091
|
},
|
|
69845
71092
|
cwd: ports.cwd,
|
|
69846
71093
|
readFile: ports.readFile,
|
|
@@ -69855,7 +71102,7 @@ function toolPortsFor(ports, context, emit) {
|
|
|
69855
71102
|
},
|
|
69856
71103
|
git: (args, cwd) => ports.spawnCapture("git", args, { cwd }),
|
|
69857
71104
|
run: (cmd, args, cwd) => new Promise((resolve12, reject) => {
|
|
69858
|
-
const child =
|
|
71105
|
+
const child = spawn5(cmd, args, { cwd, stdio: "inherit" });
|
|
69859
71106
|
child.once("error", reject);
|
|
69860
71107
|
child.once("close", (code) => resolve12(code ?? 1));
|
|
69861
71108
|
}),
|
|
@@ -69880,7 +71127,7 @@ async function main3(argv, injected = {}) {
|
|
|
69880
71127
|
columns: ports.columns,
|
|
69881
71128
|
now: ports.now(),
|
|
69882
71129
|
envVars: { NO_COLOR: ports.env.NO_COLOR, FORCE_COLOR: ports.env.FORCE_COLOR, TERM: ports.env.TERM },
|
|
69883
|
-
env: ports.env.PRAXIS_ENV ??
|
|
71130
|
+
env: ports.env.PRAXIS_ENV ?? DEFAULT_ENV
|
|
69884
71131
|
};
|
|
69885
71132
|
let stopProgress = () => {};
|
|
69886
71133
|
let quiet = false;
|
|
@@ -70150,9 +71397,9 @@ Examples:
|
|
|
70150
71397
|
},
|
|
70151
71398
|
mode: ctx.mode,
|
|
70152
71399
|
emit,
|
|
70153
|
-
human: (
|
|
71400
|
+
human: (text3) => {
|
|
70154
71401
|
if (ctx.mode === "human")
|
|
70155
|
-
emit({ kind: "message", channel: "stdout", text:
|
|
71402
|
+
emit({ kind: "message", channel: "stdout", text: text3 });
|
|
70156
71403
|
},
|
|
70157
71404
|
cwd: ports.cwd
|
|
70158
71405
|
});
|
|
@@ -70179,14 +71426,14 @@ Examples:
|
|
|
70179
71426
|
}, {
|
|
70180
71427
|
mode: ctx.mode,
|
|
70181
71428
|
emit,
|
|
70182
|
-
human: (
|
|
71429
|
+
human: (text3) => {
|
|
70183
71430
|
if (ctx.mode === "human")
|
|
70184
|
-
emit({ kind: "message", channel: "stdout", text:
|
|
71431
|
+
emit({ kind: "message", channel: "stdout", text: text3 });
|
|
70185
71432
|
},
|
|
70186
71433
|
engine: codeRefactorEngine(),
|
|
70187
71434
|
hasFile: (path2) => existsSync4(path2),
|
|
70188
71435
|
readFile: ports.readFile,
|
|
70189
|
-
writeFile: (path2,
|
|
71436
|
+
writeFile: (path2, text3) => writeFile5(path2, text3, "utf8"),
|
|
70190
71437
|
mkdir: async (path2) => {
|
|
70191
71438
|
await mkdir4(path2, { recursive: true });
|
|
70192
71439
|
},
|
|
@@ -70203,9 +71450,9 @@ Examples:
|
|
|
70203
71450
|
const shellPorts = {
|
|
70204
71451
|
mode: ctx.mode,
|
|
70205
71452
|
emit,
|
|
70206
|
-
human: (
|
|
71453
|
+
human: (text3) => {
|
|
70207
71454
|
if (ctx.mode === "human")
|
|
70208
|
-
emit({ kind: "message", channel: "stdout", text:
|
|
71455
|
+
emit({ kind: "message", channel: "stdout", text: text3 });
|
|
70209
71456
|
},
|
|
70210
71457
|
engine: await repositoryEngine(name, () => localEngine(ports.cwd)),
|
|
70211
71458
|
...localFilePorts(ports.cwd)
|
|
@@ -70218,9 +71465,9 @@ Examples:
|
|
|
70218
71465
|
const testPorts = {
|
|
70219
71466
|
mode: ctx.mode,
|
|
70220
71467
|
emit,
|
|
70221
|
-
human: (
|
|
71468
|
+
human: (text3) => {
|
|
70222
71469
|
if (ctx.mode === "human")
|
|
70223
|
-
emit({ kind: "message", channel: "stdout", text:
|
|
71470
|
+
emit({ kind: "message", channel: "stdout", text: text3 });
|
|
70224
71471
|
},
|
|
70225
71472
|
engine: await repositoryEngine(name, () => localEngine(ports.cwd)),
|
|
70226
71473
|
checkout: await localCheckout(ports.cwd, (cmd, args, options) => ports.spawnCapture(cmd, args, options))
|
|
@@ -70229,9 +71476,9 @@ Examples:
|
|
|
70229
71476
|
return await devopsTestReport({ path: parsed.positional[0], id: parsed.flags.id?.[0], upload: Boolean(parsed.flags.upload), project: parsed.flags.project?.[0] }, testPorts, {
|
|
70230
71477
|
mode: ctx.mode,
|
|
70231
71478
|
emit,
|
|
70232
|
-
human: (
|
|
71479
|
+
human: (text3) => {
|
|
70233
71480
|
if (ctx.mode === "human")
|
|
70234
|
-
emit({ kind: "message", channel: "stdout", text:
|
|
71481
|
+
emit({ kind: "message", channel: "stdout", text: text3 });
|
|
70235
71482
|
},
|
|
70236
71483
|
root: async () => await checkoutRoot(ports.cwd, ports.readFile),
|
|
70237
71484
|
readFile: ports.readFile,
|
|
@@ -70261,13 +71508,13 @@ Examples:
|
|
|
70261
71508
|
git: (args) => ports.spawnCapture("git", args, { cwd: ports.cwd }),
|
|
70262
71509
|
mode: ctx.mode,
|
|
70263
71510
|
emit,
|
|
70264
|
-
human: (
|
|
71511
|
+
human: (text3) => {
|
|
70265
71512
|
if (ctx.mode === "human")
|
|
70266
|
-
emit({ kind: "message", channel: "stdout", text:
|
|
71513
|
+
emit({ kind: "message", channel: "stdout", text: text3 });
|
|
70267
71514
|
}
|
|
70268
71515
|
});
|
|
70269
71516
|
}
|
|
70270
|
-
const flagPorts = flagPortsFor(ports, ctx, emit);
|
|
71517
|
+
const flagPorts = flagPortsFor(ports, ctx, emit, async () => await auth.client(org));
|
|
70271
71518
|
if (name === "devops flag sync")
|
|
70272
71519
|
return await devopsFlagSync({ check: Boolean(parsed.flags.check) }, flagPorts);
|
|
70273
71520
|
if (name === "devops flag check")
|
|
@@ -70275,7 +71522,7 @@ Examples:
|
|
|
70275
71522
|
if (name === "devops flag scaffold")
|
|
70276
71523
|
return await devopsFlagScaffold(parsed.positional[0], { out: parsed.flags.out?.[0] }, flagPorts);
|
|
70277
71524
|
if (name === "devops flag refs")
|
|
70278
|
-
return await devopsFlagRefs(parsed.positional[0], flagPorts);
|
|
71525
|
+
return await devopsFlagRefs(parsed.positional[0], { report: Boolean(parsed.flags.report), project: parsed.flags.project?.[0] }, flagPorts);
|
|
70279
71526
|
return await devopsFlagRemove(parsed.positional[0], flagPorts);
|
|
70280
71527
|
}
|
|
70281
71528
|
if (!quiet)
|
|
@@ -70313,9 +71560,9 @@ Examples:
|
|
|
70313
71560
|
emit({ kind: "object", data: await auth.switchOrganization(parsed.positional[0]) });
|
|
70314
71561
|
break;
|
|
70315
71562
|
case "app create": {
|
|
70316
|
-
const appPorts = { ...ports, mode: ctx.mode, emit, human: (
|
|
71563
|
+
const appPorts = { ...ports, mode: ctx.mode, emit, human: (text3) => {
|
|
70317
71564
|
if (ctx.mode === "human")
|
|
70318
|
-
emit({ kind: "message", channel: "stdout", text:
|
|
71565
|
+
emit({ kind: "message", channel: "stdout", text: text3 });
|
|
70319
71566
|
}, random: randomSecret };
|
|
70320
71567
|
await appCreate({ name: parsed.positional[0], dir: parsed.flags.dir?.[0], template: parsed.flags.template?.[0], install: !parsed.flags["no-install"] }, config.env, appPorts);
|
|
70321
71568
|
break;
|
|
@@ -70344,13 +71591,220 @@ Examples:
|
|
|
70344
71591
|
wait: ports.wait,
|
|
70345
71592
|
mode: ctx.mode,
|
|
70346
71593
|
emit,
|
|
70347
|
-
human: (
|
|
71594
|
+
human: (text3) => {
|
|
70348
71595
|
if (ctx.mode === "human")
|
|
70349
|
-
emit({ kind: "message", channel: "stdout", text:
|
|
71596
|
+
emit({ kind: "message", channel: "stdout", text: text3 });
|
|
70350
71597
|
},
|
|
70351
71598
|
cwd: ports.cwd
|
|
70352
71599
|
});
|
|
70353
71600
|
}
|
|
71601
|
+
case "agent events channel": {
|
|
71602
|
+
const agent = assumeAgentOf(ports.env);
|
|
71603
|
+
const headers = async () => {
|
|
71604
|
+
const credential = await auth.get(org);
|
|
71605
|
+
return { Authorization: `Bearer ${credential.token}`, ...credential.source === "api-key" ? { "X-API-Key": credential.token } : {} };
|
|
71606
|
+
};
|
|
71607
|
+
const failure2 = (status, body) => `HTTP ${status}${body?.error?.code ? ` ${body.error.code}` : ""}${body?.error?.message ? `: ${String(redact(body.error.message, secrets))}` : ""}`;
|
|
71608
|
+
process.stdin.setEncoding("utf8");
|
|
71609
|
+
return await runChannel({
|
|
71610
|
+
agent,
|
|
71611
|
+
input: process.stdin,
|
|
71612
|
+
send: (frame2) => {
|
|
71613
|
+
process.stdout.write(JSON.stringify(frame2) + `
|
|
71614
|
+
`);
|
|
71615
|
+
},
|
|
71616
|
+
fetchLetters: async () => {
|
|
71617
|
+
const response = await wireFetch(inboxLettersUrl(config.apiUrl, agent), { headers: await headers(), signal: AbortSignal.timeout(30000), redirect: "error" });
|
|
71618
|
+
const body = await response.json().catch(() => null);
|
|
71619
|
+
if (!response.ok)
|
|
71620
|
+
throw new Error(failure2(response.status, body));
|
|
71621
|
+
return lettersOf(body);
|
|
71622
|
+
},
|
|
71623
|
+
openStream: async (signal, lastEventId) => {
|
|
71624
|
+
const response = await wireFetch(eventsStreamUrl(config.apiUrl, agent), { headers: streamHeaders(await headers(), lastEventId), signal, redirect: "error" });
|
|
71625
|
+
if (!response.ok || !response.body) {
|
|
71626
|
+
const body = await response.json().catch(() => null);
|
|
71627
|
+
return { status: response.status, reason: failure2(response.status, body) };
|
|
71628
|
+
}
|
|
71629
|
+
return { status: response.status, chunks: response.body.pipeThrough(new TextDecoderStream) };
|
|
71630
|
+
},
|
|
71631
|
+
sleep: (ms, signal) => new Promise((resolve12) => {
|
|
71632
|
+
const timer = setTimeout(resolve12, ms);
|
|
71633
|
+
signal.addEventListener("abort", () => {
|
|
71634
|
+
clearTimeout(timer);
|
|
71635
|
+
resolve12();
|
|
71636
|
+
}, { once: true });
|
|
71637
|
+
}),
|
|
71638
|
+
log: (line) => {
|
|
71639
|
+
process.stderr.write(String(redact(line, secrets)) + `
|
|
71640
|
+
`);
|
|
71641
|
+
}
|
|
71642
|
+
});
|
|
71643
|
+
}
|
|
71644
|
+
case "agent memory":
|
|
71645
|
+
case "agent recall":
|
|
71646
|
+
case "agent remember": {
|
|
71647
|
+
const agent = assumeAgentOf(ports.env);
|
|
71648
|
+
const mcpPorts = {
|
|
71649
|
+
fetch: (url2, init) => wireFetch(url2, init),
|
|
71650
|
+
headers: async () => {
|
|
71651
|
+
const credential = await auth.get(org);
|
|
71652
|
+
return { Authorization: `Bearer ${credential.token}`, ...credential.source === "api-key" ? { "X-API-Key": credential.token } : {} };
|
|
71653
|
+
}
|
|
71654
|
+
};
|
|
71655
|
+
const url = mcpUrl(config.apiUrl, agent);
|
|
71656
|
+
const hook = parsed.flags.hook?.[0];
|
|
71657
|
+
if (name === "agent memory" && hook !== undefined) {
|
|
71658
|
+
if (hook !== "SessionStart" && hook !== "UserPromptSubmit")
|
|
71659
|
+
throw new UsageError(`--hook takes SessionStart or UserPromptSubmit, not ${hook}`, "Example: praxis agent memory --hook SessionStart");
|
|
71660
|
+
process.stdin.setEncoding("utf8");
|
|
71661
|
+
let raw = "";
|
|
71662
|
+
if (!process.stdin.isTTY)
|
|
71663
|
+
for await (const chunk of process.stdin)
|
|
71664
|
+
raw += chunk;
|
|
71665
|
+
const input = hookInputOf(raw);
|
|
71666
|
+
const seenDir = join12(ports.env.HOME || homedir3(), ".praxis", "cli", "memory-seen");
|
|
71667
|
+
const out = await runMemoryHook(hook, input, {
|
|
71668
|
+
...mcpPorts,
|
|
71669
|
+
url,
|
|
71670
|
+
timeoutMs: 25000,
|
|
71671
|
+
readSeen: async (id) => JSON.parse(await readFile7(join12(seenDir, `${id}.json`), "utf8")),
|
|
71672
|
+
writeSeen: async (id, paragraphs) => {
|
|
71673
|
+
await mkdir4(seenDir, { recursive: true, mode: 448 });
|
|
71674
|
+
await writeFile5(join12(seenDir, `${id}.json`), JSON.stringify(paragraphs), { mode: 384 });
|
|
71675
|
+
}
|
|
71676
|
+
});
|
|
71677
|
+
if (out !== null)
|
|
71678
|
+
process.stdout.write(out + `
|
|
71679
|
+
`);
|
|
71680
|
+
return 0;
|
|
71681
|
+
}
|
|
71682
|
+
const list = (flag) => (parsed.flags[flag] ?? []).flatMap((value) => value.split(",")).map((value) => value.trim()).filter(Boolean);
|
|
71683
|
+
const args = name === "agent recall" ? { ...list("handles").length ? { handles: list("handles") } : {}, ...list("words").length ? { words: list("words") } : {} } : name === "agent remember" ? { text: parsed.flags.text?.[0] ?? "", ...list("about").length ? { about: list("about") } : {} } : {};
|
|
71684
|
+
if (name === "agent remember" && String(args.text).trim() === "")
|
|
71685
|
+
throw new UsageError("--text is required", 'Example: praxis agent remember --text "今天定了……"');
|
|
71686
|
+
const tool = name === "agent memory" ? MEMORY_TOOL : name === "agent recall" ? RECALL_TOOL : REMEMBER_TOOL;
|
|
71687
|
+
const text3 = memoryBodyOf(await callAgentTool(mcpPorts, url, tool, args, AbortSignal.timeout(60000)));
|
|
71688
|
+
process.stdout.write(text3 + `
|
|
71689
|
+
`);
|
|
71690
|
+
return 0;
|
|
71691
|
+
}
|
|
71692
|
+
case "agent events wait": {
|
|
71693
|
+
const agent = assumeAgentOf(ports.env);
|
|
71694
|
+
const timeoutMs = (() => {
|
|
71695
|
+
try {
|
|
71696
|
+
return timeoutMsOf(parsed.flags.timeout?.[0]);
|
|
71697
|
+
} catch (error) {
|
|
71698
|
+
throw new UsageError(error.message, "Example: praxis agent events wait --timeout 3600");
|
|
71699
|
+
}
|
|
71700
|
+
})();
|
|
71701
|
+
const headers = async () => {
|
|
71702
|
+
const credential = await auth.get(org);
|
|
71703
|
+
return { Authorization: `Bearer ${credential.token}`, ...credential.source === "api-key" ? { "X-API-Key": credential.token } : {} };
|
|
71704
|
+
};
|
|
71705
|
+
const failure2 = (status, body) => `HTTP ${status}${body?.error?.code ? ` ${body.error.code}` : ""}${body?.error?.message ? `: ${String(redact(body.error.message, secrets))}` : ""}`;
|
|
71706
|
+
const session = (() => {
|
|
71707
|
+
try {
|
|
71708
|
+
return sessionOf(parsed.flags.session?.[0]);
|
|
71709
|
+
} catch (error) {
|
|
71710
|
+
throw new UsageError(error.message, "Example: praxis agent events wait --session 0f6c…");
|
|
71711
|
+
}
|
|
71712
|
+
})();
|
|
71713
|
+
const key = waitKeyOf(config.env, agent, session);
|
|
71714
|
+
const waitDir = join12(ports.env.HOME || homedir3(), ".praxis", "cli", "events-wait");
|
|
71715
|
+
const statePath = join12(waitDir, `${key}.json`);
|
|
71716
|
+
const pidPath = join12(waitDir, `${key}.pid`);
|
|
71717
|
+
await mkdir4(waitDir, { recursive: true, mode: 448 });
|
|
71718
|
+
const holder = await acquireWaitLock({
|
|
71719
|
+
self: process.pid,
|
|
71720
|
+
readPid: () => readFile7(pidPath, "utf8").catch(() => null),
|
|
71721
|
+
createPid: (text3) => writeFile5(pidPath, text3, { mode: 384, flag: "wx" }).then(() => true, () => false),
|
|
71722
|
+
replacePid: (text3) => writeFile5(pidPath, text3, { mode: 384 }),
|
|
71723
|
+
probe: async (pid) => {
|
|
71724
|
+
try {
|
|
71725
|
+
process.kill(pid, 0);
|
|
71726
|
+
} catch (error) {
|
|
71727
|
+
if (error.code !== "EPERM")
|
|
71728
|
+
return { alive: false };
|
|
71729
|
+
}
|
|
71730
|
+
const ps = spawnSync("ps", ["-o", "ppid=,command=", "-p", String(pid)], { encoding: "utf8" });
|
|
71731
|
+
const line = ps.stdout?.trim() ?? "";
|
|
71732
|
+
const match = /^(\d+)\s+(.*)$/.exec(line);
|
|
71733
|
+
return match ? { alive: true, ppid: Number(match[1]), command: match[2] } : { alive: false };
|
|
71734
|
+
},
|
|
71735
|
+
terminate: (pid) => {
|
|
71736
|
+
try {
|
|
71737
|
+
process.kill(pid, "SIGTERM");
|
|
71738
|
+
} catch {}
|
|
71739
|
+
}
|
|
71740
|
+
});
|
|
71741
|
+
if (holder !== null) {
|
|
71742
|
+
process.stdout.write(alreadyWaitingNotice(holder) + `
|
|
71743
|
+
`);
|
|
71744
|
+
return 0;
|
|
71745
|
+
}
|
|
71746
|
+
const release = () => {
|
|
71747
|
+
try {
|
|
71748
|
+
if (pidOf(readFileSync3(pidPath, "utf8")) === process.pid)
|
|
71749
|
+
unlinkSync(pidPath);
|
|
71750
|
+
} catch {}
|
|
71751
|
+
};
|
|
71752
|
+
const onSignal = (signal) => {
|
|
71753
|
+
release();
|
|
71754
|
+
process.exit(signal === "SIGINT" ? 130 : 143);
|
|
71755
|
+
};
|
|
71756
|
+
for (const signal of ["SIGTERM", "SIGINT", "SIGHUP"])
|
|
71757
|
+
process.once(signal, onSignal);
|
|
71758
|
+
try {
|
|
71759
|
+
return await runEventsWait({
|
|
71760
|
+
agent,
|
|
71761
|
+
timeoutMs,
|
|
71762
|
+
fetchLetters: async () => {
|
|
71763
|
+
const response = await wireFetch(inboxLettersUrl(config.apiUrl, agent), { headers: await headers(), signal: AbortSignal.timeout(30000), redirect: "error" });
|
|
71764
|
+
const body = await response.json().catch(() => null);
|
|
71765
|
+
if (!response.ok)
|
|
71766
|
+
throw new Error(failure2(response.status, body));
|
|
71767
|
+
return lettersOf(body);
|
|
71768
|
+
},
|
|
71769
|
+
openStream: async (signal, lastEventId) => {
|
|
71770
|
+
const response = await wireFetch(eventsStreamUrl(config.apiUrl, agent), {
|
|
71771
|
+
headers: streamHeaders(await headers(), lastEventId),
|
|
71772
|
+
signal,
|
|
71773
|
+
redirect: "error"
|
|
71774
|
+
});
|
|
71775
|
+
if (!response.ok || !response.body) {
|
|
71776
|
+
const body = await response.json().catch(() => null);
|
|
71777
|
+
return { status: response.status, reason: failure2(response.status, body) };
|
|
71778
|
+
}
|
|
71779
|
+
return { status: response.status, chunks: response.body.pipeThrough(new TextDecoderStream) };
|
|
71780
|
+
},
|
|
71781
|
+
readState: async () => waitStateOf(await readFile7(statePath, "utf8").catch(() => null)),
|
|
71782
|
+
writeState: async (next) => {
|
|
71783
|
+
await mkdir4(dirname10(statePath), { recursive: true, mode: 448 });
|
|
71784
|
+
await writeFile5(statePath, waitStateText(next), { mode: 384 });
|
|
71785
|
+
},
|
|
71786
|
+
print: (line) => {
|
|
71787
|
+
process.stdout.write(line + `
|
|
71788
|
+
`);
|
|
71789
|
+
},
|
|
71790
|
+
log: (line) => {
|
|
71791
|
+
process.stderr.write(String(redact(line, secrets)) + `
|
|
71792
|
+
`);
|
|
71793
|
+
},
|
|
71794
|
+
sleep: (ms, signal) => new Promise((resolve12) => {
|
|
71795
|
+
const timer = setTimeout(resolve12, ms);
|
|
71796
|
+
signal.addEventListener("abort", () => {
|
|
71797
|
+
clearTimeout(timer);
|
|
71798
|
+
resolve12();
|
|
71799
|
+
}, { once: true });
|
|
71800
|
+
})
|
|
71801
|
+
});
|
|
71802
|
+
} finally {
|
|
71803
|
+
release();
|
|
71804
|
+
for (const signal of ["SIGTERM", "SIGINT", "SIGHUP"])
|
|
71805
|
+
process.removeListener(signal, onSignal);
|
|
71806
|
+
}
|
|
71807
|
+
}
|
|
70354
71808
|
case "canvas import": {
|
|
70355
71809
|
const authorize = async () => {
|
|
70356
71810
|
const credential = await auth.get(org);
|
|
@@ -70392,7 +71846,7 @@ Examples:
|
|
|
70392
71846
|
file: parsed.positional[0],
|
|
70393
71847
|
name: parsed.flags.name?.[0],
|
|
70394
71848
|
canvas: parsed.flags.canvas?.[0],
|
|
70395
|
-
frames: typeof parsed.flags.frames?.[0] === "string" ? parsed.flags.frames[0].split(",").map((
|
|
71849
|
+
frames: typeof parsed.flags.frames?.[0] === "string" ? parsed.flags.frames[0].split(",").map((frame2) => frame2.trim()).filter(Boolean) : undefined,
|
|
70396
71850
|
imageRoots: parsed.flags["image-root"],
|
|
70397
71851
|
dryRun: Boolean(parsed.flags["dry-run"]?.[0]),
|
|
70398
71852
|
yes: Boolean(flags.yes)
|
|
@@ -70406,9 +71860,9 @@ Examples:
|
|
|
70406
71860
|
cwd: ports.cwd,
|
|
70407
71861
|
rpc,
|
|
70408
71862
|
upload,
|
|
70409
|
-
human: (
|
|
71863
|
+
human: (text3) => {
|
|
70410
71864
|
if (ctx.mode === "human")
|
|
70411
|
-
emit({ kind: "message", channel: "stdout", text:
|
|
71865
|
+
emit({ kind: "message", channel: "stdout", text: text3 });
|
|
70412
71866
|
}
|
|
70413
71867
|
});
|
|
70414
71868
|
}
|
|
@@ -70440,7 +71894,8 @@ if (true) {
|
|
|
70440
71894
|
process.exit(0);
|
|
70441
71895
|
throw error;
|
|
70442
71896
|
});
|
|
70443
|
-
|
|
71897
|
+
const argv = process.argv.slice(2);
|
|
71898
|
+
process.exitCode = isDevopsTestRun(route(argv).words) && needsCacheOffReexec(process.env) ? await reexecWithCacheOff() : await main3(argv);
|
|
70444
71899
|
}
|
|
70445
71900
|
export {
|
|
70446
71901
|
main3 as main
|