@deepraxis/cli 0.3.0-dev.9515f27 → 0.3.0-dev.983bcdd

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.
Files changed (3) hide show
  1. package/COMMANDS.md +18 -5
  2. package/dist/praxis.js +1415 -186
  3. package/package.json +4 -1
package/dist/praxis.js CHANGED
@@ -13984,7 +13984,14 @@ var init_flag_registry_generated = __esm(() => {
13984
13984
  FLAGS = {
13985
13985
  "agent-cognition-idle-wake": { kind: "RELEASE", type: "BOOLEAN", default: false, owner: "genius", ticket: 540, expires: "2026-11-30", system: "flagship" },
13986
13986
  "cognition-weight-driven": { kind: "RELEASE", type: "BOOLEAN", default: false, owner: "praxis-bd", ticket: 1760, expires: "2026-12-05", system: "devops" },
13987
+ crm: { kind: "RELEASE", type: "BOOLEAN", default: false, owner: "usr_rv860m7z9h8szkgma56cd14n", ticket: 2179, expires: "2026-12-31", system: "devops" },
13988
+ "delivery-rules-v2": { kind: "RELEASE", type: "BOOLEAN", default: false, owner: "usr_t60d4g5z82rhbtbfrfxfbdxe", ticket: 2048, expires: "2026-11-28", system: "devops" },
13989
+ "model-access-gate": { kind: "RELEASE", type: "BOOLEAN", default: false, owner: "usr_t60d4g5z82rhbtbfrfxfbdxe", ticket: 1933, expires: "2026-12-15", system: "devops" },
13987
13990
  "open-project": { kind: "RELEASE", type: "BOOLEAN", default: false, owner: "praxis-51", ticket: 1488, expires: "2026-11-25", system: "devops" },
13991
+ "requests-never-hold": { kind: "RELEASE", type: "BOOLEAN", default: false, owner: "usr_t60d4g5z82rhbtbfrfxfbdxe", ticket: 2119, expires: "2026-11-29", system: "devops" },
13992
+ "requests-v1": { kind: "RELEASE", type: "BOOLEAN", default: false, owner: "usr_t60d4g5z82rhbtbfrfxfbdxe", ticket: 2057, expires: "2026-11-28", system: "devops" },
13993
+ "router-precommit-hedge": { kind: "RELEASE", type: "BOOLEAN", default: false, owner: "usr_t60d4g5z82rhbtbfrfxfbdxe", ticket: 2052, expires: "2026-11-28", system: "devops" },
13994
+ "router-responses-hedge": { kind: "RELEASE", type: "BOOLEAN", default: false, owner: "usr_t60d4g5z82rhbtbfrfxfbdxe", ticket: 2149, expires: "2026-11-28", system: "devops" },
13988
13995
  "search-provider-routing": { kind: "RELEASE", type: "BOOLEAN", default: false, owner: "praxis-98", ticket: 716, expires: "2026-12-31", system: "devops" },
13989
13996
  "unit-live-probe": { kind: "RELEASE", type: "BOOLEAN", default: false, owner: "usr_t60d4g5z82rhbtbfrfxfbdxe", ticket: null, expires: "2026-11-19", system: "devops" }
13990
13997
  };
@@ -14011,7 +14018,7 @@ function checkFlags(files, registry, today = new Date().toISOString().slice(0, 1
14011
14018
  }
14012
14019
  const registryFile = production.find((f) => f.path.endsWith("flag-registry.generated.ts"));
14013
14020
  const registryLine = (key) => registryFile ? lineOf(registryFile.text, Math.max(0, registryFile.text.indexOf(`"${key}":`))) : 1;
14014
- const add = (file, offset, message) => issues.push({ file: file.path, line: lineOf(file.text, offset), message });
14021
+ const add = (file, offset, message2) => issues.push({ file: file.path, line: lineOf(file.text, offset), message: message2 });
14015
14022
  const referencedKeysIn = (file) => {
14016
14023
  for (const key of registered) {
14017
14024
  const literal = new RegExp(`(?:"|')${key.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}(?:"|')`);
@@ -14030,6 +14037,8 @@ function checkFlags(files, registry, today = new Date().toISOString().slice(0, 1
14030
14037
  add(f, browserList.index + entry.index, `unregistered browser flag key "${entry[1]}"`);
14031
14038
  }
14032
14039
  }
14040
+ if (/\.generated\.[cm]?[jt]sx?$/.test(f.path))
14041
+ continue;
14033
14042
  const calls = /(\.bool|\breadBrowserFlag|\buseBrowserFlag)\s*\(\s*([^,)\n]+)/g;
14034
14043
  for (const m of f.text.matchAll(calls)) {
14035
14044
  if (/function\s*$/.test(f.text.slice(Math.max(0, m.index - 20), m.index)))
@@ -14098,7 +14107,7 @@ async function main() {
14098
14107
  else
14099
14108
  console.log(`Feature flag registry check passed (${Object.keys(FLAGS).length} registered flags).`);
14100
14109
  }
14101
- var isTest = (path) => /(^|\/)(spec|__tests__)(\/|$)|\.(test|spec)\.[cm]?[jt]sx?$/.test(path), lineOf = (text2, offset) => text2.slice(0, offset).split(`
14110
+ var isTest = (path) => /(^|\/)(spec|__tests__)(\/|$)|\.(test|spec)\.[cm]?[jt]sx?$/.test(path), lineOf = (text3, offset) => text3.slice(0, offset).split(`
14102
14111
  `).length, isCalendarDate = (value) => /^\d{4}-\d{2}-\d{2}$/.test(value) && !Number.isNaN(new Date(`${value}T00:00:00.000Z`).valueOf()) && new Date(`${value}T00:00:00.000Z`).toISOString().slice(0, 10) === value;
14103
14112
  var init_check_flags = __esm(() => {
14104
14113
  init_flag_registry_generated();
@@ -14296,7 +14305,7 @@ async function checkRegistrySync(ports = {}) {
14296
14305
  }
14297
14306
  async function syncFlags(ports = {}) {
14298
14307
  const registry = ports.registry ?? registryUrl;
14299
- const write = ports.write ?? ((target, text2) => writeFile4(target, text2));
14308
+ const write = ports.write ?? ((target, text3) => writeFile4(target, text3));
14300
14309
  const log = ports.log ?? console.log;
14301
14310
  const error = ports.error ?? console.error;
14302
14311
  const devops = await (ports.devops ?? readDevopsFlags)();
@@ -14533,12 +14542,13 @@ async function runEngineDelegation(delegation, options) {
14533
14542
  }
14534
14543
 
14535
14544
  // src/main.ts
14536
- import { existsSync as existsSync4 } from "node:fs";
14545
+ import { existsSync as existsSync4, readFileSync as readFileSync3, unlinkSync } from "node:fs";
14537
14546
  import { mkdir as mkdir4, readFile as readFile7, readdir as readdir3, writeFile as writeFile5 } from "node:fs/promises";
14538
- import { resolve as resolve11 } from "node:path";
14547
+ import { dirname as dirname10, join as join12, resolve as resolve11 } from "node:path";
14548
+ import { homedir as homedir3 } from "node:os";
14539
14549
  import { pathToFileURL } from "node:url";
14540
14550
  import { createHash as createHash5 } from "node:crypto";
14541
- import { spawn as spawn4 } from "node:child_process";
14551
+ import { spawn as spawn5 } from "node:child_process";
14542
14552
  import { createInterface } from "node:readline";
14543
14553
 
14544
14554
  // ../../packages/sdk/typescript/src/operations.generated.ts
@@ -15593,8 +15603,8 @@ Idempotent. Access tokens revoked while the customer was blocked stay revoked; s
15593
15603
  {
15594
15604
  resource: "agent.agents.events",
15595
15605
  method: "stream",
15596
- summary: "Follow your conversation with an agent live",
15597
- description: "Follow your conversation with a personal or general agent live over Server-Sent Events: the stream of your own main session with that agent, the same stream sessions.events.stream opens, event_deltas[] previews included. {agent_id} takes the agent_… id, the eight character identity number or the handle; a service or assume agent answers 400. Closing the stream only drops your subscription and does not stop the agent; read past events with agents.events.list.",
15606
+ summary: "Follow an agent live",
15607
+ description: "Follow an agent live over Server-Sent Events. For a personal or general agent it is the stream of your own main session with that agent, the same stream sessions.events.stream opens, event_deltas[] previews included; read past events with agents.events.list. An assume agent has no main session: its body is its MCP connections, and this stream is its broadcast point, which every live connection of the agent hears at once. It carries two events, each with an SSE id: inbox.letter_delivered { letter_id, sender, sender_name, summary, thread, create_time } when a letter arrives (the letter stays unread; take it with the agent's inbox tool, the body is not in the event), and cognition.ritual_held { ritual, owner, title, engram, create_time } when a domain gives the agent a memory. Reconnect with the Last-Event-ID header to receive what you missed from a short recent buffer (about an hour); a first connection replays nothing, so read agents.inbox.letters.list for mail already waiting. {agent_id} takes the agent_… id, the eight character identity number or the handle; a service agent answers 400. Closing the stream only drops your subscription and does not stop the agent.",
15598
15608
  http: "GET",
15599
15609
  path: "/agent/v1/agents/{agent_id}/events/stream",
15600
15610
  streaming: "always",
@@ -15620,6 +15630,40 @@ Idempotent. Access tokens revoked while the customer was blocked stay revoked; s
15620
15630
  }
15621
15631
  ]
15622
15632
  },
15633
+ {
15634
+ resource: "agent.agents.inbox.letters",
15635
+ method: "list",
15636
+ summary: "List an assume agent's waiting letters",
15637
+ description: "Check whether mail waits for an assume agent without taking it: answers unread, the count of delivered letters the agent has not read, and letters, the newest unread ones (id, sender address, summary, thread, create_time; never the body). Nothing is marked read, so calling it again answers the same until the agent reads its mail with its own inbox tool (praxis_assume_inbox, action \"read\"). Use it when something outside the agent has to learn that mail arrived: the local `praxis agent events wait` reads it once on start and after every reconnect to its agent's event stream, so no letter that arrived while nothing listened is missed. {agent_id} takes the agent_… id, the eight character identity number or the handle of an assume agent in your organization; any other kind answers 400 ASSUME_AGENT_REQUIRED. To read or answer the letters, use the agent's inbox tool, not this read. Example: GET /agent/v1/agents/R1M9TQ2X/inbox/letters?unread=true&limit=5.",
15638
+ http: "GET",
15639
+ path: "/agent/v1/agents/{agent_id}/inbox/letters",
15640
+ streaming: "no",
15641
+ pagination: false,
15642
+ pathParams: [
15643
+ {
15644
+ name: "agent_id",
15645
+ sdkName: "agent_id",
15646
+ description: "The assume agent: its agent_… id, eight character identity number or handle, from agents.list or the praxis-assume MCP URL; resolved in your organization. Also accepts an 8-character identity number (0–9, A–Z); malformed, absent and foreign references return 404, and response ids always use agent_…."
15647
+ }
15648
+ ],
15649
+ query: [
15650
+ {
15651
+ name: "unread",
15652
+ type: "boolean",
15653
+ enum: [
15654
+ true
15655
+ ],
15656
+ required: false,
15657
+ description: "Only true is accepted, which is also the default; this read lists waiting (unread) letters and nothing else."
15658
+ },
15659
+ {
15660
+ name: "limit",
15661
+ type: "integer",
15662
+ required: false,
15663
+ description: "How many of the newest unread letters to return, 1 to 50 (default 20); unread always counts every waiting letter."
15664
+ }
15665
+ ]
15666
+ },
15623
15667
  {
15624
15668
  resource: "agent.agents.unarchive",
15625
15669
  method: "create",
@@ -15982,18 +16026,14 @@ Praxis extension: the preview conversion endpoint. The browser never parses an u
15982
16026
  description: "Computer id (cmp_...), as returned by computers.create or computers.list."
15983
16027
  }
15984
16028
  ],
15985
- query: [],
15986
- body: {
15987
- required: true,
15988
- fields: [
15989
- {
15990
- name: "name",
15991
- type: "string",
15992
- required: true,
15993
- description: "Name of the entry or object."
15994
- }
15995
- ]
15996
- }
16029
+ query: [
16030
+ {
16031
+ name: "path",
16032
+ type: "string",
16033
+ required: true,
16034
+ description: "Absolute path of the document on the computer, for example /home/user/workspace/deck.pptx. The request has no body."
16035
+ }
16036
+ ]
15997
16037
  },
15998
16038
  {
15999
16039
  resource: "agent.computers.leases",
@@ -16985,6 +17025,68 @@ delete it. Omit the field to preserve.`
16985
17025
  ],
16986
17026
  query: []
16987
17027
  },
17028
+ {
17029
+ resource: "agent.sessions.artifacts",
17030
+ method: "list",
17031
+ summary: "List Session Artifacts (Extension)",
17032
+ description: `List the files this session delivered; an end-customer token reads its own session.
17033
+
17034
+ Own-face extension. Returns { data: Artifact[] } ordered by create_time. Each artifact is one file in the session outputs directory, or one canvas or media asset the reply pointed at (a part with kind object carrying object_type, object_id and href; one artifact per object, pointing at it again adds no version), with id, name, version, parts, source_hrefs, create_time and update_time. Delivering the same path again keeps the id and adds one to version. Files are captured seconds after the turn ends, so artifacts appear after session.status_idle; also watch the agent.artifact_delivered event. Whoever may read the session may read its artifacts; a session that is missing or not yours returns 404.`,
17035
+ http: "GET",
17036
+ path: "/agent/v1/sessions/{session_id}/artifacts",
17037
+ streaming: "no",
17038
+ pagination: false,
17039
+ pathParams: [
17040
+ {
17041
+ name: "session_id",
17042
+ sdkName: "session_id",
17043
+ description: "Session id from session creation or listing."
17044
+ }
17045
+ ],
17046
+ query: []
17047
+ },
17048
+ {
17049
+ resource: "agent.sessions.artifacts.contentUrl",
17050
+ method: "create",
17051
+ summary: "Create Artifact Content URL (Extension)",
17052
+ description: `Mint a short-lived download address for one file of an artifact.
17053
+
17054
+ Own-face extension. The body is optional: part (index into the artifact parts, default 0) and ttl_seconds (60 to 300, default 300). Returns { url, expire_time }. The address works for minutes; do not store or log it. For an object part the address serves a snapshot picture of a canvas or the own bytes of the asset; an object that no longer exists returns 404 ARTIFACT_NOT_FOUND and a failing share service returns 502. An unknown artifact or an out-of-range part returns 404 ARTIFACT_NOT_FOUND, a session that is missing or not yours returns 404, and a ttl_seconds outside 60 to 300 returns 400.`,
17055
+ http: "POST",
17056
+ path: "/agent/v1/sessions/{session_id}/artifacts/{artifact_id}/content_url",
17057
+ streaming: "no",
17058
+ pagination: false,
17059
+ pathParams: [
17060
+ {
17061
+ name: "session_id",
17062
+ sdkName: "session_id",
17063
+ description: "Session id from session creation or listing."
17064
+ },
17065
+ {
17066
+ name: "artifact_id",
17067
+ sdkName: "artifact_id",
17068
+ description: "Artifact id (art_...) from the artifact list or an agent.artifact_delivered event."
17069
+ }
17070
+ ],
17071
+ query: [],
17072
+ body: {
17073
+ required: false,
17074
+ fields: [
17075
+ {
17076
+ name: "part",
17077
+ type: "integer",
17078
+ required: false,
17079
+ description: "Index into the artifact's parts; defaults to 0."
17080
+ },
17081
+ {
17082
+ name: "ttl_seconds",
17083
+ type: "integer",
17084
+ required: false,
17085
+ description: "How long the address works, 60 to 300 seconds; defaults to 300."
17086
+ }
17087
+ ]
17088
+ }
17089
+ },
16988
17090
  {
16989
17091
  resource: "agent.sessions.backgroundTasks",
16990
17092
  method: "list",
@@ -17168,7 +17270,7 @@ Praxis extension available only on /agent/v1, following Claude Agent SDK getCont
17168
17270
  resource: "agent.sessions.events",
17169
17271
  method: "list",
17170
17272
  summary: "List session events",
17171
- description: "Read the event history of a session as a page of events, oldest first by default (order=desc for newest first). Use it after sending a message to collect the reply, to find tool calls that wait for approval or client custom tool results (session.status_idle with stop_reason requires_action lists their event_ids), or to audit a run; to follow a running session live use sessions.events.stream instead. Filter by types and by a created_at range on processed_at; pages hold at most 100 events (default 20) and next_page continues. A failed run emits session.error before session.status_terminated. Native history also includes user.steer, user.withdraw, system.notification, session.forked, session.goal_changed and session.goal_verification; these are not accepted by the /anthropic/v1 event-type filter. This operation addresses one session — normally a worker session an agent dispatched; to talk to a personal or general agent itself, use agents.events.list instead. In the path, session_id may also be `main` (your own main session with that agent) or a short session name, and either alias then requires agent_id with the agent_… id, the eight character identity number or the handle; only the own face /agent/v1 accepts an alias, /anthropic/v1 requires a real sesn_… id.",
17273
+ description: "Read the event history of a session as a page of events, oldest first by default (order=desc for newest first). Use it after sending a message to collect the reply, to find tool calls that wait for approval or client custom tool results (session.status_idle with stop_reason requires_action lists their event_ids; a request nobody answered within 24 hours is settled as unanswered and the session goes idle with stop_reason request_expired, which the /anthropic/v1 face shows as end_turn), or to audit a run; to follow a running session live use sessions.events.stream instead. Filter by types and by a created_at range on processed_at; pages hold at most 100 events (default 20) and next_page continues. A failed run emits session.error before session.status_terminated. Native history also includes user.steer, user.withdraw, system.notification, system.notification_suppressed (pending background notifications that hit the wake quota and started no run), system.notification_recorded, session.forked, session.goal_changed and session.goal_verification; these are not accepted by the /anthropic/v1 event-type filter. This operation addresses one session — normally a worker session an agent dispatched; to talk to a personal or general agent itself, use agents.events.list instead. In the path, session_id may also be `main` (your own main session with that agent) or a short session name, and either alias then requires agent_id with the agent_… id, the eight character identity number or the handle; only the own face /agent/v1 accepts an alias, /anthropic/v1 requires a real sesn_… id.",
17172
17274
  http: "GET",
17173
17275
  path: "/agent/v1/sessions/{session_id}/events",
17174
17276
  streaming: "no",
@@ -17327,6 +17429,26 @@ Available only on /agent/v1. Use the message_id field from own-face events, not
17327
17429
  ]
17328
17430
  }
17329
17431
  },
17432
+ {
17433
+ resource: "agent.sessions.requests",
17434
+ method: "list",
17435
+ summary: "List Session Requests (Extension)",
17436
+ description: `List the requests a session is waiting on; an end-customer token reads its own session.
17437
+
17438
+ Own-face extension. When a session stops at session.status_idle with stop_reason requires_action, read what it waits on here instead of replaying events. Returns { data: Request[] } ordered by create_time, an empty array when nothing is pending, not paginated. Each request has id (the pending tool call id), object (request), kind (question for the ask_user_question tool, approval for any other tool that waits for permission), status (pending), tool_name, input (the same input the agent.tool_use event shows), create_time and expire_time. Answer a request as before: send a user.tool_confirmation event for its id. expire_time is set only for a session with no collaboration mode while the requests-v1 release is on (create_time plus 24 hours; an expired request counts as declined), otherwise null. Answered, expired and superseded requests are not listed, and neither are pending custom tool results (user.custom_tool_result). Whoever may read the session may read its requests; a session that is missing or not yours returns 404.`,
17439
+ http: "GET",
17440
+ path: "/agent/v1/sessions/{session_id}/requests",
17441
+ streaming: "no",
17442
+ pagination: false,
17443
+ pathParams: [
17444
+ {
17445
+ name: "session_id",
17446
+ sdkName: "session_id",
17447
+ description: "Session id from session creation or listing."
17448
+ }
17449
+ ],
17450
+ query: []
17451
+ },
17330
17452
  {
17331
17453
  resource: "agent.sessions.resources",
17332
17454
  method: "list",
@@ -25379,6 +25501,12 @@ Published at https://docs.deepraxis.com/docs/developers/cut/script-reference wit
25379
25501
  - \`RippleDeleteRange\` — Cut a time range and close the gap.
25380
25502
  - \`DeleteWords\` — Cut transcript words and ripple every track, keeping a breath.
25381
25503
  - \`RemoveFillers\` — List and delete filler words by media's own labels; dryRun first.
25504
+ - \`Matte\` — Replace the clip's background with media's matte of its source, read as a luma mask.
25505
+ - \`EnhanceVoice\` — Replace a clip's sound with media's enhanced speech on its own audio track.
25506
+ - \`AlignByAudio\` — Line two recordings of the same sound up by media's measurement of their offset.
25507
+ - \`Reframe\` — Swap the clip's media for media's reframed take at the aspect you ask for.
25508
+ - \`Upscale\` — Swap the clip's media for media's upscaled take at the height you ask for.
25509
+ - \`Redact\` — Pixelate the faces, QR codes or text media marks, leaving the rest of the frame plain.
25382
25510
  - \`AddTrack\` — Add a video, audio or caption track.
25383
25511
  - \`MoveTrack\` — Move a track between layers; 0 is the topmost.
25384
25512
  - \`UpdateTrack\` — Change a track's name, lock, gain or role.
@@ -25482,6 +25610,9 @@ Published at https://docs.deepraxis.com/docs/developers/cut/script-reference wit
25482
25610
  - \`MEDIA_OFFLINE\` — The asset cannot be fetched right now.
25483
25611
  - \`MEDIA_UNAVAILABLE\` — The asset is not usable for rendering.
25484
25612
  - \`MEDIA_IMPORT_FAILED\` — Importing media failed.
25613
+ - \`MEDIA_PROCESSING\` — Media is still processing the clip; wait for the job and rerun.
25614
+ - \`MEDIA_PROCESSING_FAILED\` — Media's processing job failed; nothing changed.
25615
+ - \`ALIGNMENT_UNCERTAIN\` — \`AlignByAudio\` confidence too low; nothing changed.
25485
25616
  - \`FRAME_OUT_OF_RANGE\` — The preview time is outside the project.
25486
25617
  - \`PROJECT_TOO_LARGE\` — The project exceeds the size limit.
25487
25618
  - \`RESPONSE_TOO_LARGE\` — The response would exceed its budget.
@@ -27005,7 +27136,7 @@ The default is return=minimal: success returns HTTP 201 with an empty body. Send
27005
27136
  resource: "devops.flags",
27006
27137
  method: "archive",
27007
27138
  summary: "Archive a flag",
27008
- description: "Archive a flag whose code is gone: it stops evaluating in every environment, leaves the ordinary flag list and keeps its key and history. Archiving changes the flag's lifecycle only and does not check code references: codeRefs.count on the flag is informational, and the call succeeds even while code still names the key (ticket #1881), in which case that code gets its default. 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.",
27139
+ description: "Archive a flag whose code is gone: it stops evaluating in every environment, leaves the ordinary flag list and keeps its key and history. Archiving is the delete, and the platform refuses it while the last reported scan still finds the key in code or while the flag is on in an environment: a flag whose codeRefs.count is above zero is refused with FLAG_STILL_REFERENCED, and a flag whose on state is true in any environment is refused with FLAG_HAS_LIVE_RULES, so archiving succeeds only once the code that names the key is deployed away and every environment is off. The gate reads the stored scan as it stands — an out-of-date scannedCommit is not corrected for — and there is no force flag. It is irreversible through the API: there is no unarchive call, an archived flag cannot be updated or configured, and its key stays reserved, so a later create with the same key is refused; archiving an archived flag just answers it again. A flag that may come back is turned off in its environment instead. The order is: open the flag fully (`praxis api devops flag environment update`), delete the code that names the key and deploy that, run `praxis devops flag remove <key>` (local, lists the references still naming the key), then `praxis api devops flag archive <id>`, then `praxis devops flag sync` so the local registry drops it. There is no separate delete call.",
27009
27140
  http: "POST",
27010
27141
  path: "/devops/v1/flags/{id}:archive",
27011
27142
  streaming: "no",
@@ -27869,6 +28000,42 @@ The default is return=minimal: success returns HTTP 201 with an empty body. Send
27869
28000
  }
27870
28001
  }
27871
28002
  },
28003
+ {
28004
+ resource: "devops.projects.flags",
28005
+ method: "reportCodeRefs",
28006
+ summary: "Report a project's flag code references",
28007
+ description: "Store one code-reference scan for a project in a single call: send the commit the scan read (scannedCommit, the checkout's `git rev-parse HEAD`) and, for every flag key the scan knows, the places code reads it ({path, line, snippet}). Send every key the checkout still expects to be referenced, including the ones found nowhere: a project flag with no entry in refs is stored with zero references, and zero is what lets `archive` see the code that named the flag is gone. A key that matches no live flag of the project — one already archived, or from another project — is returned in unknownKeys and stores nothing; reporting it is not an error. updated is how many flags were written, which is every live flag of the project because each gets a row. This is the write side of the archive gate: `POST /v1/flags/{id}:archive` refuses with FLAG_STILL_REFERENCED while the stored count is above zero, and the count it reads is exactly the one stored here. Staleness is not corrected for — the stored scannedCommit and count are used as they stand. At most 500 references are stored per flag; a longer list is truncated for storage while count still reports the true number. Reporting changes no flag's runtime behaviour.",
28008
+ http: "POST",
28009
+ path: "/devops/v1/projects/{project}/flags/code-refs",
28010
+ streaming: "no",
28011
+ pagination: false,
28012
+ pathParams: [
28013
+ {
28014
+ name: "project",
28015
+ sdkName: "project",
28016
+ description: "Identifies the project whose data you are reading, from the project list or create answer."
28017
+ }
28018
+ ],
28019
+ query: [],
28020
+ body: {
28021
+ required: true,
28022
+ fields: [
28023
+ {
28024
+ name: "scannedCommit",
28025
+ type: "string",
28026
+ required: true,
28027
+ description: "The commit this scan read, from `git rev-parse HEAD` in the reporting checkout; it is stored as each flag's codeRefs.scannedCommit, so a value older than the current head means the count describes the code as it was then."
28028
+ },
28029
+ {
28030
+ name: "refs",
28031
+ type: "array",
28032
+ itemType: "object",
28033
+ required: true,
28034
+ description: "One entry per flag key this scan judged. Send every key the checkout still expects to be referenced, including the ones found nowhere: a project flag with no entry here is stored with zero references, which is what later lets `archive` refuse only flags code still names."
28035
+ }
28036
+ ]
28037
+ }
28038
+ },
27872
28039
  {
27873
28040
  resource: "devops.projects.promotions",
27874
28041
  method: "list",
@@ -29805,7 +29972,7 @@ The default is return=minimal: success returns HTTP 201 with an empty body. Send
29805
29972
  resource: "devops.units",
29806
29973
  method: "push",
29807
29974
  summary: "Push a unit's branch",
29808
- description: "Publish the unit's local commits to the remote for the change: the machine itself holds no git credential and cannot reach the remote, so this verb is the way work done on a unit lands. ref says what to push — branch for the change's own branch, wip for this unit's own refs/praxis/wip/<change>, or a full ref name; anything else (the default branch, another change's branch, a tag, another unit's wip ref) is refused with 400 PUSH_REF_FORBIDDEN and nothing is pushed. expectedHead is the commit you believe the remote branch is at now; DevOps checks it before signing anything, and a remote that has moved since answers 409 HEAD_MOVED with nothing pushed, so fetch first when unsure, reconcile, and send the new head. For branch the call also takes a lease on that head, so the push cannot silently overwrite work that landed in between; wip is this change's own ref and is force-pushed. On success the answer is pushedSha, the commit that landed. Commit inside the machine first, through the sandbox instance API — this verb pushes commits, it does not create them. The unit must be available with a machine and a checkout, or the call answers 409 UNIT_INVALID_STATE; a push that fails inside the machine answers 500 EXECUTION_FAILED and the machine's own words are in the unit's transitions.",
29975
+ description: "Publish the unit's local commits to the remote for the change: the machine itself holds no git credential and cannot reach the remote, so this verb is the way work done on a unit lands. ref says what to push — branch for the change's own branch, wip for this unit's own refs/praxis/wip/<change>, or a full ref name; anything else (the default branch, another change's branch, a tag, another unit's wip ref) is refused with 400 PUSH_REF_FORBIDDEN and nothing is pushed. expectedHead is the commit you believe the remote branch is at now; DevOps checks it before signing anything, and a remote that has moved since answers 409 HEAD_MOVED with nothing pushed, so fetch first when unsure, reconcile, and send the new head. For branch the call also takes a lease on that head, so the push cannot silently overwrite work that landed in between; wip is this change's own ref and is force-pushed. On success the answer is pushedSha, the commit that landed. Commit inside the machine first, through the sandbox instance API — this verb pushes commits, it does not create them. The unit must be available with a machine and a checkout, or the call answers 409 UNIT_INVALID_STATE; a push that git refuses inside the machine answers with the cause in the error message and in details.detail (the last 4000 characters of git's output, credentials redacted) and details.exitCode (git's exit code): 409 PUSH_REJECTED_BY_HOOK when a pre-push hook such as lefthook rejected it, so read the hook output, fix the content and push again, 409 PUSH_REJECTED_NON_FAST_FORWARD when the remote moved ahead, so fetch and reconcile, 409 HEAD_MOVED when the lease on expectedHead no longer holds, and 500 PUSH_FAILED for anything else. Do not retry the same push unchanged.",
29809
29976
  http: "POST",
29810
29977
  path: "/devops/v1/units/{id}:push",
29811
29978
  streaming: "no",
@@ -31100,7 +31267,7 @@ The default is return=minimal: success returns HTTP 201 with an empty body. Send
31100
31267
  resource: "media.libraries",
31101
31268
  method: "list",
31102
31269
  summary: "List libraries",
31103
- description: "Read a caller-owned library’s current settings, usage and lifecycle status. A deleting library remains readable; missing, foreign or purged libraries return LIBRARY_NOT_FOUND.",
31270
+ description: "List libraries owned by the caller, newest first. By default, deleting and deleted libraries are excluded; use status=deleting to find libraries awaiting purge. All supplied label pairs must match.",
31104
31271
  http: "GET",
31105
31272
  path: "/media/v1/libraries",
31106
31273
  streaming: "no",
@@ -31223,7 +31390,7 @@ The default is return=minimal: success returns HTTP 201 with an empty body. Send
31223
31390
  resource: "media.libraries",
31224
31391
  method: "delete",
31225
31392
  summary: "Delete library",
31226
- description: "Restore a deleting library before its purge_at deadline. The library becomes active again and deleted_at and purge_at are cleared; expired or non-deleting libraries cannot be restored.",
31393
+ description: "Soft-delete an active library, returning its deleting status and purge_at deadline. Asset operations and delivery become unavailable; the library can be restored before purge_at. Repeated deletion while deleting returns the current library.",
31227
31394
  http: "DELETE",
31228
31395
  path: "/media/v1/libraries/{library_id}",
31229
31396
  streaming: "no",
@@ -31241,7 +31408,7 @@ The default is return=minimal: success returns HTTP 201 with an empty body. Send
31241
31408
  resource: "media.libraries",
31242
31409
  method: "retrieve",
31243
31410
  summary: "Get library",
31244
- description: "Update an active library’s supplied settings. Labels replace the complete map; understanding settings and model roles merge with current values. Changing the embedding model is rejected while assets exist.",
31411
+ description: "Read a caller-owned library’s current settings, usage and lifecycle status. A deleting library remains readable; missing, foreign or purged libraries return LIBRARY_NOT_FOUND.",
31245
31412
  http: "GET",
31246
31413
  path: "/media/v1/libraries/{library_id}",
31247
31414
  streaming: "no",
@@ -31319,7 +31486,7 @@ The default is return=minimal: success returns HTTP 201 with an empty body. Send
31319
31486
  resource: "media.libraries.assets",
31320
31487
  method: "list",
31321
31488
  summary: "List assets",
31322
- description: "Upload content into an active library and return the stored asset. Use file for a multipart file, data URI, public HTTPS URL or same-owner file identifier. Reusing public_id overwrites by default; overwrite=false returns the existing asset. Chunk uploads require both chunk headers.",
31489
+ description: "List assets in an active library, newest first, optionally filtering by exact folder and stored resource type. Continue using next_cursor; video includes audio-only assets.",
31323
31490
  http: "GET",
31324
31491
  path: "/media/v1/libraries/{library_id}/assets",
31325
31492
  streaming: "no",
@@ -31386,7 +31553,7 @@ The default is return=minimal: success returns HTTP 201 with an empty body. Send
31386
31553
  resource: "media.libraries.assets",
31387
31554
  method: "create",
31388
31555
  summary: "Upload asset",
31389
- description: " For understanding, Media generates proxies for video sources of 25 MB or more or longer than 10 minutes, and for audio-only sources of 100 MB or more; originals remain available unchanged. Long videos are supported. When a video proxy is needed and is still above 95 MB after recompression, the source is reported as UNSUPPORTED with the limit in the failure message. Proxy preparation uses the organization’s metered sandbox resources.",
31556
+ description: "Upload content into an active library and return the stored asset. Use file for a multipart file, data URI, public HTTPS URL or same-owner file identifier. Reusing public_id overwrites by default; overwrite=false returns the existing asset. Chunk uploads require both chunk headers. For understanding, Media generates proxies for video sources of 25 MB or more or longer than 10 minutes, and for audio-only sources of 100 MB or more; originals remain available unchanged. Long videos are supported. When a video proxy is needed and is still above 95 MB after recompression, the source is reported as UNSUPPORTED with the limit in the failure message. Proxy preparation uses the organization’s metered sandbox resources.",
31390
31557
  http: "POST",
31391
31558
  path: "/media/v1/libraries/{library_id}/assets",
31392
31559
  streaming: "no",
@@ -31609,7 +31776,7 @@ The default is return=minimal: success returns HTTP 201 with an empty body. Send
31609
31776
  resource: "media.libraries.assets",
31610
31777
  method: "delete",
31611
31778
  summary: "Delete asset",
31612
- description: "Queue reprocessing of the asset’s current version and return its updated state immediately. Omit kinds to retry failed tasks and legacy source-size unsupported tasks; explicit kinds rerun applicable completed tasks and recoverable source-size unsupported tasks. Other unsupported causes remain unchanged. Replaced understandings become superseded, and processing finishes asynchronously.",
31779
+ description: "Delete an asset from the library so it is no longer readable, searchable or deliverable. This removes the asset rather than placing it in the library’s restoration window; a missing asset returns ASSET_NOT_FOUND.",
31613
31780
  http: "DELETE",
31614
31781
  path: "/media/v1/libraries/{library_id}/assets/{asset_id}",
31615
31782
  streaming: "no",
@@ -31632,7 +31799,7 @@ The default is return=minimal: success returns HTTP 201 with an empty body. Send
31632
31799
  resource: "media.libraries.assets",
31633
31800
  method: "retrieve",
31634
31801
  summary: "Get asset",
31635
- description: "Update an asset’s supplied metadata fields. Tags and context replace their current collections; an empty collection clears them. Moving asset_folder or changing display_name preserves public_id and delivery URLs.",
31802
+ description: "Read a non-deleted asset by its asset_id in an active library, including content hashes, processing progress and available previews. Missing or deleted assets return ASSET_NOT_FOUND.",
31636
31803
  http: "GET",
31637
31804
  path: "/media/v1/libraries/{library_id}/assets/{asset_id}",
31638
31805
  streaming: "no",
@@ -31662,7 +31829,7 @@ The default is return=minimal: success returns HTTP 201 with an empty body. Send
31662
31829
  resource: "media.libraries.assets",
31663
31830
  method: "update",
31664
31831
  summary: "Update asset",
31665
- description: "Delete an asset from the library so it is no longer readable, searchable or deliverable. This removes the asset rather than placing it in the library’s restoration window; a missing asset returns ASSET_NOT_FOUND.",
31832
+ description: "Update an asset’s supplied metadata fields. Tags and context replace their current collections; an empty collection clears them. Moving asset_folder or changing display_name preserves public_id and delivery URLs.",
31666
31833
  http: "PATCH",
31667
31834
  path: "/media/v1/libraries/{library_id}/assets/{asset_id}",
31668
31835
  streaming: "no",
@@ -31711,11 +31878,57 @@ The default is return=minimal: success returns HTTP 201 with an empty body. Send
31711
31878
  ]
31712
31879
  }
31713
31880
  },
31881
+ {
31882
+ resource: "media.libraries.assets.align",
31883
+ method: "create",
31884
+ summary: "Align asset",
31885
+ description: "Align two recordings by their sound and learn how they line up, without producing an asset. The route names the source asset; the body names the reference to compare against it. Both must be audio or a video, of the same library; anything else is refused with REFERENCE_TYPE_MISMATCH before a job exists. The call is an analysis: it decides and charges nothing else, bills per second of input, and stores no asset — the completed job carries the answer in result, offset_seconds saying how many seconds later the reference starts (so a caller holding both recordings knows which one to slide) and confidence how sure the correlation is. The analysis is idempotent on the source, the reference and the parameters: asking again with the same pair answers the completed job and its result instead of analysing and charging again. A max_offset_seconds caps how far apart the two may be; alignment needs an alignment model from the platform model catalogue, and with none published the request is refused with OPERATION_NOT_SUPPORTED, 尚未上架. Send Idempotency-Key, or idempotency_key in the body, to retry without analysing twice. The response is 202 with a queued Job whose operation is align; poll GET /media/v1/libraries/{library_id}/jobs/{job_id} until it is completed or failed, then read result. Example: POST /media/v1/libraries/lib_example/assets/9dfa312ef9bc4b00816339b598b1152c/align with {\"reference_asset_id\":\"3f2a9c1e5b7d4e6f8a0b1c2d3e4f5a6b\",\"max_offset_seconds\":30}.",
31886
+ http: "POST",
31887
+ path: "/media/v1/libraries/{library_id}/assets/{asset_id}/align",
31888
+ streaming: "no",
31889
+ pagination: false,
31890
+ pathParams: [
31891
+ {
31892
+ name: "library_id",
31893
+ sdkName: "library_id",
31894
+ description: "Library ID returned by creation."
31895
+ },
31896
+ {
31897
+ name: "asset_id",
31898
+ sdkName: "asset_id",
31899
+ description: "32-character asset ID."
31900
+ }
31901
+ ],
31902
+ query: [],
31903
+ body: {
31904
+ required: true,
31905
+ fields: [
31906
+ {
31907
+ name: "reference_asset_id",
31908
+ type: "string",
31909
+ required: true,
31910
+ description: "Asset to align against the one the route names. It must be an audio or video asset of the same library, otherwise the request is refused with REFERENCE_TYPE_MISMATCH before a job exists."
31911
+ },
31912
+ {
31913
+ name: "max_offset_seconds",
31914
+ type: "number",
31915
+ required: false,
31916
+ description: "Largest offset to search for, in seconds; omit it to let the model search its full range. Zero and negative values are refused with INVALID_PARAMS."
31917
+ },
31918
+ {
31919
+ name: "idempotency_key",
31920
+ type: "string",
31921
+ required: false,
31922
+ description: "Stable key so a retried request reuses the same job instead of analysing and charging again; reusing it with different content is rejected."
31923
+ }
31924
+ ]
31925
+ }
31926
+ },
31714
31927
  {
31715
31928
  resource: "media.assets",
31716
31929
  method: "edit",
31717
31930
  summary: "Edit asset",
31718
- description: "Edit an existing asset and store the result as a new asset. Use library_id from creation or listing and asset_id from asset creation or listing; library_id also accepts the literal default, which resolves to the organization’s default library before the credential check. The source asset is never overwritten: the new asset hangs under it in the edit chain, records it in derived_from, and reads back with assets.lineage, so earlier steps stay reachable. The body is operation plus the optional model, asset_folder, understanding and idempotency_key; operation.type selects the edit and carries that operation’s own fields. This release performs variations, inpaint, erase, replace_object, recolor, remove_background and replace_background on images; every other type in the operation vocabulary — the video and audio edits — is refused with OPERATION_NOT_SUPPORTED. 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\"}}.",
31931
+ description: "Edit an existing asset and store the result as a new asset. Use library_id from creation or listing and asset_id from asset creation or listing; library_id also accepts the literal default, which resolves to the organization’s default library before the credential check. The source asset is never overwritten: the new asset hangs under it in the edit chain, records it in derived_from, and reads back with assets.lineage, so earlier steps stay reachable. The body is operation plus the optional model, asset_folder, understanding and idempotency_key; operation.type selects the edit and carries that operation’s own fields. This release performs variations, inpaint, erase, replace_object, recolor and replace_background on images, remove_background on an image or a video, upscale, enhance_voice, reframe and redact through Media’s processing lane (upscale on a picture or a video; enhance_voice on a recording or a video, whose audio is used; reframe and redact on a video), and to_video, frame and resynthesize on the material each takes; every other type in the operation vocabulary is refused with OPERATION_NOT_SUPPORTED. The processing lane takes its model from the platform model catalogue, judged by the operation’s capability and overridable with operation.model, and bills per second of input; each edit is idempotent on the source, the operation and the parameters, so a second request that would make the same asset answers the asset already made instead of paying again, and an operation whose catalogue list is empty is refused with OPERATION_NOT_SUPPORTED, 尚未上架. remove_background on a video produces a portrait matte video for compositing without a green screen: output picks mask (a black-and-white matte as a small H.264 video, person white and background black: use it as a Cut track mask with channel luma under the original video to lay a lecturer over slides — the choice for compositing) or alpha (the default: the person on a transparent background as ProRes 4444, which is very large, about 870 MB per 15 seconds of 1080p, so ask for it only when a transparent file itself is the deliverable), and model picks the matting model from types.matting.models of the generation capabilities — read it first, because a request that names none takes the first available matting model and a video is refused with OPERATION_NOT_SUPPORTED, in the model field, when the platform has published none. output and model mean nothing for an image source and are refused with INVALID_PARAMS naming the field rather than ignored. inpaint takes mask, a PNG File identifier beginning with file- whose transparent area marks the region to replace, plus the prompt describing what belongs there. Aspects beyond the source asset’s material type return REFERENCE_TYPE_MISMATCH. Editing is billed by the model usage it consumes, at the same prices as the model API, and the job reports the charge in usage (US dollars, six decimals) and the new asset carries it in provenance.cost; when the job is done, tell the person the usage amount and give them the output’s viewer_url. The response is 202 with a queued Job whose type is image, whose operation is the edit applied, and whose source_asset_id is the asset edited; poll GET /media/v1/libraries/{library_id}/jobs/{job_id} until it is completed or failed, then read the produced asset. Example: POST /media/v1/libraries/lib_example/assets/9dfa312ef9bc4b00816339b598b1152c/edits with {\"operation\":{\"type\":\"variations\",\"strength\":\"subtle\"}}.",
31719
31932
  http: "POST",
31720
31933
  path: "/media/v1/libraries/{library_id}/assets/{asset_id}/edits",
31721
31934
  streaming: "no",
@@ -31740,7 +31953,7 @@ The default is return=minimal: success returns HTTP 201 with an empty body. Send
31740
31953
  name: "operation",
31741
31954
  type: "object",
31742
31955
  required: true,
31743
- description: "One edit to apply to the source asset. type selects the operation and the discriminating branch carries that operation’s fields. This release performs variations, inpaint, erase, replace_object, recolor, remove_background and replace_background on images; every other type here describes the operation vocabulary and is refused with OPERATION_NOT_SUPPORTED."
31956
+ description: "One edit to apply to the source asset. type selects the operation and the discriminating branch carries that operation’s fields. This release performs variations, inpaint, erase, replace_object, recolor and replace_background on images, remove_background on an image or a video, upscale, enhance_voice, reframe and redact through Media’s processing lane (upscale on a picture or a video; enhance_voice on a recording or a video, whose audio is used; reframe and redact on a video), and to_video, frame and resynthesize on the material each takes; every other type here describes the operation vocabulary and is refused with OPERATION_NOT_SUPPORTED. align is not an edit — it compares two assets and has its own endpoint, POST /media/v1/libraries/{library_id}/assets/{asset_id}/align."
31744
31957
  },
31745
31958
  {
31746
31959
  name: "model",
@@ -31846,7 +32059,7 @@ The default is return=minimal: success returns HTTP 201 with an empty body. Send
31846
32059
  resource: "media.libraries.assets.reprocess",
31847
32060
  method: "create",
31848
32061
  summary: "Reprocess asset",
31849
- description: " For understanding, Media generates proxies for video sources of 25 MB or more or longer than 10 minutes, and for audio-only sources of 100 MB or more; originals remain available unchanged. Long videos are supported. When a video proxy is needed and is still above 95 MB after recompression, the source is reported as UNSUPPORTED with the limit in the failure message. Proxy preparation uses the organization’s metered sandbox resources.",
32062
+ description: "Queue reprocessing of the asset’s current version and return its updated state immediately. Omit kinds to retry failed tasks and legacy source-size unsupported tasks; explicit kinds rerun applicable completed tasks and recoverable source-size unsupported tasks. Other unsupported causes remain unchanged. Replaced understandings become superseded, and processing finishes asynchronously. For understanding, Media generates proxies for video sources of 25 MB or more or longer than 10 minutes, and for audio-only sources of 100 MB or more; originals remain available unchanged. Long videos are supported. When a video proxy is needed and is still above 95 MB after recompression, the source is reported as UNSUPPORTED with the limit in the failure message. Proxy preparation uses the organization’s metered sandbox resources.",
31850
32063
  http: "POST",
31851
32064
  path: "/media/v1/libraries/{library_id}/assets/{asset_id}/reprocess",
31852
32065
  streaming: "no",
@@ -31948,7 +32161,7 @@ The default is return=minimal: success returns HTTP 201 with an empty body. Send
31948
32161
  resource: "media.libraries.assets.versions",
31949
32162
  method: "restore",
31950
32163
  summary: "Restore asset version",
31951
- description: "Make a kept version of an asset its current bytes again. Use asset_id from a listing and version_id from GET /media/v1/libraries/{library_id}/assets/{asset_id}?versions=true; versions exist only for assets overwritten while the library’s backup setting was on. A restore is itself an overwrite: the version number increases, understanding runs again on the restored bytes, and the bytes it replaces are always kept as a version, whatever the backup setting says, so restoring never loses anything. A version whose bytes are another kind than the asset is now (an image overwritten by a video) is refused with OPERATION_NOT_SUPPORTED. Restoring is free. Example: POST /media/v1/libraries/lib_example/assets/9dfa312ef9bc4b00816339b598b1152c/versions/3f2a9c1e5b7d4e6f8a0b1c2d3e4f5a6b/restore.",
32164
+ description: "Make a kept version of an asset its current bytes again. Use asset_id from a listing and version_id from GET /media/v1/libraries/{library_id}/assets/{asset_id}?versions=true; versions exist only for assets overwritten while the library’s backup setting was on. A restore is itself an overwrite: the restored bytes become a new version numbered past the highest (its restored_from names the version it came from), understanding runs again on the restored bytes, and the bytes it replaces are always kept as a version, whatever the backup setting says, so restoring never loses anything. A version whose bytes are another kind than the asset is now (an image overwritten by a video) is refused with OPERATION_NOT_SUPPORTED. Restoring is free. Example: POST /media/v1/libraries/lib_example/assets/9dfa312ef9bc4b00816339b598b1152c/versions/3f2a9c1e5b7d4e6f8a0b1c2d3e4f5a6b/restore.",
31952
32165
  http: "POST",
31953
32166
  path: "/media/v1/libraries/{library_id}/assets/{asset_id}/versions/{version_id}/restore",
31954
32167
  streaming: "no",
@@ -32113,7 +32326,7 @@ The default is return=minimal: success returns HTTP 201 with an empty body. Send
32113
32326
  resource: "media.libraries.batches",
32114
32327
  method: "retrieve",
32115
32328
  summary: "Get batch",
32116
- description: "Alias of batch retrieval. Read the job returned by a batch request, including terminal status, successful and failed counts, and individual failure codes.",
32329
+ description: "Read a batch job’s status, successful and failed item counts, and a bounded list of failed items. Use the id returned by batch creation; a job outside this library is not found.",
32117
32330
  http: "GET",
32118
32331
  path: "/media/v1/libraries/{library_id}/batches/{job_id}",
32119
32332
  streaming: "no",
@@ -32218,7 +32431,7 @@ The default is return=minimal: success returns HTTP 201 with an empty body. Send
32218
32431
  resource: "media.libraries.folders",
32219
32432
  method: "list",
32220
32433
  summary: "List folders",
32221
- description: "undefined understood_count includes ready and partial assets; failed_count includes failed assets. Both accumulate descendants. counts_complete is false during historical backfill.",
32434
+ description: "List all immediate child folders under parent, or under the root when parent is omitted. Counts include descendant assets. The result is unpaginated; limit and cursor are rejected. understood_count includes ready and partial assets; failed_count includes failed assets. Both accumulate descendants. counts_complete is false during historical backfill.",
32222
32435
  http: "GET",
32223
32436
  path: "/media/v1/libraries/{library_id}/folders",
32224
32437
  streaming: "no",
@@ -32589,7 +32802,7 @@ The default is return=minimal: success returns HTTP 201 with an empty body. Send
32589
32802
  resource: "media.libraries.purge",
32590
32803
  method: "create",
32591
32804
  summary: "Purge library",
32592
- description: "List assets in an active library, newest first, optionally filtering by exact folder and stored resource type. Continue using next_cursor; video includes audio-only assets.",
32805
+ description: "Permanently remove a library that is already deleting, without waiting for purge_at. Its assets and related resources are removed and cannot be restored; first soft-delete an active library.",
32593
32806
  http: "POST",
32594
32807
  path: "/media/v1/libraries/{library_id}/purge",
32595
32808
  streaming: "no",
@@ -32607,7 +32820,7 @@ The default is return=minimal: success returns HTTP 201 with an empty body. Send
32607
32820
  resource: "media.libraries",
32608
32821
  method: "restore",
32609
32822
  summary: "Restore library",
32610
- description: "Permanently remove a library that is already deleting, without waiting for purge_at. Its assets and related resources are removed and cannot be restored; first soft-delete an active library.",
32823
+ description: "Restore a deleting library before its purge_at deadline. The library becomes active again and deleted_at and purge_at are cleared; expired or non-deleting libraries cannot be restored.",
32611
32824
  http: "POST",
32612
32825
  path: "/media/v1/libraries/{library_id}/restore",
32613
32826
  streaming: "no",
@@ -32625,7 +32838,7 @@ The default is return=minimal: success returns HTTP 201 with an empty body. Send
32625
32838
  resource: "media.libraries.search",
32626
32839
  method: "create",
32627
32840
  summary: "Semantic search alias",
32628
- description: "Create an asynchronous batch for tagging, untagging, replacing context, moving or deleting assets. Select ids or an expression; selection is frozen at creation. Poll the returned job id for completion and per-item failures.",
32841
+ description: "Alias of semantic search. Search assets with a nonblank text query, optional expression filter and top_k; hybrid combines semantic and keyword matches, while semantic uses vector similarity only.",
32629
32842
  http: "POST",
32630
32843
  path: "/media/v1/libraries/{library_id}/search",
32631
32844
  streaming: "no",
@@ -32700,7 +32913,7 @@ The default is return=minimal: success returns HTTP 201 with an empty body. Send
32700
32913
  resource: "media.libraries.search.expression",
32701
32914
  method: "create",
32702
32915
  summary: "Expression search",
32703
- description: "Search assets with a nonblank text query and optional expression filter. Hybrid mode combines semantic and keyword matches; semantic mode uses vector similarity only. Results are ranked and limited by top_k.",
32916
+ description: "Search active assets using the supported filter-expression syntax, sorting and cursor pagination. Empty expression matches all assets. Tags and context require with_field; inspect the exactness flags before treating counts as complete.",
32704
32917
  http: "POST",
32705
32918
  path: "/media/v1/libraries/{library_id}/search/expression",
32706
32919
  streaming: "no",
@@ -32720,7 +32933,7 @@ The default is return=minimal: success returns HTTP 201 with an empty body. Send
32720
32933
  name: "expression",
32721
32934
  type: "string",
32722
32935
  required: false,
32723
- description: 'Asset filter expression supporting field comparisons, AND, OR, NOT, parentheses and suffix wildcards. An empty expression matches all assets. For business metadata use context.sku=KETTLE-RED AND context.revision=2; request with_field: ["context"] to include context. color:"#c0392b" matches an analysed image with a dominant colour within RGB distance 60 of the named colour covering at least a tenth of it; duplicate:true matches assets another live asset shares the same bytes with. Quality filters: flags:watermark matches any current shot with a watermark; flags.watermark:false requires an assessed video with no positive watermark judgment. The same syntax supports slideshow, hand_frame, text_sticker and low_quality. folder_mismatch:true selects lexical folder/location hints. Geometry filters support width, height, resolution:1920x1080, numeric aspect_ratio (width/height), and orientation:landscape, portrait or square. Missing geometry or unassessed legacy flags do not match positive filters. has_music:true AND audio_genre:jazz AND audio_mood:calm selects current-version audio profiles with music and matching model labels; has_music:false applies only to sampled ranges, not the entire source. failure_code=UPSTREAM_FAILED selects assets with a current failed understanding carrying that code; combine with processing_state=failed or processing_state=partial.'
32936
+ description: 'Asset filter expression supporting field comparisons, AND, OR, NOT, parentheses and suffix wildcards. An empty expression matches all assets. For business metadata use context.sku=KETTLE-RED AND context.revision=2; request with_field: ["context"] to include context. color:"#c0392b" matches an analysed image with a dominant colour within RGB distance 60 of the named colour covering at least a tenth of it; duplicate:true matches assets another live asset shares the same bytes with. Quality filters: flags:watermark matches any current shot with a watermark; flags.watermark:false requires an assessed video with no positive watermark judgment. The same syntax supports slideshow, hand_frame, text_sticker and low_quality. folder_mismatch:true selects lexical folder/location hints. Geometry filters support width, height, resolution:1920x1080, numeric aspect_ratio (width/height), and orientation:landscape, portrait or square. Missing geometry or unassessed legacy flags do not match positive filters. has_music:true AND audio_genre:jazz AND audio_mood:calm selects current-version audio profiles with music and matching model labels; has_music:false applies only to sampled ranges, not the entire source. audio_role:music selects audio materials by what they are used for (voice, music or sfx), and it exists only on audio materials, so an asset without a role matches no role. failure_code=UPSTREAM_FAILED selects assets with a current failed understanding carrying that code; combine with processing_state=failed or processing_state=partial.'
32724
32937
  },
32725
32938
  {
32726
32939
  name: "sort_by",
@@ -32760,10 +32973,17 @@ The default is return=minimal: success returns HTTP 201 with an empty body. Send
32760
32973
  "material_type",
32761
32974
  "format",
32762
32975
  "asset_folder",
32763
- "processing_state"
32976
+ "processing_state",
32977
+ "audio_role"
32764
32978
  ],
32765
32979
  required: false,
32766
32980
  description: "Facets to count over matching assets, returned under aggregations."
32981
+ },
32982
+ {
32983
+ name: "stack",
32984
+ type: "boolean",
32985
+ required: false,
32986
+ description: "true answers one row per edit tree instead of every matching asset: the newest asset of that tree the expression matched, with stack_count giving how many of the tree’s assets matched. total_count then counts trees, the rows the pages return, while aggregations still count matching assets. Omitted or false returns the flat list. Only the default order is supported: naming sort_by with stack=true is refused. Edits of an asset form its tree; generated variants and uploads are trees of their own."
32767
32987
  }
32768
32988
  ]
32769
32989
  }
@@ -32772,7 +32992,7 @@ The default is return=minimal: success returns HTTP 201 with an empty body. Send
32772
32992
  resource: "media.libraries.search.semantic",
32773
32993
  method: "create",
32774
32994
  summary: "Semantic search",
32775
- description: "List all immediate child folders under parent, or under the root when parent is omitted. Counts include descendant assets. The result is unpaginated; limit and cursor are rejected.",
32995
+ description: "Search assets with a nonblank text query and optional expression filter. Hybrid mode combines semantic and keyword matches; semantic mode uses vector similarity only. Results are ranked and limited by top_k.",
32776
32996
  http: "POST",
32777
32997
  path: "/media/v1/libraries/{library_id}/search/semantic",
32778
32998
  streaming: "no",
@@ -32847,7 +33067,7 @@ The default is return=minimal: success returns HTTP 201 with an empty body. Send
32847
33067
  resource: "media.libraries.search.visual",
32848
33068
  method: "create",
32849
33069
  summary: "Visual search",
32850
- description: "Alias of semantic search. Search assets with a nonblank text query, optional expression filter and top_k; hybrid combines semantic and keyword matches, while semantic uses vector similarity only.",
33070
+ description: "Find visually similar assets using exactly one of asset_id or an inline base64 image. The library must support image search; an asset query needs a current image embedding and excludes that source asset from results.",
32851
33071
  http: "POST",
32852
33072
  path: "/media/v1/libraries/{library_id}/search/visual",
32853
33073
  streaming: "no",
@@ -34726,6 +34946,18 @@ for more details.`
34726
34946
  ]
34727
34947
  }
34728
34948
  },
34949
+ {
34950
+ resource: "model.modelAccess",
34951
+ method: "list",
34952
+ summary: "List Model Access",
34953
+ description: "List the models your organization must enable before use, together with the grants it already has. Read it to check whether a model is enabled before an inference call, or to show which marked models still need enabling; use each item's model as the id for enableModelAccess or disableModelAccess (PUT or DELETE /model/v1/models/{model}/access). Items cover every model the catalog marks access_required, granted or not, so the gated class stays discoverable, plus any other model this organization has enabled, one item per model. access_required says whether the catalog gates the model; granted says whether your organization has a grant; the prices are the model's current sell prices, what the next call costs, not the price recorded when the grant was created.",
34954
+ http: "GET",
34955
+ path: "/model/v1/model-access",
34956
+ streaming: "no",
34957
+ pagination: false,
34958
+ pathParams: [],
34959
+ query: []
34960
+ },
34729
34961
  {
34730
34962
  resource: "model.models",
34731
34963
  method: "list",
@@ -34754,8 +34986,11 @@ for more details.`
34754
34986
  "openai.images.generations",
34755
34987
  "openai.responses",
34756
34988
  "openai.videos",
34989
+ "praxis.media.process",
34990
+ "praxis.video.matting",
34757
34991
  "typesafe.systemone",
34758
34992
  "volcengine.music",
34993
+ "volcengine.vod.matting",
34759
34994
  "volcengine.voice_clone"
34760
34995
  ],
34761
34996
  required: false,
@@ -34817,6 +35052,42 @@ for more details.`
34817
35052
  ],
34818
35053
  query: []
34819
35054
  },
35055
+ {
35056
+ resource: "model.models.access",
35057
+ method: "delete",
35058
+ summary: "Disable Model Access",
35059
+ description: "Disable one model for your organization by deleting its grant, so the next call to a model that requires access is refused again with 403 MODEL_ACCESS_REQUIRED. Pass any id enableModelAccess accepts, including creator prefixes; the model may be enabled again later, and the new grant records whoever enabled it then. A model that is not currently enabled is already disabled, so deleting a grant that does not exist also answers 200 with revoked true; only an id no catalog model carries answers 404 MODEL_NOT_FOUND.",
35060
+ http: "DELETE",
35061
+ path: "/model/v1/models/{model}/access",
35062
+ streaming: "no",
35063
+ pagination: false,
35064
+ pathParams: [
35065
+ {
35066
+ name: "model",
35067
+ sdkName: "model",
35068
+ description: "Model ID the organization no longer wants enabled; same ids as enableModelAccess."
35069
+ }
35070
+ ],
35071
+ query: []
35072
+ },
35073
+ {
35074
+ resource: "model.models.access",
35075
+ method: "update",
35076
+ summary: "Enable Model Access",
35077
+ description: "Enable one model for your organization so a call to it is allowed. Call it when an inference request was refused with 403 MODEL_ACCESS_REQUIRED, or ahead of time for a model the catalog marks access_required: true; the refusal message and praxis.model.models.list name the model id to pass here. The id resolves exactly as a chat call resolves it, including any creator prefix such as deepseek/deepseek-v4-pro, and an id no catalog model carries answers 404 MODEL_NOT_FOUND. Enabling is organization-wide and needs no approval, and it is idempotent: a second call returns the first grant unchanged, keeping its author, its timestamp and the USD-per-million-token price snapshot it recorded then. Enabling a model that does not require access is allowed and makes no difference to gating.",
35078
+ http: "PUT",
35079
+ path: "/model/v1/models/{model}/access",
35080
+ streaming: "no",
35081
+ pagination: false,
35082
+ pathParams: [
35083
+ {
35084
+ name: "model",
35085
+ sdkName: "model",
35086
+ description: "Model ID as the catalog lists it, including any creator prefix; primary ids, aliases and prefixed ids resolve the same way a chat call resolves them."
35087
+ }
35088
+ ],
35089
+ query: []
35090
+ },
34820
35091
  {
34821
35092
  resource: "model.ocr",
34822
35093
  method: "create",
@@ -36236,7 +36507,7 @@ for more details.`
36236
36507
  resource: "organization.actors",
36237
36508
  method: "list",
36238
36509
  summary: "List actors holding positions",
36239
- description: "Lists every actor, person or agent, that currently holds at least one position, ordered by actor address, each with its primary position and all positions it holds; use it to see who works where. Actors holding nothing are not listed. Pass next_page unchanged as page; null means the end. Read-only. Errors: 400 INVALID_PARAMS for an unknown query parameter, a limit outside 1 to 100 or a stale cursor; 403 PERMISSION_DENIED for session and run tokens. Example: GET /organization/v1/actors?department_id=dept_123.",
36510
+ description: "Lists every actor, person or agent, that currently holds at least one position, ordered by actor address, each with its primary position and all positions it holds; use it to see who works where. Actors holding nothing are not listed. Pass next_page unchanged as page; null means the end. Read-only. Errors: 400 INVALID_PARAMS for an unknown query parameter, a limit outside 1 to 100 or a stale cursor; 403 PERMISSION_DENIED for a run or computer token, or a session token that names no agent. Example: GET /organization/v1/actors?department_id=dept_123.",
36240
36511
  http: "GET",
36241
36512
  path: "/organization/v1/actors",
36242
36513
  streaming: "no",
@@ -36267,7 +36538,7 @@ for more details.`
36267
36538
  resource: "organization.actors",
36268
36539
  method: "retrieve",
36269
36540
  summary: "Get the position chain of an actor",
36270
- description: "Reads where an actor, person or agent, sits in the organization: its primary position and its concurrent positions, each with the department path from the root down with every level's charter, the job, title and level name, the manager (the first filled position up the reporting line), the position's own duties and methods, and objectives. Use it to answer who this actor is and what it is responsible for. An actor that holds no position is not an error: primary is null and concurrent is empty. Read-only. Errors: 403 PERMISSION_DENIED for session and run tokens.",
36541
+ description: "Reads where an actor, person or agent, sits in the organization: its primary position and its concurrent positions, each with the department path from the root down with every level's charter, the job, title and level name, the manager (the first filled position up the reporting line), the position's own duties and methods, and objectives. Use it to answer who this actor is and what it is responsible for. An actor that holds no position is not an error: primary is null and concurrent is empty. Read-only. Errors: 403 PERMISSION_DENIED for a run or computer token, or a session token that names no agent.",
36271
36542
  http: "GET",
36272
36543
  path: "/organization/v1/actors/{actor}",
36273
36544
  streaming: "no",
@@ -36285,7 +36556,7 @@ for more details.`
36285
36556
  resource: "organization.assignments",
36286
36557
  method: "list",
36287
36558
  summary: "List assignments",
36288
- description: "Lists assignments, newest start first, each tying one actor (person or agent) to one position; use it to see who holds what, or the history of a position or an actor. Ended assignments are included unless you filter active=true. Filters combine with AND. Pass next_page unchanged as page; null means the end. Read-only. Errors: 400 INVALID_PARAMS for an unknown query parameter, a limit outside 1 to 100, a non-boolean active or a stale cursor; 403 PERMISSION_DENIED for session and run tokens. Example: GET /organization/v1/assignments?position_id=pos_123&active=true.",
36559
+ description: "Lists assignments, newest start first, each tying one actor (person or agent) to one position; use it to see who holds what, or the history of a position or an actor. Ended assignments are included unless you filter active=true. Filters combine with AND. Pass next_page unchanged as page; null means the end. Read-only. Errors: 400 INVALID_PARAMS for an unknown query parameter, a limit outside 1 to 100, a non-boolean active or a stale cursor; 403 PERMISSION_DENIED for a run or computer token, or a session token that names no agent. Example: GET /organization/v1/assignments?position_id=pos_123&active=true.",
36289
36560
  http: "GET",
36290
36561
  path: "/organization/v1/assignments",
36291
36562
  streaming: "no",
@@ -36328,7 +36599,7 @@ for more details.`
36328
36599
  resource: "organization.assignments",
36329
36600
  method: "retrieve",
36330
36601
  summary: "Get an assignment",
36331
- description: "Reads one assignment, current or ended, with who appointed and ended it and, for a replaced holder, the successor's assignment id. Read-only. Errors: 404 ASSIGNMENT_NOT_FOUND when the id is not an assignment of your organization; 403 PERMISSION_DENIED for session and run tokens.",
36602
+ description: "Reads one assignment, current or ended, with who appointed and ended it and, for a replaced holder, the successor's assignment id. Read-only. Errors: 404 ASSIGNMENT_NOT_FOUND when the id is not an assignment of your organization; 403 PERMISSION_DENIED for a run or computer token, or a session token that names no agent.",
36332
36603
  http: "GET",
36333
36604
  path: "/organization/v1/assignments/{id}",
36334
36605
  streaming: "no",
@@ -36517,7 +36788,7 @@ for more details.`
36517
36788
  resource: "organization.departments",
36518
36789
  method: "list",
36519
36790
  summary: "List departments",
36520
- description: "Lists the departments of your organization's tree, including the root department; use it to find a department id or to walk the tree one level at a time with parent_id. Dissolved departments are included unless you filter status=active. Filters combine with AND. Pass next_page unchanged as page; null means the end. Read-only. Errors: 400 INVALID_PARAMS for an unknown query parameter, a limit outside 1 to 100 or a stale cursor; 403 PERMISSION_DENIED for session and run tokens. Example: GET /organization/v1/departments?status=active.",
36791
+ description: "Lists the departments of your organization's tree, including the root department; use it to find a department id or to walk the tree one level at a time with parent_id. Dissolved departments are included unless you filter status=active. Filters combine with AND. Pass next_page unchanged as page; null means the end. Read-only. Errors: 400 INVALID_PARAMS for an unknown query parameter, a limit outside 1 to 100 or a stale cursor; 403 PERMISSION_DENIED for a run or computer token, or a session token that names no agent. Example: GET /organization/v1/departments?status=active.",
36521
36792
  http: "GET",
36522
36793
  path: "/organization/v1/departments",
36523
36794
  streaming: "no",
@@ -36593,7 +36864,7 @@ for more details.`
36593
36864
  resource: "organization.departments",
36594
36865
  method: "retrieve",
36595
36866
  summary: "Get a department",
36596
- description: "Reads one department with its head position id and its charter, including the charter revision you need before amending the charter. Read-only. Errors: 404 DEPARTMENT_NOT_FOUND when the id is not a department of your organization; 403 PERMISSION_DENIED for session and run tokens.",
36867
+ description: "Reads one department with its head position id and its charter, including the charter revision you need before amending the charter. Read-only. Errors: 404 DEPARTMENT_NOT_FOUND when the id is not a department of your organization; 403 PERMISSION_DENIED for a run or computer token, or a session token that names no agent.",
36597
36868
  http: "GET",
36598
36869
  path: "/organization/v1/departments/{id}",
36599
36870
  streaming: "no",
@@ -36984,7 +37255,7 @@ for more details.`
36984
37255
  resource: "organization.jobs",
36985
37256
  method: "list",
36986
37257
  summary: "List jobs",
36987
- description: "Lists the jobs of your organization ordered by code; use it to find the job_id to open positions from. Retired jobs are included unless you filter status=active. Pass next_page unchanged as page; null means the end. Read-only. Errors: 400 INVALID_PARAMS for an unknown query parameter, a limit outside 1 to 100 or a stale cursor; 403 PERMISSION_DENIED for session and run tokens.",
37258
+ description: "Lists the jobs of your organization ordered by code; use it to find the job_id to open positions from. Retired jobs are included unless you filter status=active. Pass next_page unchanged as page; null means the end. Read-only. Errors: 400 INVALID_PARAMS for an unknown query parameter, a limit outside 1 to 100 or a stale cursor; 403 PERMISSION_DENIED for a run or computer token, or a session token that names no agent.",
36988
37259
  http: "GET",
36989
37260
  path: "/organization/v1/jobs",
36990
37261
  streaming: "no",
@@ -37067,7 +37338,7 @@ for more details.`
37067
37338
  resource: "organization.jobs",
37068
37339
  method: "retrieve",
37069
37340
  summary: "Get a job",
37070
- description: "Reads one job with its current revision, which you need before revising it. Read-only. Errors: 404 JOB_NOT_FOUND when the id is not a job of your organization; 403 PERMISSION_DENIED for session and run tokens.",
37341
+ description: "Reads one job with its current revision, which you need before revising it. Read-only. Errors: 404 JOB_NOT_FOUND when the id is not a job of your organization; 403 PERMISSION_DENIED for a run or computer token, or a session token that names no agent.",
37071
37342
  http: "GET",
37072
37343
  path: "/organization/v1/jobs/{id}",
37073
37344
  streaming: "no",
@@ -37157,7 +37428,7 @@ for more details.`
37157
37428
  resource: "organization.keyResults",
37158
37429
  method: "list",
37159
37430
  summary: "List key results",
37160
- description: "Lists key results, oldest first, each with its metric, health, done flag and, once its objective is graded, its score; use it to read the key results of one objective or the ones a position owns. Filters combine with AND. Pass next_page unchanged as page; null means the end. Read-only. Errors: 400 INVALID_PARAMS for an unknown query parameter, a limit outside 1 to 100 or a stale cursor; 403 PERMISSION_DENIED for session and run tokens. Example: GET /organization/v1/key_results?objective_id=obj_3b7a52c1e9d84f06b2a1c8e4d7f50a96.",
37431
+ description: "Lists key results, oldest first, each with its metric, health, done flag and, once its objective is graded, its score; use it to read the key results of one objective or the ones a position owns. Filters combine with AND. Pass next_page unchanged as page; null means the end. Read-only. Errors: 400 INVALID_PARAMS for an unknown query parameter, a limit outside 1 to 100 or a stale cursor; 403 PERMISSION_DENIED for a run or computer token, or a session token that names no agent. Example: GET /organization/v1/key_results?objective_id=obj_3b7a52c1e9d84f06b2a1c8e4d7f50a96.",
37161
37432
  http: "GET",
37162
37433
  path: "/organization/v1/key_results",
37163
37434
  streaming: "no",
@@ -37245,7 +37516,7 @@ for more details.`
37245
37516
  resource: "organization.keyResults",
37246
37517
  method: "retrieve",
37247
37518
  summary: "Get a key result",
37248
- description: "Reads one key result with its metric, its health, its done flag, its owner position and its score. Progress of a metric key result is (current - initial) / (target - initial), clamped between 0 and 1; a key result without a metric counts as 1 when done is true and 0 otherwise. Read-only. Errors: 404 KEY_RESULT_NOT_FOUND when the id is not a key result of your organization; 403 PERMISSION_DENIED for session and run tokens.",
37519
+ description: "Reads one key result with its metric, its health, its done flag, its owner position and its score. Progress of a metric key result is (current - initial) / (target - initial), clamped between 0 and 1; a key result without a metric counts as 1 when done is true and 0 otherwise. Read-only. Errors: 404 KEY_RESULT_NOT_FOUND when the id is not a key result of your organization; 403 PERMISSION_DENIED for a run or computer token, or a session token that names no agent.",
37249
37520
  http: "GET",
37250
37521
  path: "/organization/v1/key_results/{id}",
37251
37522
  streaming: "no",
@@ -37331,7 +37602,7 @@ for more details.`
37331
37602
  resource: "organization.ladders",
37332
37603
  method: "list",
37333
37604
  summary: "List job ladders",
37334
- description: "Lists the job ladders of your organization, oldest first, each with its levels in ascending order; use it to find the level ids for jobs and positions. Pass next_page unchanged as page; null means the end. Read-only. Errors: 400 INVALID_PARAMS for an unknown query parameter, a limit outside 1 to 100 or a stale cursor; 403 PERMISSION_DENIED for session and run tokens.",
37605
+ description: "Lists the job ladders of your organization, oldest first, each with its levels in ascending order; use it to find the level ids for jobs and positions. Pass next_page unchanged as page; null means the end. Read-only. Errors: 400 INVALID_PARAMS for an unknown query parameter, a limit outside 1 to 100 or a stale cursor; 403 PERMISSION_DENIED for a run or computer token, or a session token that names no agent.",
37335
37606
  http: "GET",
37336
37607
  path: "/organization/v1/ladders",
37337
37608
  streaming: "no",
@@ -37386,7 +37657,7 @@ for more details.`
37386
37657
  resource: "organization.ladders",
37387
37658
  method: "retrieve",
37388
37659
  summary: "Get a job ladder",
37389
- description: "Reads one job ladder with its levels in ascending order. Read-only. Errors: 404 LADDER_NOT_FOUND when the id is not a ladder of your organization; 403 PERMISSION_DENIED for session and run tokens.",
37660
+ description: "Reads one job ladder with its levels in ascending order. Read-only. Errors: 404 LADDER_NOT_FOUND when the id is not a ladder of your organization; 403 PERMISSION_DENIED for a run or computer token, or a session token that names no agent.",
37390
37661
  http: "GET",
37391
37662
  path: "/organization/v1/ladders/{id}",
37392
37663
  streaming: "no",
@@ -37404,7 +37675,7 @@ for more details.`
37404
37675
  resource: "organization.ladders",
37405
37676
  method: "update",
37406
37677
  summary: "Revise a job ladder",
37407
- description: "Replaces all levels of a ladder with the array you send. A level with an id keeps that id and takes the new name and order, a level without an id is created, and an existing level you leave out is deleted. A level cannot be deleted while an open position or a job's level_ids still refers to it; first regrade those positions or revise those jobs. The ladder name is not changed by this call. Requires an organization owner or admin. Errors: 400 INVALID_PARAMS for an empty levels array, duplicate order values, a level id sent twice or a level that is still referenced; 403 PERMISSION_DENIED; 404 LADDER_NOT_FOUND; 404 JOB_LEVEL_NOT_FOUND when a level id does not belong to this ladder.",
37678
+ description: "Replaces all levels of a ladder with the array you send. A level with an id keeps that id and takes the new name and order, a level without an id is created, and an existing level you leave out is deleted. A level cannot be deleted while an open position or a job's level_ids still refers to it; first regrade those positions or revise those jobs. Send name to rename the ladder; leave it out to keep the name. Requires an organization owner or admin. Errors: 400 INVALID_PARAMS for an empty levels array, duplicate order values, a level id sent twice or a level that is still referenced; 403 PERMISSION_DENIED; 404 LADDER_NOT_FOUND; 404 JOB_LEVEL_NOT_FOUND when a level id does not belong to this ladder.",
37408
37679
  http: "PUT",
37409
37680
  path: "/organization/v1/ladders/{id}",
37410
37681
  streaming: "no",
@@ -37420,6 +37691,12 @@ for more details.`
37420
37691
  body: {
37421
37692
  required: true,
37422
37693
  fields: [
37694
+ {
37695
+ name: "name",
37696
+ type: "string",
37697
+ required: false,
37698
+ description: "The ladder's new name; omit it to keep the current name."
37699
+ },
37423
37700
  {
37424
37701
  name: "levels",
37425
37702
  type: "array",
@@ -37459,7 +37736,7 @@ for more details.`
37459
37736
  resource: "organization.objectives",
37460
37737
  method: "list",
37461
37738
  summary: "List objectives",
37462
- description: "Lists objectives, oldest first, each with its scope, the parents it aligns to and, once graded, its result and score; use it to find an objective id or to read one period or one department's objectives. Filters combine with AND. Pass next_page unchanged as page; null means the end. Read-only. Errors: 400 INVALID_PARAMS for an unknown query parameter, a limit outside 1 to 100 or a stale cursor; 403 PERMISSION_DENIED for session and run tokens. Example: GET /organization/v1/objectives?period_id=prd_6d1f0c3a9b8e4a27a5c4e7d2f1b90a38&status=active.",
37739
+ description: "Lists objectives, oldest first, each with its scope, the parents it aligns to and, once graded, its result and score; use it to find an objective id or to read one period or one department's objectives. Filters combine with AND. Pass next_page unchanged as page; null means the end. Read-only. Errors: 400 INVALID_PARAMS for an unknown query parameter, a limit outside 1 to 100 or a stale cursor; 403 PERMISSION_DENIED for a run or computer token, or a session token that names no agent. Example: GET /organization/v1/objectives?period_id=prd_6d1f0c3a9b8e4a27a5c4e7d2f1b90a38&status=active.",
37463
37740
  http: "GET",
37464
37741
  path: "/organization/v1/objectives",
37465
37742
  streaming: "no",
@@ -37557,7 +37834,7 @@ for more details.`
37557
37834
  resource: "organization.objectives",
37558
37835
  method: "retrieve",
37559
37836
  summary: "Get an objective",
37560
- description: "Reads one objective with its scope, the parents it aligns to with their weights, its status and, once graded, its result, score and grade note. Its key results are read with the key results list filtered by objective_id. Read-only. Errors: 404 OBJECTIVE_NOT_FOUND when the id is not an objective of your organization; 403 PERMISSION_DENIED for session and run tokens.",
37837
+ description: "Reads one objective with its scope, the parents it aligns to with their weights, its status and, once graded, its result, score and grade note. Its key results are read with the key results list filtered by objective_id. Read-only. Errors: 404 OBJECTIVE_NOT_FOUND when the id is not an objective of your organization; 403 PERMISSION_DENIED for a run or computer token, or a session token that names no agent.",
37561
37838
  http: "GET",
37562
37839
  path: "/organization/v1/objectives/{id}",
37563
37840
  streaming: "no",
@@ -37694,7 +37971,7 @@ for more details.`
37694
37971
  resource: "organization.periods",
37695
37972
  method: "list",
37696
37973
  summary: "List periods",
37697
- description: "Lists the periods of your organization's OKR calendar, newest start first; use it to find the period_id to set objectives in, or to see which periods are still open for grading. Closed periods are included. Filter cadence to read one level of the calendar. Pass next_page unchanged as page; null means the end. Read-only. Errors: 400 INVALID_PARAMS for an unknown query parameter, a limit outside 1 to 100 or a stale cursor; 403 PERMISSION_DENIED for session and run tokens. Example: GET /organization/v1/periods?cadence=quarter.",
37974
+ description: "Lists the periods of your organization's OKR calendar, newest start first; use it to find the period_id to set objectives in, or to see which periods are still open for grading. Closed periods are included. Filter cadence to read one level of the calendar. Pass next_page unchanged as page; null means the end. Read-only. Errors: 400 INVALID_PARAMS for an unknown query parameter, a limit outside 1 to 100 or a stale cursor; 403 PERMISSION_DENIED for a run or computer token, or a session token that names no agent. Example: GET /organization/v1/periods?cadence=quarter.",
37698
37975
  http: "GET",
37699
37976
  path: "/organization/v1/periods",
37700
37977
  streaming: "no",
@@ -37782,7 +38059,7 @@ for more details.`
37782
38059
  resource: "organization.periods",
37783
38060
  method: "retrieve",
37784
38061
  summary: "Get a period",
37785
- description: "Reads one period with its derived status, so you can tell whether it is still planning, active, in grading or closed. Read-only. Errors: 404 PERIOD_NOT_FOUND when the id is not a period of your organization; 403 PERMISSION_DENIED for session and run tokens.",
38062
+ description: "Reads one period with its derived status, so you can tell whether it is still planning, active, in grading or closed. Read-only. Errors: 404 PERIOD_NOT_FOUND when the id is not a period of your organization; 403 PERMISSION_DENIED for a run or computer token, or a session token that names no agent.",
37786
38063
  http: "GET",
37787
38064
  path: "/organization/v1/periods/{id}",
37788
38065
  streaming: "no",
@@ -37818,7 +38095,7 @@ for more details.`
37818
38095
  resource: "organization.positions",
37819
38096
  method: "list",
37820
38097
  summary: "List positions",
37821
- description: "Lists positions across the organization ordered by department and then number, vacant ones included; narrow it with department_id, job_id, status or is_head. Filters combine with AND. Pass next_page unchanged as page; null means the end. Read-only. Errors: 400 INVALID_PARAMS for an unknown query parameter, a limit outside 1 to 100, a non-boolean is_head or a stale cursor; 403 PERMISSION_DENIED for session and run tokens. Example: GET /organization/v1/positions?department_id=dept_123&status=active.",
38098
+ description: "Lists positions across the organization ordered by department and then number, vacant ones included; narrow it with department_id, job_id, status or is_head. Filters combine with AND. Pass next_page unchanged as page; null means the end. Read-only. Errors: 400 INVALID_PARAMS for an unknown query parameter, a limit outside 1 to 100, a non-boolean is_head or a stale cursor; 403 PERMISSION_DENIED for a run or computer token, or a session token that names no agent. Example: GET /organization/v1/positions?department_id=dept_123&status=active.",
37822
38099
  http: "GET",
37823
38100
  path: "/organization/v1/positions",
37824
38101
  streaming: "no",
@@ -37931,7 +38208,7 @@ for more details.`
37931
38208
  resource: "organization.positions",
37932
38209
  method: "retrieve",
37933
38210
  summary: "Get a position",
37934
- description: "Reads one position with its derived effective_reports_to line. Read-only. Errors: 404 POSITION_NOT_FOUND when the id is not a position of your organization; 403 PERMISSION_DENIED for session and run tokens.",
38211
+ description: "Reads one position with its derived effective_reports_to line. Read-only. Errors: 404 POSITION_NOT_FOUND when the id is not a position of your organization; 403 PERMISSION_DENIED for a run or computer token, or a session token that names no agent.",
37935
38212
  http: "GET",
37936
38213
  path: "/organization/v1/positions/{id}",
37937
38214
  streaming: "no",
@@ -40385,6 +40662,131 @@ for more details.`
40385
40662
  ]
40386
40663
  }
40387
40664
  },
40665
+ {
40666
+ resource: "share.permissions",
40667
+ method: "list",
40668
+ summary: "List shares",
40669
+ description: "Find the shares of this organization, newest first, for example every link that exposes one file before you decide which to revoke. Filter by resource_type, resource_id and status; filters combine with AND. Continue with next_page_token as page_token until next_page_token is null. Records never include link.web_url. A credential bound to specific files must pass resource_type and resource_id of a bound file, and an unbound file answers 404.",
40670
+ http: "GET",
40671
+ path: "/share/v1/permissions",
40672
+ streaming: "no",
40673
+ pagination: false,
40674
+ pathParams: [],
40675
+ query: [
40676
+ {
40677
+ name: "resource_type",
40678
+ type: "string",
40679
+ enum: [
40680
+ "file",
40681
+ "artifact",
40682
+ "canvas",
40683
+ "media_asset"
40684
+ ],
40685
+ required: false,
40686
+ description: "Only shares of this object type; file, canvas and media_asset create today."
40687
+ },
40688
+ {
40689
+ name: "resource_id",
40690
+ type: "string",
40691
+ required: false,
40692
+ description: "Only shares of the object with this id, for example a file id from the File API or a media asset's library_id/asset_id; combine with resource_type."
40693
+ },
40694
+ {
40695
+ name: "status",
40696
+ type: "string",
40697
+ enum: [
40698
+ "active",
40699
+ "expired",
40700
+ "revoked"
40701
+ ],
40702
+ required: false,
40703
+ description: "Only shares in this state; omit to list every state."
40704
+ },
40705
+ {
40706
+ name: "page_size",
40707
+ type: "integer",
40708
+ required: false,
40709
+ description: "Maximum shares in one page, from 1 to 100; defaults to 50."
40710
+ },
40711
+ {
40712
+ name: "page_token",
40713
+ type: "string",
40714
+ required: false,
40715
+ description: "Opaque next_page_token from the preceding page with the same filters; omit on the first request."
40716
+ }
40717
+ ]
40718
+ },
40719
+ {
40720
+ resource: "share.permissions",
40721
+ method: "create",
40722
+ summary: "Create share",
40723
+ description: "Make one file readable by anyone holding a link, before sending the link to a person or embedding it. Name the object as resource {type, id}, with the file id from the File API. The response is 201 and is the only time link.web_url is returned; store it, because later reads omit it and a lost address means creating another share (the old one keeps working until you delete it). The link is anonymous and read-only. A type other than file answers 400 RESOURCE_TYPE_UNSUPPORTED, and a file that is missing or outside your organization answers 404 RESOURCE_NOT_FOUND.",
40724
+ http: "POST",
40725
+ path: "/share/v1/permissions",
40726
+ streaming: "no",
40727
+ pagination: false,
40728
+ pathParams: [],
40729
+ query: [],
40730
+ body: {
40731
+ required: true,
40732
+ fields: [
40733
+ {
40734
+ name: "resource",
40735
+ type: "object",
40736
+ required: true,
40737
+ description: "The object a share exposes, named by a type and an id."
40738
+ },
40739
+ {
40740
+ name: "expire_time",
40741
+ type: "string",
40742
+ required: false,
40743
+ description: "ISO 8601 instant after which the link answers 410; omit or null for a link that never expires, and it must be in the future."
40744
+ },
40745
+ {
40746
+ name: "prevents_download",
40747
+ type: "boolean",
40748
+ required: false,
40749
+ description: "Ask viewers to open the content without a download prompt; a limit, not a guarantee, because anyone who can read it can save it. Defaults to false."
40750
+ }
40751
+ ]
40752
+ }
40753
+ },
40754
+ {
40755
+ resource: "share.permissions",
40756
+ method: "delete",
40757
+ summary: "Delete share",
40758
+ description: "Take a link back so nobody can open it again. This revokes the share, the record stays readable with status revoked, and opening the link answers 410. Repeating the call on a revoked share is harmless and answers 204 again. Content addresses already signed when the link was opened expire on their own within five minutes. Take the id from shares.create or shares.list.",
40759
+ http: "DELETE",
40760
+ path: "/share/v1/permissions/{id}",
40761
+ streaming: "no",
40762
+ pagination: false,
40763
+ pathParams: [
40764
+ {
40765
+ name: "id",
40766
+ sdkName: "id",
40767
+ description: "Share id returned by shares.create or shares.list, in the form shr_ followed by 32 lowercase letters or digits; a link address is not accepted."
40768
+ }
40769
+ ],
40770
+ query: []
40771
+ },
40772
+ {
40773
+ resource: "share.permissions",
40774
+ method: "retrieve",
40775
+ summary: "Retrieve share",
40776
+ description: "Read one share to see whether its link is still active, when it expires, and how many times it was opened. Take the id from shares.create or shares.list. The record never includes link.web_url, because the address is shown once at creation. A share that does not exist or belongs to another organization answers 404 PERMISSION_NOT_FOUND.",
40777
+ http: "GET",
40778
+ path: "/share/v1/permissions/{id}",
40779
+ streaming: "no",
40780
+ pagination: false,
40781
+ pathParams: [
40782
+ {
40783
+ name: "id",
40784
+ sdkName: "id",
40785
+ description: "Share id returned by shares.create or shares.list, in the form shr_ followed by 32 lowercase letters or digits; a link address is not accepted."
40786
+ }
40787
+ ],
40788
+ query: []
40789
+ },
40388
40790
  {
40389
40791
  resource: "studio.codexes",
40390
40792
  method: "list",
@@ -46859,6 +47261,19 @@ var getAgentConsolidation = (options) => (options.client ?? client).get({
46859
47261
  url: "/agent/v1/agents/{agent_id}/consolidations/{consolidation_id}",
46860
47262
  ...options
46861
47263
  });
47264
+ var listAgentInboxLetters = (options) => (options.client ?? client).get({
47265
+ security: [{
47266
+ key: "BearerAuth",
47267
+ scheme: "bearer",
47268
+ type: "http"
47269
+ }, {
47270
+ key: "ApiKeyAuth",
47271
+ name: "X-API-Key",
47272
+ type: "apiKey"
47273
+ }],
47274
+ url: "/agent/v1/agents/{agent_id}/inbox/letters",
47275
+ ...options
47276
+ });
46862
47277
  var applyAgentVersion = (options) => (options.client ?? client).post({
46863
47278
  security: [{
46864
47279
  key: "BearerAuth",
@@ -47211,11 +47626,7 @@ var computersFilesConvert = (options) => (options.client ?? client).post({
47211
47626
  type: "apiKey"
47212
47627
  }],
47213
47628
  url: "/agent/v1/computers/{computer_id}/files/convert",
47214
- ...options,
47215
- headers: {
47216
- "Content-Type": "application/json",
47217
- ...options.headers
47218
- }
47629
+ ...options
47219
47630
  });
47220
47631
  var connectComputer = (options) => (options.client ?? client).post({
47221
47632
  security: [{
@@ -47303,6 +47714,49 @@ var forkSession = (options) => (options.client ?? client).post({
47303
47714
  ...options.headers
47304
47715
  }
47305
47716
  });
47717
+ var listSessionArtifacts = (options) => (options.client ?? client).get({
47718
+ security: [{
47719
+ key: "BearerAuth",
47720
+ scheme: "bearer",
47721
+ type: "http"
47722
+ }, {
47723
+ key: "ApiKeyAuth",
47724
+ name: "X-API-Key",
47725
+ type: "apiKey"
47726
+ }],
47727
+ url: "/agent/v1/sessions/{session_id}/artifacts",
47728
+ ...options
47729
+ });
47730
+ var createSessionArtifactContentUrl = (options) => (options.client ?? client).post({
47731
+ security: [{
47732
+ key: "BearerAuth",
47733
+ scheme: "bearer",
47734
+ type: "http"
47735
+ }, {
47736
+ key: "ApiKeyAuth",
47737
+ name: "X-API-Key",
47738
+ type: "apiKey"
47739
+ }],
47740
+ url: "/agent/v1/sessions/{session_id}/artifacts/{artifact_id}/content_url",
47741
+ ...options,
47742
+ headers: {
47743
+ "Content-Type": "application/json",
47744
+ ...options.headers
47745
+ }
47746
+ });
47747
+ var listSessionRequests = (options) => (options.client ?? client).get({
47748
+ security: [{
47749
+ key: "BearerAuth",
47750
+ scheme: "bearer",
47751
+ type: "http"
47752
+ }, {
47753
+ key: "ApiKeyAuth",
47754
+ name: "X-API-Key",
47755
+ type: "apiKey"
47756
+ }],
47757
+ url: "/agent/v1/sessions/{session_id}/requests",
47758
+ ...options
47759
+ });
47306
47760
  var listSessionBackgroundTasks = (options) => (options.client ?? client).get({
47307
47761
  security: [{
47308
47762
  key: "BearerAuth",
@@ -47948,6 +48402,45 @@ var createChatCompletion = (options) => (options.client ?? client).post({
47948
48402
  ...options.headers
47949
48403
  }
47950
48404
  });
48405
+ var disableModelAccess = (options) => (options.client ?? client).delete({
48406
+ security: [{
48407
+ key: "BearerAuth",
48408
+ scheme: "bearer",
48409
+ type: "http"
48410
+ }, {
48411
+ key: "ApiKeyAuth",
48412
+ name: "X-API-Key",
48413
+ type: "apiKey"
48414
+ }],
48415
+ url: "/model/v1/models/{model}/access",
48416
+ ...options
48417
+ });
48418
+ var enableModelAccess = (options) => (options.client ?? client).put({
48419
+ security: [{
48420
+ key: "BearerAuth",
48421
+ scheme: "bearer",
48422
+ type: "http"
48423
+ }, {
48424
+ key: "ApiKeyAuth",
48425
+ name: "X-API-Key",
48426
+ type: "apiKey"
48427
+ }],
48428
+ url: "/model/v1/models/{model}/access",
48429
+ ...options
48430
+ });
48431
+ var listModelAccess = (options) => (options?.client ?? client).get({
48432
+ security: [{
48433
+ key: "BearerAuth",
48434
+ scheme: "bearer",
48435
+ type: "http"
48436
+ }, {
48437
+ key: "ApiKeyAuth",
48438
+ name: "X-API-Key",
48439
+ type: "apiKey"
48440
+ }],
48441
+ url: "/model/v1/model-access",
48442
+ ...options
48443
+ });
47951
48444
  var getGeneration = (options) => (options.client ?? client).get({
47952
48445
  security: [{
47953
48446
  key: "BearerAuth",
@@ -53148,6 +53641,19 @@ var devopsFlagsCreate = (options) => (options.client ?? client).post({
53148
53641
  ...options.headers
53149
53642
  }
53150
53643
  });
53644
+ var devopsFlagsReportCodeRefs = (options) => (options.client ?? client).post({
53645
+ security: [{
53646
+ key: "devops-bearerAuth",
53647
+ scheme: "bearer",
53648
+ type: "http"
53649
+ }],
53650
+ url: "/devops/v1/projects/{project}/flags/code-refs",
53651
+ ...options,
53652
+ headers: {
53653
+ "Content-Type": "application/json",
53654
+ ...options.headers
53655
+ }
53656
+ });
53151
53657
  var devopsFlagsGet = (options) => (options.client ?? client).get({
53152
53658
  security: [{
53153
53659
  key: "devops-bearerAuth",
@@ -54361,6 +54867,19 @@ var mediaGetGenerationCapabilities = (options) => (options?.client ?? client).ge
54361
54867
  url: "/media/v1/generation/capabilities",
54362
54868
  ...options
54363
54869
  });
54870
+ var mediaAlignAsset = (options) => (options.client ?? client).post({
54871
+ security: [{
54872
+ key: "media-BearerAuth",
54873
+ scheme: "bearer",
54874
+ type: "http"
54875
+ }],
54876
+ url: "/media/v1/libraries/{library_id}/assets/{asset_id}/align",
54877
+ ...options,
54878
+ headers: {
54879
+ "Content-Type": "application/json",
54880
+ ...options.headers
54881
+ }
54882
+ });
54364
54883
  var ontologyListTypes = (options) => (options?.client ?? client).get({
54365
54884
  security: [{
54366
54885
  key: "ontology-bearerAuth",
@@ -55493,6 +56012,46 @@ var searchMap = (options) => (options.client ?? client).post({
55493
56012
  ...options.headers
55494
56013
  }
55495
56014
  });
56015
+ var shareListPermissions = (options) => (options?.client ?? client).get({
56016
+ security: [{
56017
+ key: "share-bearerAuth",
56018
+ scheme: "bearer",
56019
+ type: "http"
56020
+ }],
56021
+ url: "/share/v1/permissions",
56022
+ ...options
56023
+ });
56024
+ var shareCreatePermission = (options) => (options.client ?? client).post({
56025
+ security: [{
56026
+ key: "share-bearerAuth",
56027
+ scheme: "bearer",
56028
+ type: "http"
56029
+ }],
56030
+ url: "/share/v1/permissions",
56031
+ ...options,
56032
+ headers: {
56033
+ "Content-Type": "application/json",
56034
+ ...options.headers
56035
+ }
56036
+ });
56037
+ var shareDeletePermission = (options) => (options.client ?? client).delete({
56038
+ security: [{
56039
+ key: "share-bearerAuth",
56040
+ scheme: "bearer",
56041
+ type: "http"
56042
+ }],
56043
+ url: "/share/v1/permissions/{id}",
56044
+ ...options
56045
+ });
56046
+ var shareRetrievePermission = (options) => (options.client ?? client).get({
56047
+ security: [{
56048
+ key: "share-bearerAuth",
56049
+ scheme: "bearer",
56050
+ type: "http"
56051
+ }],
56052
+ url: "/share/v1/permissions/{id}",
56053
+ ...options
56054
+ });
55496
56055
  var studioGenresList = (options) => (options?.client ?? client).get({
55497
56056
  security: [{
55498
56057
  key: "BearerAuth",
@@ -57529,6 +58088,11 @@ function createAgent(transport) {
57529
58088
  send: bind(transport, sendAgentEvents),
57530
58089
  stream: bindStream(transport, streamAgentEvents)
57531
58090
  },
58091
+ inbox: {
58092
+ letters: {
58093
+ list: bind(transport, listAgentInboxLetters)
58094
+ }
58095
+ },
57532
58096
  list: bind(transport, agentsList),
57533
58097
  retrieve: bind(transport, agentsRetrieve),
57534
58098
  retrieveAppearance: bind(transport, getAgentAppearance),
@@ -57593,6 +58157,12 @@ function createAgent(transport) {
57593
58157
  },
57594
58158
  sessions: {
57595
58159
  archive: bind(transport, sessionsArchive),
58160
+ artifacts: {
58161
+ contentUrl: {
58162
+ create: bind(transport, createSessionArtifactContentUrl)
58163
+ },
58164
+ list: bind(transport, listSessionArtifacts)
58165
+ },
57596
58166
  backgroundTasks: {
57597
58167
  list: bind(transport, listSessionBackgroundTasks),
57598
58168
  retrieveOutput: bind(transport, getSessionBackgroundTaskOutput),
@@ -57611,6 +58181,9 @@ function createAgent(transport) {
57611
58181
  },
57612
58182
  fork: bind(transport, forkSession),
57613
58183
  list: bind(transport, sessionsList),
58184
+ requests: {
58185
+ list: bind(transport, listSessionRequests)
58186
+ },
57614
58187
  resources: {
57615
58188
  create: bind(transport, sessionsResourcesAdd),
57616
58189
  delete: bind(transport, aliasOperation(sessionsResourcesDelete, { query: { session_id: "query_session_id" } })),
@@ -58123,7 +58696,8 @@ function createDevops(transport) {
58123
58696
  },
58124
58697
  flags: {
58125
58698
  create: bind(transport, devopsFlagsCreate),
58126
- list: bind(transport, devopsFlagsList)
58699
+ list: bind(transport, devopsFlagsList),
58700
+ reportCodeRefs: bind(transport, devopsFlagsReportCodeRefs)
58127
58701
  },
58128
58702
  list: bind(transport, devopsProjectsList),
58129
58703
  promotions: {
@@ -58327,6 +58901,9 @@ function createMedia(transport) {
58327
58901
  },
58328
58902
  libraries: {
58329
58903
  assets: {
58904
+ align: {
58905
+ create: bind(transport, mediaAlignAsset)
58906
+ },
58330
58907
  batch: bind(transport, mediaBatchAssets),
58331
58908
  create: bind(transport, (options) => mediaUploadAsset({ ...options, bodySerializer: multipartBodySerializer, headers: { "Content-Type": null, ...options.headers } })),
58332
58909
  delete: bind(transport, mediaDeleteAsset),
@@ -58468,7 +59045,14 @@ function createModel(transport) {
58468
59045
  countTokens: bind(transport, countTokens),
58469
59046
  create: bindMixed(transport, createMessage)
58470
59047
  },
59048
+ modelAccess: {
59049
+ list: bind(transport, listModelAccess)
59050
+ },
58471
59051
  models: {
59052
+ access: {
59053
+ delete: bind(transport, disableModelAccess),
59054
+ update: bind(transport, enableModelAccess)
59055
+ },
58472
59056
  list: bind(transport, listModels),
58473
59057
  retrieve: bind(transport, retrieveModel)
58474
59058
  },
@@ -58761,6 +59345,16 @@ function createSearch(transport) {
58761
59345
  }
58762
59346
  };
58763
59347
  }
59348
+ function createShare(transport) {
59349
+ return {
59350
+ permissions: {
59351
+ create: bind(transport, shareCreatePermission),
59352
+ delete: bind(transport, shareDeletePermission),
59353
+ list: bind(transport, shareListPermissions),
59354
+ retrieve: bind(transport, shareRetrievePermission)
59355
+ }
59356
+ };
59357
+ }
58764
59358
  function createStudio(transport) {
58765
59359
  return {
58766
59360
  codexes: {
@@ -59031,6 +59625,7 @@ var resourceFactories = {
59031
59625
  organization: createOrganization,
59032
59626
  sandbox: createSandbox,
59033
59627
  search: createSearch,
59628
+ share: createShare,
59034
59629
  studio: createStudio,
59035
59630
  ticket: createTicket,
59036
59631
  vault: createVault
@@ -60848,7 +61443,7 @@ function help(commands, prefix, command) {
60848
61443
  ...[...operationOptions(command.op), ...bodyDataOption(command.op), ...globalOptions].map((s) => ` ${describeOption(s, s.required && fieldRequired(command.op, s, s.location ?? "query"))}`),
60849
61444
  ...command.op.body?.fields.filter((f) => !operationOptions(command.op).some((s) => s.location === "body" && s.field === f) && (f.type === "object" || f.type === "array" && !["string", "number", "integer", "boolean"].includes(f.itemType ?? ""))).map((f) => ` --data: ${f.name} (${f.type}${f.required ? ", required" : ""})`) ?? [],
60850
61445
  " -h is an alias of --help",
60851
- "PRAXIS_ENV=develop|production (default: develop); no --env option.",
61446
+ "PRAXIS_ENV=production|develop (default: production; develop must be named); no --env option.",
60852
61447
  "",
60853
61448
  "Examples:",
60854
61449
  ` ${example(command)}`
@@ -60860,7 +61455,7 @@ function help(commands, prefix, command) {
60860
61455
  "Global options:",
60861
61456
  ...globalOptions.map((s) => ` ${describeOption(s)}`),
60862
61457
  " -h is an alias of --help",
60863
- "PRAXIS_ENV=develop|production (default: develop); no --env option.",
61458
+ "PRAXIS_ENV=production|develop (default: production; develop must be named); no --env option.",
60864
61459
  ""
60865
61460
  ];
60866
61461
  const sample = matching.find((c) => c.words.at(-1) === "list") ?? matching[0];
@@ -61218,7 +61813,7 @@ var workflows = [
61218
61813
  ],
61219
61814
  group: "local",
61220
61815
  network: "offline",
61221
- platform: "the `@mise/code` engine's own `mise code refactor rename|check|apply`: this is their thin shell, one for one (ADR-125 §3).",
61816
+ platform: "the `@deepractice-ai/devops-refactor` engine's own `mise code refactor rename|check|apply`: this is their thin shell, one for one (ADR-125 §3).",
61222
61817
  docs: "https://docs.deepraxis.com/docs/cli"
61223
61818
  },
61224
61819
  {
@@ -61307,30 +61902,31 @@ var workflows = [
61307
61902
  {
61308
61903
  words: ["devops", "flag", "refs"],
61309
61904
  requires: "checkout",
61310
- usage: "devops flag refs [key]",
61311
- summary: "Where each flag key is referenced in this checkout: file and line, for every registered key or one named key.",
61312
- example: "praxis devops flag refs",
61905
+ usage: "devops flag refs [key] [--report --project <dvp_…>]",
61906
+ summary: "Where each flag key is referenced in this checkout: file and line, for every registered key or one named key. With --report the whole scan of every registered key is posted to the platform, which is what lets archiving a flag be refused while code still names it.",
61907
+ example: "praxis devops flag refs --report --project dvp_…",
61313
61908
  examples: [
61314
61909
  "praxis devops flag refs",
61315
- "praxis devops flag refs run-page-v2"
61910
+ "praxis devops flag refs run-page-v2",
61911
+ "praxis devops flag refs --report --project dvp_…"
61316
61912
  ],
61317
61913
  group: "local",
61318
- network: "offline",
61319
- platform: "Reporting the references to the platform waits on the write API: `devops.flags.listCodeRefs` reads only, so this slice lists locally (ADR-125 §4).",
61914
+ network: "Offline. --report: needs a login and sends this checkout's references to the platform",
61915
+ platform: "the platform half of the scan: `devops.flags.reportCodeRefs` stores the references on each flag of the project (0 for a key this scan no longer finds), `devops.flags.listCodeRefs` reads them back, and `praxis api devops flag archive <flg_…>` refuses while a flag still has references or is still on in an environment (ADR-125 §4).",
61320
61916
  docs: "https://docs.deepraxis.com/docs/cli"
61321
61917
  },
61322
61918
  {
61323
61919
  words: ["devops", "flag", "remove"],
61324
61920
  requires: "checkout",
61325
61921
  usage: "devops flag remove <key>",
61326
- summary: "The local step of removing a flag: list the remaining references, or the steps that follow once none remain. Order: open the flag fully (praxis api devops flag environment update), delete the code that names the key and deploy it, run this command, then retire the flag on the platform with praxis api devops flag archive <flg_…> (irreversible; it does not check code references), then regenerate the registry with praxis devops flag sync.",
61922
+ summary: "The local step of removing a flag: list the remaining references, or the steps that follow once none remain. Order: turn the flag off in every environment (praxis api devops flag environment update), delete the code that names the key and deploy it, run this command, report the scan with praxis devops flag refs --report, then retire the flag on the platform with praxis api devops flag archive <flg_…> (irreversible; it is refused while references remain or an environment still has it on), then regenerate the registry with praxis devops flag sync.",
61327
61923
  example: "praxis devops flag remove run-page-v2",
61328
61924
  examples: [
61329
61925
  "praxis devops flag remove run-page-v2"
61330
61926
  ],
61331
61927
  group: "local",
61332
61928
  network: "offline",
61333
- platform: "praxis api devops flag archive — retires the flag on the platform after the code that named it is deployed away; it keeps the key reserved (ADR-050 §7, ADR-125 §4).",
61929
+ platform: "praxis api devops flag archive — retires the flag on the platform after the code that named it is deployed away, and keeps the key reserved; it is refused, not forced, while the references the last `praxis devops flag refs --report` wrote remain or the flag is still on in an environment (ADR-050 §7, ADR-125 §4).",
61334
61930
  docs: "https://docs.deepraxis.com/docs/cli"
61335
61931
  },
61336
61932
  {
@@ -61347,6 +61943,13 @@ var workflows = [
61347
61943
  platform: "praxis api devops project change create — the platform creates and names a Change; the CLI only lands its branch (ADR-125 §5).",
61348
61944
  docs: "https://docs.deepraxis.com/docs/cli"
61349
61945
  },
61946
+ {
61947
+ words: ["agent", "events", "wait"],
61948
+ usage: "agent events wait [--timeout <seconds>]",
61949
+ summary: "Wait until a new letter arrives for your assume agent (PRAXIS_ASSUME_AGENT, default R1M9TQ2X), print who wrote and how to read it, and exit 0. It first checks the waiting letters once, so mail that arrived while nothing waited is reported at once; then it follows the agent's event stream, reconnecting with backoff. Nothing is marked read. Run it as a background task in Claude Code: its exit wakes the idle session; read the mail with praxis_assume_inbox and start it again.",
61950
+ example: "PRAXIS_ASSUME_AGENT=R1M9TQ2X praxis agent events wait",
61951
+ network: "online"
61952
+ },
61350
61953
  { words: ["canvas", "import"], usage: "canvas import <file.pen> [--name <name>] [--canvas <cvs_…> --yes] [--frames <id,id>] [--image-root <dir>] [--dry-run]", summary: "Import a Pencil .pen file as a canvas, uploading the images it references first.", example: 'praxis canvas import design.pen --name "Landing page"' },
61351
61954
  { words: ["skill"], usage: "skill [--install <dir>]", summary: "Print the AI skill, or write <dir>/praxis-cli/SKILL.md." },
61352
61955
  {
@@ -61416,7 +62019,7 @@ function workflowHelp(workflow, options) {
61416
62019
  "Options:",
61417
62020
  ...[...options, ...globalOptions].map((s) => ` ${describeOption(s)}`),
61418
62021
  " -h is an alias of --help",
61419
- "PRAXIS_ENV=develop|production (default: develop); no --env option.",
62022
+ "PRAXIS_ENV=production|develop (default: production; develop must be named); no --env option.",
61420
62023
  ...workflow.requires === "checkout" ? [`Requires: ${CHECKOUT_REQUIREMENT}`] : [],
61421
62024
  ...workflow.notes?.length ? ["", ...workflow.notes] : [],
61422
62025
  ...workflow.network ? ["", `Network: ${workflow.network}`] : [],
@@ -62939,6 +63542,101 @@ function wranglerEdges(nodes) {
62939
63542
  }
62940
63543
  return edges;
62941
63544
  }
63545
+ // ../../packages/praxis/deploy-core/src/lambda-function.ts
63546
+ var LAMBDA_FUNCTIONS_ROOT = "services/lambda/functions";
63547
+ var UPSTREAM = "aliyun-fc";
63548
+ var RECIPE_PATH = /^services\/lambda\/functions\/([^/]+)\/function\.json$/;
63549
+ var isText = (value) => typeof value === "string" && value !== "";
63550
+ var isCount = (value, min, max) => typeof value === "number" && Number.isInteger(value) && value >= min && value <= max;
63551
+ function lambdaFunctionOf(text) {
63552
+ const parsed = text === null ? null : parseJsonc2(text);
63553
+ if (parsed === null)
63554
+ return null;
63555
+ if (!isText(parsed.name) || !isText(parsed.upstream))
63556
+ return null;
63557
+ if (!Array.isArray(parsed.regions) || parsed.regions.length === 0 || !parsed.regions.every(isText))
63558
+ return null;
63559
+ if (parsed.gpu !== undefined && !isText(parsed.gpu))
63560
+ return null;
63561
+ if (!isCount(parsed.cpu, 1, 256))
63562
+ return null;
63563
+ if (!isCount(parsed.memoryMb, 128, 32 * 1024))
63564
+ return null;
63565
+ if (!isCount(parsed.timeoutSeconds, 1, 24 * 3600))
63566
+ return null;
63567
+ if (!isCount(parsed.concurrency, 1, 1024))
63568
+ return null;
63569
+ return {
63570
+ name: parsed.name,
63571
+ upstream: parsed.upstream,
63572
+ regions: [...parsed.regions],
63573
+ ...parsed.gpu === undefined ? {} : { gpu: parsed.gpu },
63574
+ cpu: parsed.cpu,
63575
+ memoryMb: parsed.memoryMb,
63576
+ timeoutSeconds: parsed.timeoutSeconds,
63577
+ concurrency: parsed.concurrency
63578
+ };
63579
+ }
63580
+ function lambdaFunctionTarget(recipe) {
63581
+ return { path: `${LAMBDA_FUNCTIONS_ROOT}/${recipe.name}`, name: `lambda-${recipe.name}` };
63582
+ }
63583
+ function lambdaFunctionOwner(path) {
63584
+ return path.split("/").slice(0, -2).join("/");
63585
+ }
63586
+ async function scanRecipes(facts) {
63587
+ const found = [];
63588
+ const warnings = [];
63589
+ for (const path of [...facts.tree].sort()) {
63590
+ const match = RECIPE_PATH.exec(path);
63591
+ if (match === null)
63592
+ continue;
63593
+ const dir = path.slice(0, -"/function.json".length);
63594
+ const recipe = lambdaFunctionOf(await facts.read(path));
63595
+ if (recipe === null) {
63596
+ warnings.push(`${dir}: function.json is not a recipe`);
63597
+ continue;
63598
+ }
63599
+ if (recipe.upstream !== UPSTREAM)
63600
+ continue;
63601
+ if (recipe.name !== match[1]) {
63602
+ warnings.push(`${dir}: function.json names ${JSON.stringify(recipe.name)}, not the directory name`);
63603
+ continue;
63604
+ }
63605
+ found.push(recipe);
63606
+ }
63607
+ return { found, warnings };
63608
+ }
63609
+ function lambdaFunctionProvider(_options = {}) {
63610
+ return {
63611
+ id: "lambda-function",
63612
+ async detect(facts) {
63613
+ return (await scanRecipes(facts)).found.length > 0 ? "certain" : "none";
63614
+ },
63615
+ async plan(facts, partial) {
63616
+ const claimed = new Set(partial.targets.map((target) => target.path));
63617
+ const scan = await scanRecipes(facts);
63618
+ const targets = [];
63619
+ const byOwner = new Map;
63620
+ for (const recipe of scan.found) {
63621
+ const { path, name } = lambdaFunctionTarget(recipe);
63622
+ if (claimed.has(path))
63623
+ continue;
63624
+ targets.push({ path, name, destination: "aliyun-fc", production: true, onTrain: true });
63625
+ const owner = lambdaFunctionOwner(path);
63626
+ byOwner.set(owner, [...byOwner.get(owner) ?? [], path]);
63627
+ }
63628
+ const refined = partial.targets.map((target) => {
63629
+ const paths = byOwner.get(target.path);
63630
+ return paths === undefined ? target : { ...target, dependsOn: [...new Set([...target.dependsOn ?? [], ...paths])] };
63631
+ });
63632
+ return {
63633
+ targets: [...refined, ...targets],
63634
+ ...scan.warnings.length === 0 ? {} : { warnings: [...partial.warnings ?? [], ...scan.warnings] }
63635
+ };
63636
+ }
63637
+ };
63638
+ }
63639
+ var lambdaFunction = lambdaFunctionProvider();
62942
63640
  // ../../packages/praxis/deploy-core/src/package-manifest.ts
62943
63641
  function packageManifestOf(text) {
62944
63642
  const parsed = text === null ? null : parseJsonc2(text);
@@ -63096,13 +63794,21 @@ function matchesPattern(pattern, path) {
63096
63794
  }
63097
63795
  async function workspaceIndexOf(facts, options = {}) {
63098
63796
  const tree = new Set(facts.tree);
63099
- const declared = workspacePatternsOf({
63797
+ return workspaceIndexOfSync({
63798
+ tree: facts.tree,
63100
63799
  packageJson: tree.has("package.json") ? await facts.read("package.json") : null,
63101
63800
  pnpmWorkspace: tree.has("pnpm-workspace.yaml") ? await facts.read("pnpm-workspace.yaml") : null
63801
+ }, options);
63802
+ }
63803
+ function workspaceIndexOfSync(input, options = {}) {
63804
+ const tree = new Set(input.tree);
63805
+ const declared = workspacePatternsOf({
63806
+ packageJson: input.packageJson,
63807
+ pnpmWorkspace: input.pnpmWorkspace
63102
63808
  });
63103
63809
  const patterns = declared.length > 0 ? declared : options.defaultPatterns ?? [];
63104
63810
  const candidates2 = new Set;
63105
- for (const path of facts.tree) {
63811
+ for (const path of input.tree) {
63106
63812
  const dir = dirOfPackageJson(path) ?? dirOfManifest(path);
63107
63813
  if (dir === undefined || dir === ".")
63108
63814
  continue;
@@ -63121,6 +63827,61 @@ async function workspaceIndexOf(facts, options = {}) {
63121
63827
  };
63122
63828
  }
63123
63829
 
63830
+ // ../../packages/praxis/deploy-core/src/workspace-npm.ts
63831
+ function npmLifecycleOf(lifecycle) {
63832
+ const npm = lifecycle?.npm;
63833
+ if (npm === null || typeof npm !== "object" || Array.isArray(npm))
63834
+ return null;
63835
+ const build = npm.build;
63836
+ if (typeof build !== "string" || build.trim() === "")
63837
+ return null;
63838
+ const dir = npm.dir;
63839
+ return { build, ...typeof dir === "string" && dir.trim() !== "" ? { dir } : {} };
63840
+ }
63841
+ function isPublishableName(name) {
63842
+ return typeof name === "string" && name.startsWith("@deepraxis/") && name !== "@deepraxis/";
63843
+ }
63844
+ function isPrivateManifest(text) {
63845
+ const parsed = text === null ? null : parseJsonc2(text);
63846
+ return parsed?.private === true;
63847
+ }
63848
+ function workspaceNpmProvider(options = {}) {
63849
+ const candidatesOf = async (facts) => {
63850
+ const workspaces = await readWorkspaces(facts, options);
63851
+ return workspaces.filter((workspace) => npmLifecycleOf(workspace.lifecycle) !== null && isPublishableName(workspace.packageName)).map((workspace) => ({ dir: workspace.dir, name: workspace.packageName }));
63852
+ };
63853
+ const publishable = async (facts, dir) => !isPrivateManifest(await facts.read(packageJsonIn(dir)));
63854
+ return {
63855
+ id: "workspace-npm",
63856
+ async detect(facts) {
63857
+ for (const candidate of await candidatesOf(facts)) {
63858
+ if (await publishable(facts, candidate.dir))
63859
+ return "certain";
63860
+ }
63861
+ return "none";
63862
+ },
63863
+ async plan(facts, partial) {
63864
+ const claimed = new Set(partial.targets.map((target) => target.path));
63865
+ const targets = [];
63866
+ for (const candidate of await candidatesOf(facts)) {
63867
+ if (claimed.has(candidate.dir))
63868
+ continue;
63869
+ if (!await publishable(facts, candidate.dir))
63870
+ continue;
63871
+ targets.push({
63872
+ path: candidate.dir,
63873
+ name: candidate.name,
63874
+ destination: "npm",
63875
+ production: true,
63876
+ onTrain: true
63877
+ });
63878
+ }
63879
+ return { targets: [...partial.targets, ...targets] };
63880
+ }
63881
+ };
63882
+ }
63883
+ var workspaceNpm = workspaceNpmProvider();
63884
+
63124
63885
  // ../../packages/praxis/deploy-core/src/workspace-cloudflare.ts
63125
63886
  function readWorkspaces(facts, options = {}) {
63126
63887
  const key = options.defaultPatterns === undefined ? "" : options.defaultPatterns.join(",");
@@ -63210,7 +63971,11 @@ function workspaceCloudflareProvider(options = {}) {
63210
63971
  };
63211
63972
  }
63212
63973
  var workspaceCloudflare = workspaceCloudflareProvider();
63213
- var BUILTIN_PROVIDERS = [workspaceCloudflare];
63974
+ var BUILTIN_PROVIDERS = [
63975
+ workspaceCloudflare,
63976
+ workspaceNpmProvider(),
63977
+ lambdaFunctionProvider()
63978
+ ];
63214
63979
  function directoriesOfPackageNames(workspaces) {
63215
63980
  const byName = new Map;
63216
63981
  for (const workspace of workspaces)
@@ -63237,15 +64002,23 @@ function workspaceClosureOf(target, byName, dependenciesOf) {
63237
64002
  // ../../packages/praxis/deploy-core/src/plan.ts
63238
64003
  async function planRepository(facts, providers = BUILTIN_PROVIDERS, options = {}) {
63239
64004
  let partial = { targets: [] };
64005
+ const warnings = [];
63240
64006
  for (const provider of providers) {
63241
64007
  const confidence = await provider.detect(facts);
63242
64008
  if (confidence === "none")
63243
64009
  continue;
63244
64010
  partial = await provider.plan(facts, partial);
64011
+ for (const warning of partial.warnings ?? [])
64012
+ if (!warnings.includes(warning))
64013
+ warnings.push(warning);
63245
64014
  }
63246
64015
  const drafts = partial.targets.filter((draft) => draft.deploy !== false);
63247
64016
  const workspaces = await readWorkspaces(facts, options);
63248
- return { commit: facts.commit, targets: closePlan(drafts, workspaces) };
64017
+ return {
64018
+ commit: facts.commit,
64019
+ targets: closePlan(drafts, workspaces),
64020
+ ...warnings.length === 0 ? {} : { warnings }
64021
+ };
63249
64022
  }
63250
64023
  function closePlan(drafts, workspaces) {
63251
64024
  const configOf = new Map(workspaces.map((workspace) => [workspace.dir, workspace.config]));
@@ -63267,7 +64040,7 @@ function closePlan(drafts, workspaces) {
63267
64040
  path: draft.path,
63268
64041
  name: draft.name,
63269
64042
  destination: draft.destination,
63270
- dependsOn: edges.get(draft.path) ?? [],
64043
+ dependsOn: [...new Set([...edges.get(draft.path) ?? [], ...draft.dependsOn ?? []])],
63271
64044
  ...draft.environments === undefined ? {} : { environments: draft.environments },
63272
64045
  production: draft.production === true,
63273
64046
  onTrain: draft.onTrain !== false,
@@ -63276,10 +64049,10 @@ function closePlan(drafts, workspaces) {
63276
64049
  }
63277
64050
  function isDeployToolDependency(name, path) {
63278
64051
  const directory = path.replace(/^(\.\/)+/, "").replace(/^\/+/, "").replace(/\/+$/, "");
63279
- if (directory === "packages/mise" || directory.startsWith("packages/mise/"))
63280
- return true;
63281
- if (directory === "packages/testing" || directory.startsWith("packages/testing/"))
63282
- return true;
64052
+ for (const root of ["packages/mise", "packages/devops", "packages/testing", "packages/bdd"]) {
64053
+ if (directory === root || directory.startsWith(`${root}/`))
64054
+ return true;
64055
+ }
63283
64056
  return name.startsWith("@mise/");
63284
64057
  }
63285
64058
  function targetsFor(plan, environment2) {
@@ -63985,7 +64758,8 @@ var DEPLOY_SHAPE = `devops:
63985
64758
  cloudflare: bun tofu/adapter.ts
63986
64759
  exclude: ["**/spec/features/*"] # optional
63987
64760
  policy:
63988
- forbiddenNames: <path> # optional`;
64761
+ forbiddenNames: <path> # optional
64762
+ identity: [cloudflare_workers_route.pattern] # optional`;
63989
64763
  function parseDeployProject(file) {
63990
64764
  const refuse = (what) => {
63991
64765
  throw new UsageError(`praxis.yaml ${what}`, `praxis devops deploy needs, at the repository root:
@@ -64022,15 +64796,21 @@ ${DEPLOY_SHAPE}`);
64022
64796
  refuse("devops.deploy.policy.allowDeletes must be a list of resource-address prefixes");
64023
64797
  }
64024
64798
  const allowDeletes = Array.isArray(declaredAllow) ? declaredAllow.map((e) => e.trim()) : [];
64799
+ const declaredIdentity = object(policy) ? policy.identity : undefined;
64800
+ if (declaredIdentity !== undefined && (!Array.isArray(declaredIdentity) || declaredIdentity.some((e) => typeof e !== "string" || !/^[A-Za-z0-9_]+\.[A-Za-z0-9_]+$/.test(e.trim())))) {
64801
+ refuse("devops.deploy.policy.identity must be a list of <resource type>.<attribute> pairs");
64802
+ }
64803
+ const identity2 = Array.isArray(declaredIdentity) ? declaredIdentity.map((e) => e.trim()) : [];
64025
64804
  const exclude = Array.isArray(declaredExclude) ? declaredExclude.map((e) => e.trim().replace(/^\.\//, "").replace(/\/+$/, "")) : [];
64026
64805
  return {
64027
64806
  adapters,
64028
64807
  ...typeof forbiddenNames === "string" ? { forbiddenNames: forbiddenNames.trim() } : {},
64029
64808
  ...exclude.length > 0 ? { exclude } : {},
64030
- ...allowDeletes.length > 0 ? { allowDeletes } : {}
64809
+ ...allowDeletes.length > 0 ? { allowDeletes } : {},
64810
+ ...identity2.length > 0 ? { identity: identity2 } : {}
64031
64811
  };
64032
64812
  }
64033
- function forbiddenDeletes(showJson, allow = []) {
64813
+ function forbiddenDeletes(showJson, allow = [], identity2 = []) {
64034
64814
  let doc;
64035
64815
  try {
64036
64816
  doc = JSON.parse(showJson);
@@ -64042,11 +64822,18 @@ function forbiddenDeletes(showJson, allow = []) {
64042
64822
  return { ok: true, deletes: [] };
64043
64823
  if (!Array.isArray(changes))
64044
64824
  return { ok: false, reason: "the plan document has no resource_changes list" };
64825
+ const record = (value) => value !== null && typeof value === "object" && !Array.isArray(value) ? value : {};
64045
64826
  const deletes = [];
64046
64827
  for (const change of changes) {
64047
64828
  const actions = Array.isArray(change.change?.actions) ? change.change.actions : [];
64048
64829
  const address = typeof change.address === "string" ? change.address : "?";
64049
- if (actions.includes("delete") && !allow.some((prefix) => address.startsWith(prefix)))
64830
+ const type = typeof change.type === "string" ? change.type : address.split(".")[0];
64831
+ const before = record(change.change?.before), after = record(change.change?.after);
64832
+ const renamed = actions.includes("update") && identity2.some((pair) => {
64833
+ const [of, attribute] = pair.split(".");
64834
+ return of === type && JSON.stringify(before[attribute]) !== JSON.stringify(after[attribute]);
64835
+ });
64836
+ if ((actions.includes("delete") || renamed) && !allow.some((prefix) => address.startsWith(prefix)))
64050
64837
  deletes.push(address);
64051
64838
  }
64052
64839
  return { ok: true, deletes };
@@ -64400,11 +65187,11 @@ async function runTofuDeploy(args, plan, ports) {
64400
65187
  if (code !== 0)
64401
65188
  throw new StepFailed(`rollout step show exited ${code}`);
64402
65189
  const verdict = forbiddenDeletes(lines.join(`
64403
- `), ports.project.allowDeletes ?? []);
65190
+ `), ports.project.allowDeletes ?? [], ports.project.identity ?? []);
64404
65191
  if (!verdict.ok)
64405
65192
  throw new StepFailed(verdict.reason);
64406
65193
  if (verdict.deletes.length > 0) {
64407
- throw new StepFailed(`the plan deletes or replaces ${verdict.deletes.join(", ")}; refused (praxis.yaml devops.deploy.policy.allowDeletes allows none of them)`);
65194
+ throw new StepFailed(`the plan deletes, replaces or renames ${verdict.deletes.join(", ")}; refused (praxis.yaml devops.deploy.policy.allowDeletes allows none of them)`);
64408
65195
  }
64409
65196
  };
64410
65197
  const adapter = (t, phase) => step(t, "adapter", [phase], root, adapterEnv({ target: t.path, environment: args.environment, mode: args.mode, commit: args.commit, dir: targetDir(workdir, t.path) }));
@@ -65014,7 +65801,7 @@ function planTest(flags, paths) {
65014
65801
  }
65015
65802
  function requireSingleCtrfTarget(targets) {
65016
65803
  if (targets > 1)
65017
- throw new UsageError("--ctrf names one report file but this selection covers several packages", "Run one package at a time with --ctrf, or drop --ctrf and read each run's own .mise/ctrf/<run>.json.");
65804
+ throw new UsageError("--ctrf names one report file but this selection covers several packages", "Run one package at a time with --ctrf, or drop --ctrf and read each run's own .praxis/ctrf/<run>.json.");
65018
65805
  }
65019
65806
  var FAILURE_LIMIT2 = 20;
65020
65807
  var member3 = (value, key) => typeof value === "object" && value !== null ? value[key] : undefined;
@@ -65249,6 +66036,30 @@ function bunTestRun(packagePath, code, output) {
65249
66036
  }
65250
66037
 
65251
66038
  // src/commands/devops-test.ts
66039
+ import { spawn as spawn4 } from "node:child_process";
66040
+ var CACHE_OFF_REEXEC_ENV = "PRAXIS_DEVOPS_TEST_CACHE_OFF";
66041
+ function needsCacheOffReexec(env) {
66042
+ return env.BUN_RUNTIME_TRANSPILER_CACHE_PATH !== "0" && !env[CACHE_OFF_REEXEC_ENV];
66043
+ }
66044
+ function isDevopsTestRun(words) {
66045
+ return words.join(" ") === "devops test";
66046
+ }
66047
+ function spawnInherit(cmd, args, options) {
66048
+ return new Promise((resolveCode) => {
66049
+ const child = spawn4(cmd, [...args], { cwd: options.cwd, env: options.env, stdio: "inherit" });
66050
+ child.once("error", (error) => {
66051
+ console.error(error instanceof Error ? error.message : String(error));
66052
+ resolveCode(1);
66053
+ });
66054
+ child.once("close", (code) => resolveCode(code ?? 1));
66055
+ });
66056
+ }
66057
+ function reexecWithCacheOff(options = {}) {
66058
+ return (options.spawn ?? spawnInherit)(process.execPath, options.argv ?? process.argv.slice(1), {
66059
+ cwd: options.cwd ?? process.cwd(),
66060
+ env: { ...options.env ?? process.env, BUN_RUNTIME_TRANSPILER_CACHE_PATH: "0", [CACHE_OFF_REEXEC_ENV]: "1" }
66061
+ });
66062
+ }
65252
66063
  async function devopsTest(flags, paths, ports) {
65253
66064
  const plan = planTest(flags, paths);
65254
66065
  if (plan.mode.kind === "affected")
@@ -65373,7 +66184,7 @@ async function devopsTestReportUpload(args, ports) {
65373
66184
  if (id === undefined || id === "")
65374
66185
  throw new UsageError("--upload needs --id", "Run `praxis devops test report` first to list this machine's runs, then pass one with --id.");
65375
66186
  const root = await ports.root();
65376
- const file = join6(root, ".mise", "ctrf", `${id}.json`);
66187
+ const file = join6(root, ".praxis", "ctrf", `${id}.json`);
65377
66188
  let report;
65378
66189
  try {
65379
66190
  report = await ports.readFile(file);
@@ -65449,8 +66260,8 @@ async function devopsTestInspect(args, ports) {
65449
66260
  return 0;
65450
66261
  }
65451
66262
  async function localEngine(cwd) {
65452
- const { testCommand } = await import("@mise/bdd/test-command");
65453
- const { mise } = await import("@mise/bdd");
66263
+ const { testCommand } = await import("@deepractice-ai/devops-test-engine/test-command");
66264
+ const { mise } = await import("@deepractice-ai/devops-test-engine");
65454
66265
  const { createLocalPlatform } = await import("@deepractice-ai/bdd-local");
65455
66266
  const { _scanPackages } = await import("@deepractice-ai/bdd-service/shared/bdd-config");
65456
66267
  const platform = createLocalPlatform({ cwd });
@@ -65478,9 +66289,7 @@ async function localEngine(cwd) {
65478
66289
  }),
65479
66290
  sweep: async (params) => withEngineStdoutOnStderr(async () => {
65480
66291
  const previousExitCode = process.exitCode ?? 0;
65481
- const previousEntry = process.argv[1];
65482
66292
  process.exitCode = 0;
65483
- process.argv[1] = await miseCliEntry();
65484
66293
  try {
65485
66294
  const answer = await mise.handle(platform, "lab", {
65486
66295
  path: "sweep",
@@ -65493,10 +66302,6 @@ async function localEngine(cwd) {
65493
66302
  return { text: typeof answer.data === "string" ? answer.data : JSON.stringify(answer.data, null, 2), exitCode: process.exitCode ?? 0 };
65494
66303
  } finally {
65495
66304
  process.exitCode = previousExitCode;
65496
- if (previousEntry === undefined)
65497
- delete process.argv[1];
65498
- else
65499
- process.argv[1] = previousEntry;
65500
66305
  }
65501
66306
  }),
65502
66307
  scaffold: async (params) => withEngineStdoutOnStderr(async () => {
@@ -65525,13 +66330,8 @@ async function localEngine(cwd) {
65525
66330
  })
65526
66331
  };
65527
66332
  }
65528
- async function miseCliEntry() {
65529
- const { fileURLToPath } = await import("node:url");
65530
- const { dirname: dirname8, resolve: resolve7 } = await import("node:path");
65531
- return resolve7(dirname8(fileURLToPath(import.meta.resolve("@mise/bdd"))), "../../cli/src/cli.ts");
65532
- }
65533
- async function localCheckout(cwd, spawn4) {
65534
- const git2 = (args) => spawn4("git", [...args], { cwd });
66333
+ async function localCheckout(cwd, spawn5) {
66334
+ const git2 = (args) => spawn5("git", [...args], { cwd });
65535
66335
  const required = async (args) => {
65536
66336
  const result = await git2(args);
65537
66337
  if (result.code !== 0)
@@ -65567,7 +66367,7 @@ async function localCheckout(cwd, spawn4) {
65567
66367
  const files = new Map;
65568
66368
  const walk = async (dir) => {
65569
66369
  for (const entry of await readdir2(dir, { withFileTypes: true })) {
65570
- if (["node_modules", ".git", "dist", ".mise"].includes(entry.name))
66370
+ if (["node_modules", ".git", "dist", ".praxis"].includes(entry.name))
65571
66371
  continue;
65572
66372
  const full = join6(dir, entry.name);
65573
66373
  if (entry.isDirectory()) {
@@ -65582,7 +66382,7 @@ async function localCheckout(cwd, spawn4) {
65582
66382
  await walk(packagePath);
65583
66383
  return files;
65584
66384
  },
65585
- runTests: (packagePath, files) => spawn4("nice", ["-n", "10", "bun", "test", ...files], { cwd: packagePath })
66385
+ runTests: (packagePath, files) => spawn5("nice", ["-n", "10", "bun", "test", ...files], { cwd: packagePath })
65586
66386
  };
65587
66387
  }
65588
66388
  async function withEngineStdoutOnStderr(body) {
@@ -65619,7 +66419,7 @@ async function runEngineCall(call, ports) {
65619
66419
  return exitCode;
65620
66420
  }
65621
66421
  async function miseEngine(cwd) {
65622
- const { mise } = await import("@mise/bdd");
66422
+ const { mise } = await import("@deepractice-ai/devops-test-engine");
65623
66423
  const { createLocalPlatform } = await import("@deepractice-ai/bdd-local");
65624
66424
  const platform = createLocalPlatform({ cwd });
65625
66425
  return {
@@ -65759,7 +66559,7 @@ function removalSteps(key) {
65759
66559
  `No code references ${key}. The rest is not this command's to do:`,
65760
66560
  ` 1. Deploy the code that removed the references (deploy never writes the trunk).`,
65761
66561
  ` 2. Retire the flag on the platform: praxis api devops flag archive <flg_…> — the terminal state.`,
65762
- ` Archiving keeps the key reserved and turns the flag off in every environment; there is no separate delete call.`,
66562
+ ` Archiving keeps the key reserved, and is refused while reported references remain or an environment still has it on; there is no separate delete call (ADR-125 §4).`,
65763
66563
  ` 3. Regenerate the registry: praxis devops flag sync`
65764
66564
  ].join(`
65765
66565
  `);
@@ -65789,6 +66589,25 @@ async function repositoryRoot(cwd, read) {
65789
66589
  dir = parent;
65790
66590
  }
65791
66591
  }
66592
+ var SNIPPET_LIMIT = 200;
66593
+ function snippetOf(text2, line) {
66594
+ const trimmed = (text2.split(`
66595
+ `)[line - 1] ?? "").trim();
66596
+ return trimmed.length > SNIPPET_LIMIT ? trimmed.slice(0, SNIPPET_LIMIT) : trimmed;
66597
+ }
66598
+ function reportedKeys(keys, sources, refs) {
66599
+ const texts = new Map(sources.map((file) => [file.path, file.text]));
66600
+ return keys.map((flagKey) => ({
66601
+ flagKey,
66602
+ items: refs.filter((ref) => ref.key === flagKey).map((ref) => ({ path: ref.file, line: ref.line, snippet: snippetOf(texts.get(ref.file) ?? "", ref.line) }))
66603
+ }));
66604
+ }
66605
+ function reportNeedsProject() {
66606
+ return new UsageError("praxis devops flag refs --report needs the project to report into: --project <dvp_…>", "Pass the DevOps project id the flags belong to — `praxis api devops project list` lists them, or read devops.project from praxis.jsonc.");
66607
+ }
66608
+ function reportClientMissing() {
66609
+ return new UsageError("this CLI build has no client method for devops.flags.reportCodeRefs yet", "The route is declared in the protocol but the public /devops/v1 spec (and the SDK generated from it) does not carry it yet (#1881); the reference report cannot be sent until that is regenerated.");
66610
+ }
65792
66611
  async function codeSources(ports, registry) {
65793
66612
  const suffix = registry.replace(/^\.\//, "");
65794
66613
  return (await ports.sources()).filter((file) => !file.path.replace(/^\.\//, "").endsWith(suffix));
@@ -65845,15 +66664,33 @@ async function devopsFlagScaffold(key, args, ports) {
65845
66664
  ports.emit({ kind: "object", data: { key, registry, file, call: scaffoldCall(key) } });
65846
66665
  return 0;
65847
66666
  }
65848
- async function devopsFlagRefs(key, ports) {
66667
+ async function devopsFlagRefs(key, args, ports) {
65849
66668
  const registry = await registryOf(ports);
65850
66669
  const flags = await ports.loadRegistry(registry);
65851
66670
  const keys = key !== undefined ? [key] : Object.keys(flags).sort();
65852
- const refs = flagReferences(await codeSources(ports, registry), keys);
66671
+ const sources = await codeSources(ports, registry);
66672
+ const refs = flagReferences(sources, keys);
65853
66673
  for (const ref of refs)
65854
66674
  ports.human(`${ref.file}:${ref.line}: ${ref.key}`);
65855
66675
  ports.human(refs.length ? `${refs.length} reference(s) in ${new Set(refs.map((r) => r.file)).size} file(s).` : `No references to ${key ?? "any registered flag"} in this checkout.`);
65856
- ports.emit({ kind: "object", data: { refs, reported: false } });
66676
+ if (!args.report) {
66677
+ ports.emit({ kind: "object", data: { refs, reported: false } });
66678
+ return 0;
66679
+ }
66680
+ const project = args.project;
66681
+ if (project === undefined || project === "")
66682
+ throw reportNeedsProject();
66683
+ const scannedCommit = (await ports.git(["rev-parse", "HEAD"])).trim();
66684
+ if (scannedCommit === "")
66685
+ throw new UsageError("git rev-parse HEAD answered no commit", "Run this command inside a git repository.");
66686
+ const payload = reportedKeys(Object.keys(flags).sort(), sources, refs);
66687
+ const client2 = await ports.client();
66688
+ const report = client2.devops?.projects?.flags?.reportCodeRefs;
66689
+ if (typeof report !== "function")
66690
+ throw reportClientMissing();
66691
+ const answer = await report.call(client2.devops.projects.flags, { path: { project }, body: { scannedCommit, refs: payload } });
66692
+ ports.human(`Reported ${refs.length} reference(s) over ${payload.length} key(s) to ${project} at ${scannedCommit}: ${answer.updated} flag(s) updated${answer.unknownKeys.length ? `; unknown key(s): ${answer.unknownKeys.join(", ")}` : ""}.`);
66693
+ ports.emit({ kind: "object", data: { refs, reported: true, project, scannedCommit, updated: answer.updated, unknownKeys: answer.unknownKeys } });
65857
66694
  return 0;
65858
66695
  }
65859
66696
  async function devopsFlagRemove(key, ports) {
@@ -66093,9 +66930,9 @@ function refactorRoot(fileRelToCheckout, hasTsconfig) {
66093
66930
  // src/commands/devops-refactor.ts
66094
66931
  function codeRefactorEngine() {
66095
66932
  return {
66096
- rename: async (input) => (await repositoryEngine("devops refactor rename", () => import("@mise/code/rename"))).planSemanticRename(input),
66097
- check: async (input) => (await repositoryEngine("devops refactor check", () => import("@mise/code/rename"))).inspectRenamePlan(input),
66098
- apply: async (input) => (await repositoryEngine("devops refactor apply", () => import("@mise/code/rename"))).applyRenamePlan(input)
66933
+ rename: async (input) => (await repositoryEngine("devops refactor rename", () => import("@deepractice-ai/devops-refactor/rename"))).planSemanticRename(input),
66934
+ check: async (input) => (await repositoryEngine("devops refactor check", () => import("@deepractice-ai/devops-refactor/rename"))).inspectRenamePlan(input),
66935
+ apply: async (input) => (await repositoryEngine("devops refactor apply", () => import("@deepractice-ai/devops-refactor/rename"))).applyRenamePlan(input)
66099
66936
  };
66100
66937
  }
66101
66938
  function required(value, argument, use) {
@@ -68503,6 +69340,7 @@ var FILE_ID = /^file-/;
68503
69340
  var asRecord = (value) => value !== null && typeof value === "object" && !Array.isArray(value) ? value : undefined;
68504
69341
  var isImage = (node2) => node2.type === "image" && typeof node2.url === "string";
68505
69342
  var isRef = (node2) => node2.type === "ref" && typeof node2.ref === "string";
69343
+ var NODE_TYPES = new Set(Object.keys(KNOWN_PROPS));
68506
69344
  function visit2(value, nodeId, fn) {
68507
69345
  if (Array.isArray(value)) {
68508
69346
  for (const item of value)
@@ -68696,6 +69534,8 @@ var warningLine = (warning) => {
68696
69534
  return `${warning.code}: ${warning.ref} at ${warning.nodeId}`;
68697
69535
  case "FRAME_NOT_FOUND":
68698
69536
  return `${warning.code}: ${warning.id}`;
69537
+ case "IMAGE_FILE_NOT_FOUND":
69538
+ return `${warning.code}: ${warning.url} (the platform holds no such file) at ${warning.nodeId}`;
68699
69539
  default:
68700
69540
  return `${warning.code}: ${warning.url}`;
68701
69541
  }
@@ -68803,6 +69643,268 @@ async function canvasImport(args, ports) {
68803
69643
  return 0;
68804
69644
  }
68805
69645
 
69646
+ // src/commands/events-wait.ts
69647
+ var DEFAULT_AGENT = "R1M9TQ2X";
69648
+ var BASE_BACKOFF_MS = 1000;
69649
+ var MAX_BACKOFF_MS = 60000;
69650
+ var NOTICE_NAMED = 5;
69651
+ var ANNOUNCED_KEEP = 500;
69652
+ function assumeAgentOf(env) {
69653
+ return env.PRAXIS_ASSUME_AGENT?.trim() || DEFAULT_AGENT;
69654
+ }
69655
+ function sessionOf(raw) {
69656
+ if (raw === undefined)
69657
+ return null;
69658
+ const session = raw.trim();
69659
+ if (!/^[A-Za-z0-9_-]{1,128}$/.test(session))
69660
+ throw new Error("--session takes the Claude Code session id (letters, digits, - and _)");
69661
+ return session;
69662
+ }
69663
+ var keyPart = (part) => part.replace(/[^A-Za-z0-9_-]/g, "_");
69664
+ function waitKeyOf(env, agent, session) {
69665
+ return [env, agent, ...session === null ? [] : [session]].map(keyPart).join("-");
69666
+ }
69667
+ function pidOf(raw) {
69668
+ const pid = raw === null ? NaN : Number(raw.trim());
69669
+ return Number.isInteger(pid) && pid > 0 ? pid : null;
69670
+ }
69671
+ function lockDecision(recorded, self, probe) {
69672
+ if (recorded === null || recorded === self || probe === null || !probe.alive)
69673
+ return { kind: "take" };
69674
+ if (!/events\s+wait/.test(probe.command))
69675
+ return { kind: "take" };
69676
+ if (probe.ppid === 1)
69677
+ return { kind: "replace", pid: recorded };
69678
+ return { kind: "refuse", pid: recorded };
69679
+ }
69680
+ function alreadyWaitingNotice(pid) {
69681
+ return `本会话已有 praxis agent events wait 在后台等待(pid ${pid}),不用再启动。`;
69682
+ }
69683
+ async function acquireWaitLock(ports) {
69684
+ for (let attempt = 0;attempt < 3; attempt++) {
69685
+ const recorded = pidOf(await ports.readPid());
69686
+ if (recorded === null) {
69687
+ if (await ports.createPid(String(ports.self)))
69688
+ return null;
69689
+ continue;
69690
+ }
69691
+ const decision = lockDecision(recorded, ports.self, await ports.probe(recorded));
69692
+ if (decision.kind === "refuse")
69693
+ return decision.pid;
69694
+ if (decision.kind === "replace")
69695
+ ports.terminate(decision.pid);
69696
+ await ports.replacePid(String(ports.self));
69697
+ const holder = pidOf(await ports.readPid());
69698
+ return holder === ports.self || holder === null ? null : holder;
69699
+ }
69700
+ return pidOf(await ports.readPid());
69701
+ }
69702
+ function timeoutMsOf(raw) {
69703
+ if (raw === undefined)
69704
+ return null;
69705
+ const seconds = Number(raw);
69706
+ if (!/^\d+(\.\d+)?$/.test(raw.trim()) || !Number.isFinite(seconds) || seconds <= 0)
69707
+ throw new Error("--timeout takes a positive number of seconds");
69708
+ return Math.round(seconds * 1000);
69709
+ }
69710
+ function backoffMs(failures) {
69711
+ if (failures <= 0)
69712
+ return 0;
69713
+ return Math.min(MAX_BACKOFF_MS, BASE_BACKOFF_MS * 2 ** Math.min(failures - 1, 16));
69714
+ }
69715
+ function inboxLettersUrl(apiUrl, agent) {
69716
+ return `${apiUrl}/agent/v1/agents/${encodeURIComponent(agent)}/inbox/letters?unread=true&limit=20`;
69717
+ }
69718
+ function eventsStreamUrl(apiUrl, agent) {
69719
+ return `${apiUrl}/agent/v1/agents/${encodeURIComponent(agent)}/events/stream`;
69720
+ }
69721
+ function streamHeaders(auth, lastEventId) {
69722
+ return { ...auth, Accept: "text/event-stream", ...lastEventId === null ? {} : { "Last-Event-ID": lastEventId } };
69723
+ }
69724
+ function lettersOf(body) {
69725
+ const value = body;
69726
+ if (!value || typeof value.unread !== "number" || !Array.isArray(value.letters))
69727
+ throw new Error("letters answer is not { unread, letters }");
69728
+ const letters = value.letters.filter((letter) => typeof letter === "object" && letter !== null && typeof letter.id === "string" && typeof letter.summary === "string");
69729
+ return { unread: value.unread, letters };
69730
+ }
69731
+ function feedSse(buffer, chunk) {
69732
+ const text2 = (buffer + chunk).replace(/\r\n?/g, `
69733
+ `);
69734
+ const blocks = text2.split(`
69735
+
69736
+ `);
69737
+ const rest = blocks.pop() ?? "";
69738
+ const frames = [];
69739
+ for (const block of blocks) {
69740
+ let event, id;
69741
+ const data = [];
69742
+ for (const line of block.split(`
69743
+ `)) {
69744
+ if (line === "" || line.startsWith(":"))
69745
+ continue;
69746
+ const colon = line.indexOf(":");
69747
+ const field = colon < 0 ? line : line.slice(0, colon);
69748
+ const value = colon < 0 ? "" : line.slice(colon + 1).replace(/^ /, "");
69749
+ if (field === "data")
69750
+ data.push(value);
69751
+ else if (field === "event")
69752
+ event = value;
69753
+ else if (field === "id")
69754
+ id = value;
69755
+ }
69756
+ if (data.length)
69757
+ frames.push({ ...event === undefined ? {} : { event }, ...id === undefined ? {} : { id }, data: data.join(`
69758
+ `) });
69759
+ }
69760
+ return { buffer: rest, frames };
69761
+ }
69762
+ var text2 = (value) => typeof value === "string" && value !== "";
69763
+ function wakeOf(frame) {
69764
+ let event;
69765
+ try {
69766
+ event = JSON.parse(frame.data);
69767
+ } catch {
69768
+ return null;
69769
+ }
69770
+ if (typeof event !== "object" || event === null)
69771
+ return null;
69772
+ if (event.type === "inbox.letter_delivered" && text2(event.letter_id) && typeof event.summary === "string")
69773
+ return { kind: "letter", letter: {
69774
+ id: event.letter_id,
69775
+ sender: typeof event.sender === "string" ? event.sender : "",
69776
+ ...text2(event.sender_name) ? { sender_name: event.sender_name } : {},
69777
+ summary: event.summary,
69778
+ thread: typeof event.thread === "string" ? event.thread : null,
69779
+ create_time: typeof event.create_time === "string" ? event.create_time : ""
69780
+ } };
69781
+ if (event.type === "cognition.ritual_held" && text2(event.title))
69782
+ return { kind: "ritual", ritual: {
69783
+ ritual: text2(event.ritual) ? event.ritual : "",
69784
+ owner: text2(event.owner) ? event.owner : "",
69785
+ title: event.title,
69786
+ engram: text2(event.engram) ? event.engram : ""
69787
+ } };
69788
+ return null;
69789
+ }
69790
+ function ritualNotice(ritual) {
69791
+ const origin = [ritual.owner, ritual.ritual].filter(Boolean).join(" 的仪式 ");
69792
+ return `你获得了一段新记忆:「${ritual.title}」${origin ? `(${origin}${ritual.engram ? `,${ritual.engram}` : ""})` : ""}。处理完再在后台运行 praxis agent events wait。`;
69793
+ }
69794
+ function retryableStatus(status) {
69795
+ return status >= 500 || status === 408 || status === 429;
69796
+ }
69797
+ function planNotice(page, announced) {
69798
+ const seen = new Set(announced);
69799
+ const fresh = page.letters.filter((letter) => !seen.has(letter.id));
69800
+ if (!fresh.length)
69801
+ return { announced };
69802
+ const named = fresh.slice(0, NOTICE_NAMED).map((letter) => `${letter.sender_name || letter.sender}:${letter.summary}(${letter.id})`);
69803
+ const more = fresh.length > NOTICE_NAMED ? `;另有 ${fresh.length - NOTICE_NAMED} 封` : "";
69804
+ const notice = `你有 ${fresh.length} 封新信:${named.join(";")}${more}。用 praxis_assume_inbox(action "read")读取并处理,处理完再在后台运行 praxis agent events wait。`;
69805
+ const next = [...announced, ...fresh.map((letter) => letter.id)];
69806
+ return { notice, announced: next.length > ANNOUNCED_KEEP ? next.slice(next.length - ANNOUNCED_KEEP) : next };
69807
+ }
69808
+ function waitStateOf(raw) {
69809
+ if (raw === null)
69810
+ return { announced: [], lastEventId: null };
69811
+ try {
69812
+ const value = JSON.parse(raw);
69813
+ return {
69814
+ announced: Array.isArray(value.announced) ? value.announced.filter((id) => typeof id === "string") : [],
69815
+ lastEventId: typeof value.last_event_id === "string" && /^\d+$/.test(value.last_event_id) ? value.last_event_id : null
69816
+ };
69817
+ } catch {
69818
+ return { announced: [], lastEventId: null };
69819
+ }
69820
+ }
69821
+ function waitStateText(state) {
69822
+ return JSON.stringify({ announced: state.announced, ...state.lastEventId === null ? {} : { last_event_id: state.lastEventId } });
69823
+ }
69824
+ var message = (error) => error instanceof Error ? error.message : String(error);
69825
+ async function runEventsWait(ports) {
69826
+ const stop = new AbortController;
69827
+ let timedOut = false;
69828
+ const timer = ports.timeoutMs === null ? undefined : setTimeout(() => {
69829
+ timedOut = true;
69830
+ stop.abort();
69831
+ }, ports.timeoutMs);
69832
+ const state = await ports.readState();
69833
+ let announced = state.announced;
69834
+ let lastEventId = state.lastEventId;
69835
+ const announceLetters = async (page) => {
69836
+ const planned = planNotice(page, announced);
69837
+ if (!planned.notice)
69838
+ return false;
69839
+ announced = planned.announced;
69840
+ await ports.writeState({ announced, lastEventId });
69841
+ ports.print(planned.notice);
69842
+ return true;
69843
+ };
69844
+ const announce = async () => announceLetters(await ports.fetchLetters());
69845
+ try {
69846
+ try {
69847
+ if (await announce())
69848
+ return 0;
69849
+ } catch (error) {
69850
+ ports.log(`praxis agent events wait: reading letters failed: ${message(error)}`);
69851
+ }
69852
+ ports.log(`praxis agent events wait: waiting for letters to assume agent ${ports.agent}`);
69853
+ let failures = 0;
69854
+ while (!stop.signal.aborted) {
69855
+ if (failures)
69856
+ await ports.sleep(backoffMs(failures), stop.signal);
69857
+ if (stop.signal.aborted)
69858
+ break;
69859
+ try {
69860
+ const opened = await ports.openStream(stop.signal, lastEventId);
69861
+ if (opened.status < 200 || opened.status >= 300 || !opened.chunks) {
69862
+ if (!retryableStatus(opened.status)) {
69863
+ ports.log(`praxis agent events wait: the event stream was refused (HTTP ${opened.status}${opened.reason ? `: ${opened.reason}` : ""})`);
69864
+ return 1;
69865
+ }
69866
+ throw new Error(`HTTP ${opened.status}`);
69867
+ }
69868
+ if (await announce())
69869
+ return 0;
69870
+ if (failures)
69871
+ ports.log("praxis agent events wait: event stream reconnected");
69872
+ failures = 0;
69873
+ let buffer = "";
69874
+ for await (const chunk of opened.chunks) {
69875
+ const fed = feedSse(buffer, chunk);
69876
+ buffer = fed.buffer;
69877
+ for (const frame of fed.frames) {
69878
+ const wake = wakeOf(frame);
69879
+ if (wake !== null && frame.id !== undefined)
69880
+ lastEventId = frame.id;
69881
+ if (wake?.kind === "letter" && await announceLetters({ unread: 1, letters: [wake.letter] }))
69882
+ return 0;
69883
+ if (wake?.kind === "ritual") {
69884
+ await ports.writeState({ announced, lastEventId });
69885
+ ports.print(ritualNotice(wake.ritual));
69886
+ return 0;
69887
+ }
69888
+ }
69889
+ }
69890
+ throw new Error("the event stream ended");
69891
+ } catch (error) {
69892
+ if (stop.signal.aborted)
69893
+ break;
69894
+ failures += 1;
69895
+ ports.log(`praxis agent events wait: ${message(error)} (${failures} in a row, reconnecting in ${backoffMs(failures) / 1000}s)`);
69896
+ }
69897
+ }
69898
+ if (timedOut)
69899
+ ports.print(`${(ports.timeoutMs ?? 0) / 1000} 秒内没有新信。需要继续等待时再在后台运行 praxis agent events wait。`);
69900
+ return 0;
69901
+ } finally {
69902
+ if (timer)
69903
+ clearTimeout(timer);
69904
+ stop.abort();
69905
+ }
69906
+ }
69907
+
68806
69908
  // src/main.ts
68807
69909
  import { spawnSync } from "node:child_process";
68808
69910
 
@@ -68920,15 +70022,15 @@ class ModelStream {
68920
70022
  finishReason = "unknown";
68921
70023
  usage;
68922
70024
  add(event) {
68923
- const data = streamData(event), message = record(data.message), response = record(data.response);
70025
+ const data = streamData(event), message2 = record(data.message), response = record(data.response);
68924
70026
  this.chunks.push(streamText(event));
68925
70027
  const choices = Array.isArray(data.choices) ? data.choices : [];
68926
- const reason2 = choices.map((c) => record(c).finish_reason).find((r) => typeof r === "string" && r) ?? record(data.delta).stop_reason ?? message.stop_reason ?? data.stop_reason ?? record(response.incomplete_details).reason ?? response.status;
70028
+ const reason2 = choices.map((c) => record(c).finish_reason).find((r) => typeof r === "string" && r) ?? record(data.delta).stop_reason ?? message2.stop_reason ?? data.stop_reason ?? record(response.incomplete_details).reason ?? response.status;
68927
70029
  if (typeof reason2 === "string" && reason2)
68928
70030
  this.finishReason = reason2;
68929
70031
  else if (["response.completed", "response.incomplete", "response.failed"].includes(String(data.type)))
68930
70032
  this.finishReason = String(data.type).slice("response.".length);
68931
- for (const usage of [message.usage, data.usage, response.usage]) {
70033
+ for (const usage of [message2.usage, data.usage, response.usage]) {
68932
70034
  if (usage !== null && typeof usage === "object" && !Array.isArray(usage))
68933
70035
  this.usage = { ...this.usage, ...record(usage) };
68934
70036
  }
@@ -68993,8 +70095,8 @@ function isSuccess(verb, ctx) {
68993
70095
  }
68994
70096
  var past = { create: "Created", update: "Updated", delete: "Deleted", remove: "Deleted", purge: "Deleted", pause: "Paused", unpause: "Unpaused", resume: "Resumed", start: "Started", stop: "Stopped", cancel: "Cancelled", enable: "Enabled", disable: "Disabled", connect: "Connected", extend: "Extended", fork: "Forked", upload: "Uploaded", run: "Started" };
68995
70097
  var deleted = (verb) => /^(delete|remove|purge)(-|$)/.test(verb);
68996
- function width(text2) {
68997
- return [...text2].reduce((sum, ch) => {
70098
+ function width(text3) {
70099
+ return [...text3].reduce((sum, ch) => {
68998
70100
  const cp = ch.codePointAt(0);
68999
70101
  return sum + (/\p{Mark}/u.test(ch) || cp === 8205 ? 0 : cp >= 4352 && (cp <= 4447 || cp >= 11904 && cp <= 42191 || cp >= 44032 && cp <= 55203 || cp >= 63744 && cp <= 64255 || cp >= 65040 && cp <= 65135 || cp >= 65281 && cp <= 65376 || cp >= 127744) ? 2 : 1);
69000
70102
  }, 0);
@@ -69002,13 +70104,13 @@ function width(text2) {
69002
70104
  function truncate(value, size) {
69003
70105
  if (width(value) <= size)
69004
70106
  return value;
69005
- let text2 = "";
70107
+ let text3 = "";
69006
70108
  for (const ch of value) {
69007
- if (width(text2 + ch) > size - 1)
70109
+ if (width(text3 + ch) > size - 1)
69008
70110
  break;
69009
- text2 += ch;
70111
+ text3 += ch;
69010
70112
  }
69011
- return text2 + "…";
70113
+ return text3 + "…";
69012
70114
  }
69013
70115
  function table(items, ctx, paint) {
69014
70116
  const columns = columnsFor(items);
@@ -69041,13 +70143,13 @@ function table(items, ctx, paint) {
69041
70143
  sizes[index]--;
69042
70144
  }
69043
70145
  const line = (row, header) => row.map((v, i) => {
69044
- const text2 = truncate(v, sizes[i]);
69045
- let styled = header ? paint.dim(text2) : text2;
70146
+ const text3 = truncate(v, sizes[i]);
70147
+ let styled = header ? paint.dim(text3) : text3;
69046
70148
  if (!header && ["status", "state"].includes(columns[i])) {
69047
70149
  const color = /^(running|active|ready|succeeded|completed|enabled)$/i.test(v) ? paint.green : /^(pending|queued|starting|creating|paused)$/i.test(v) ? paint.yellow : /^(failed|error|cancelled|expired|disabled|deleted|purging|purged|suspended)$/i.test(v) ? paint.red : (s) => s;
69048
- styled = color(text2);
70150
+ styled = color(text3);
69049
70151
  }
69050
- return styled + (i === row.length - 1 ? "" : " ".repeat(Math.max(0, sizes[i] - width(text2))));
70152
+ return styled + (i === row.length - 1 ? "" : " ".repeat(Math.max(0, sizes[i] - width(text3))));
69051
70153
  }).join(" ");
69052
70154
  return [line(headers, true), ...rows.map((row) => line(row, false))].join(`
69053
70155
  `) + `
@@ -69146,9 +70248,9 @@ function renderHuman(result, ctx) {
69146
70248
  }
69147
70249
 
69148
70250
  // src/output/agent.ts
69149
- function cell(text2) {
69150
- const chars = [...text2];
69151
- const limited = chars.length > 500 ? chars.slice(0, 500).join("") + `…[+${chars.length - 500} chars, use --json]` : text2;
70251
+ function cell(text3) {
70252
+ const chars = [...text3];
70253
+ const limited = chars.length > 500 ? chars.slice(0, 500).join("") + `…[+${chars.length - 500} chars, use --json]` : text3;
69152
70254
  return limited.replace(/\\/g, "\\\\").replace(/\|/g, "\\|").replace(/\r?\n/g, "<br>").replace(/\r/g, "<br>");
69153
70255
  }
69154
70256
  function renderAgent(result, ctx) {
@@ -69159,9 +70261,9 @@ function renderAgent(result, ctx) {
69159
70261
  if (modelStream(result.op)) {
69160
70262
  if (!result.summary)
69161
70263
  return {};
69162
- const { text: text2, finish_reason, usage } = result.summary;
69163
- return { stdout: `${text2}${text2.endsWith(`
69164
- `) || !text2 ? "" : `
70264
+ const { text: text3, finish_reason, usage } = result.summary;
70265
+ return { stdout: `${text3}${text3.endsWith(`
70266
+ `) || !text3 ? "" : `
69165
70267
  `}finish_reason: ${finish_reason}
69166
70268
  ${usage ? `usage: ${JSON.stringify(usage)}
69167
70269
  ` : ""}` };
@@ -69380,18 +70482,18 @@ function errorInput(error, ctx) {
69380
70482
  const details = candidate !== null && typeof candidate === "object" && !Array.isArray(candidate) ? candidate : undefined;
69381
70483
  const problem = serverProblem(Object.keys(nested).length ? nested : raw);
69382
70484
  const serverText = (value) => typeof value === "string" && value.trim() ? value : undefined;
69383
- let message = error instanceof Error ? error.message : "Unexpected error";
69384
- const prefix = message.match(/^([A-Z][A-Z0-9_]+):\s*/)?.[1];
70485
+ let message2 = error instanceof Error ? error.message : "Unexpected error";
70486
+ const prefix = message2.match(/^([A-Z][A-Z0-9_]+):\s*/)?.[1];
69385
70487
  const code = error instanceof UsageError ? error.code : businessCode(raw.code) ?? businessCode(nested.code) ?? businessCode(raw.error_code) ?? prefix ?? businessCode(sdk?.code) ?? (sdk?.status ? `HTTP_${sdk.status}` : sdk ? "API_ERROR" : "RUNTIME_ERROR");
69386
70488
  let stripped = false;
69387
- while (message.startsWith(`${code}:`)) {
69388
- message = message.slice(code.length + 1).trimStart();
70489
+ while (message2.startsWith(`${code}:`)) {
70490
+ message2 = message2.slice(code.length + 1).trimStart();
69389
70491
  stripped = true;
69390
70492
  }
69391
70493
  if (stripped)
69392
- message = `${humanize(code)}${message ? `: ${message}` : ""}`;
70494
+ message2 = `${humanize(code)}${message2 ? `: ${message2}` : ""}`;
69393
70495
  const status = sdk?.status, request_id = sdk?.requestId;
69394
- message = serverText(problem?.detail) ?? serverText(problem?.title) ?? message;
70496
+ message2 = serverText(problem?.detail) ?? serverText(problem?.title) ?? message2;
69395
70497
  const authFailure = status === 401 || ["NOT_LOGGED_IN", "UNAUTHENTICATED", "TOKEN_REVOKED", "LOGIN_FAILED", "MANAGED_LOGIN_EXPIRED"].includes(code);
69396
70498
  const source = ctx.credentialSource ?? "login";
69397
70499
  let hint3 = genericHint;
@@ -69409,11 +70511,11 @@ function errorInput(error, ctx) {
69409
70511
  hint3 = "Rate limited; retry later.";
69410
70512
  else if (status !== undefined && status >= 500)
69411
70513
  hint3 = `Server error; retry later.${request_id ? ` Request id: ${request_id}.` : ""}`;
69412
- return { kind: "error", code, message, hint: hint3, ...details !== undefined ? { details } : {}, ...problem !== undefined ? { problem } : {}, env: ctx.env, ...authFailure ? { credential_source: source } : {}, ...status !== undefined ? { status } : {}, ...request_id ? { request_id } : {} };
70514
+ return { kind: "error", code, message: message2, hint: hint3, ...details !== undefined ? { details } : {}, ...problem !== undefined ? { problem } : {}, env: ctx.env, ...authFailure ? { credential_source: source } : {}, ...status !== undefined ? { status } : {}, ...request_id ? { request_id } : {} };
69413
70515
  }
69414
70516
 
69415
70517
  // src/output/progress.ts
69416
- function startProgress(ctx, write = (text2) => writeOutput({ stderr: text2 })) {
70518
+ function startProgress(ctx, write = (text3) => writeOutput({ stderr: text3 })) {
69417
70519
  if (ctx.mode !== "human" || !ctx.stderrIsTTY)
69418
70520
  return () => {};
69419
70521
  let interval;
@@ -69439,7 +70541,7 @@ function startProgress(ctx, write = (text2) => writeOutput({ stderr: text2 })) {
69439
70541
  }
69440
70542
 
69441
70543
  // src/main.ts
69442
- var version = "0.3.0-dev.9515f27";
70544
+ var version = "0.3.0-dev.983bcdd";
69443
70545
  var commands = commandTree(operations);
69444
70546
  var manual = [...workflows.map((w) => w.words), [API_WORD]];
69445
70547
  function route(argv) {
@@ -69521,7 +70623,7 @@ var defaults = {
69521
70623
  return;
69522
70624
  const cmd = process.platform === "darwin" ? ["open", url] : process.platform === "win32" ? ["rundll32", "url.dll,FileProtocolHandler", url] : ["xdg-open", url];
69523
70625
  await new Promise((resolve12, reject) => {
69524
- const child = spawn4(cmd[0], cmd.slice(1), { stdio: "ignore" });
70626
+ const child = spawn5(cmd[0], cmd.slice(1), { stdio: "ignore" });
69525
70627
  child.once("error", reject);
69526
70628
  child.once("close", () => resolve12());
69527
70629
  });
@@ -69530,12 +70632,12 @@ var defaults = {
69530
70632
  wait: (ms) => new Promise((resolve12) => setTimeout(resolve12, ms)),
69531
70633
  render,
69532
70634
  spawn: (cmd, args, options) => new Promise((resolve12, reject) => {
69533
- const child = spawn4(cmd, args, { cwd: options.cwd, stdio: ["ignore", 2, 2] });
70635
+ const child = spawn5(cmd, args, { cwd: options.cwd, stdio: ["ignore", 2, 2] });
69534
70636
  child.once("error", reject);
69535
70637
  child.once("close", (code) => resolve12(code ?? 1));
69536
70638
  }),
69537
70639
  spawnCapture: (cmd, args, options) => new Promise((resolve12, reject) => {
69538
- const child = spawn4(cmd, args, { cwd: options.cwd, stdio: ["ignore", "pipe", "pipe"] });
70640
+ const child = spawn5(cmd, args, { cwd: options.cwd, stdio: ["ignore", "pipe", "pipe"] });
69539
70641
  const chunks = [];
69540
70642
  child.stdout.on("data", (c) => chunks.push(c));
69541
70643
  child.stderr.on("data", (c) => chunks.push(c));
@@ -69594,7 +70696,7 @@ var appOptions = {
69594
70696
  { name: "case", type: "string", description: "Scenario title substring; the engine's `scenario` (case ids are a later slice)." },
69595
70697
  { name: "e2e", type: "boolean", description: "The large end-to-end tests; exactly --size large, so the two cannot be combined." },
69596
70698
  { name: "retries", type: "string", description: "Retries after a failing scenario (default: 0)." },
69597
- { name: "ctrf", type: "string", description: "Write the CTRF report here (default: <cwd>/.mise/ctrf/<run>.json)." }
70699
+ { name: "ctrf", type: "string", description: "Write the CTRF report here (default: <cwd>/.praxis/ctrf/<run>.json)." }
69598
70700
  ],
69599
70701
  "devops test report": [
69600
70702
  { name: "id", type: "string", description: "Show one run's detail instead of the recent list." },
@@ -69614,6 +70716,14 @@ var appOptions = {
69614
70716
  "devops flag scaffold": [
69615
70717
  { name: "out", type: "string", description: "Directory the paired on/off scenario stubs are written to (default: the current directory)." }
69616
70718
  ],
70719
+ "devops flag refs": [
70720
+ { name: "report", type: "boolean", description: "Post this checkout's scan to the platform, so archiving a flag is refused while code still names it (ADR-125 §4)." },
70721
+ { name: "project", type: "string", description: "With --report: the DevOps project id (dvp_…) whose flags the scan is reported into. Required." }
70722
+ ],
70723
+ "agent events wait": [
70724
+ { name: "timeout", type: "string", description: "Give up after this many seconds, print that nothing arrived and exit 0 (default: wait until a letter arrives)." },
70725
+ { name: "session", type: "string", description: "The Claude Code session this waiter wakes: its announced letters and pid file are kept per session, and a second waiter for the same session exits at once (default: one waiter per agent)." }
70726
+ ],
69617
70727
  "canvas import": [
69618
70728
  { name: "name", type: "string", description: "Name for the new canvas (default: the file name without .pen)." },
69619
70729
  { name: "canvas", type: "string", description: "Import into this existing canvas instead of a new one. Whole-canvas replacement: it clears what is already there and requires --yes." },
@@ -69628,17 +70738,19 @@ var appOptions = {
69628
70738
  };
69629
70739
  appOptions["devops engine deploy"] = appOptions["devops deploy"];
69630
70740
  var workflowOptions = (words) => words[0] === "skill" ? [{ name: "install", type: "string" }] : appOptions[words.join(" ")] ?? [];
69631
- function flagPortsFor(ports, context, emit) {
70741
+ function flagPortsFor(ports, context, emit, connect) {
69632
70742
  return {
69633
70743
  mode: context.mode,
69634
70744
  emit,
69635
- human: (text2) => {
70745
+ human: (text3) => {
69636
70746
  if (context.mode === "human")
69637
- emit({ kind: "message", channel: "stdout", text: text2 });
70747
+ emit({ kind: "message", channel: "stdout", text: text3 });
69638
70748
  },
69639
70749
  cwd: ports.cwd,
69640
70750
  readFile: ports.readFile,
69641
- writeFile: (path, text2) => writeFile5(path, text2, "utf8"),
70751
+ git: async (args) => (await ports.spawnCapture("git", [...args], { cwd: ports.cwd })).output,
70752
+ client: connect,
70753
+ writeFile: (path, text3) => writeFile5(path, text3, "utf8"),
69642
70754
  mkdir: async (path) => {
69643
70755
  await mkdir4(path, { recursive: true });
69644
70756
  },
@@ -69662,9 +70774,9 @@ function toolPortsFor(ports, context, emit) {
69662
70774
  return {
69663
70775
  mode: context.mode,
69664
70776
  emit,
69665
- human: (text2) => {
70777
+ human: (text3) => {
69666
70778
  if (context.mode === "human")
69667
- emit({ kind: "message", channel: "stdout", text: text2 });
70779
+ emit({ kind: "message", channel: "stdout", text: text3 });
69668
70780
  },
69669
70781
  cwd: ports.cwd,
69670
70782
  readFile: ports.readFile,
@@ -69679,7 +70791,7 @@ function toolPortsFor(ports, context, emit) {
69679
70791
  },
69680
70792
  git: (args, cwd) => ports.spawnCapture("git", args, { cwd }),
69681
70793
  run: (cmd, args, cwd) => new Promise((resolve12, reject) => {
69682
- const child = spawn4(cmd, args, { cwd, stdio: "inherit" });
70794
+ const child = spawn5(cmd, args, { cwd, stdio: "inherit" });
69683
70795
  child.once("error", reject);
69684
70796
  child.once("close", (code) => resolve12(code ?? 1));
69685
70797
  }),
@@ -69704,7 +70816,7 @@ async function main3(argv, injected = {}) {
69704
70816
  columns: ports.columns,
69705
70817
  now: ports.now(),
69706
70818
  envVars: { NO_COLOR: ports.env.NO_COLOR, FORCE_COLOR: ports.env.FORCE_COLOR, TERM: ports.env.TERM },
69707
- env: ports.env.PRAXIS_ENV ?? "develop"
70819
+ env: ports.env.PRAXIS_ENV ?? DEFAULT_ENV
69708
70820
  };
69709
70821
  let stopProgress = () => {};
69710
70822
  let quiet = false;
@@ -69974,9 +71086,9 @@ Examples:
69974
71086
  },
69975
71087
  mode: ctx.mode,
69976
71088
  emit,
69977
- human: (text2) => {
71089
+ human: (text3) => {
69978
71090
  if (ctx.mode === "human")
69979
- emit({ kind: "message", channel: "stdout", text: text2 });
71091
+ emit({ kind: "message", channel: "stdout", text: text3 });
69980
71092
  },
69981
71093
  cwd: ports.cwd
69982
71094
  });
@@ -70003,14 +71115,14 @@ Examples:
70003
71115
  }, {
70004
71116
  mode: ctx.mode,
70005
71117
  emit,
70006
- human: (text2) => {
71118
+ human: (text3) => {
70007
71119
  if (ctx.mode === "human")
70008
- emit({ kind: "message", channel: "stdout", text: text2 });
71120
+ emit({ kind: "message", channel: "stdout", text: text3 });
70009
71121
  },
70010
71122
  engine: codeRefactorEngine(),
70011
71123
  hasFile: (path2) => existsSync4(path2),
70012
71124
  readFile: ports.readFile,
70013
- writeFile: (path2, text2) => writeFile5(path2, text2, "utf8"),
71125
+ writeFile: (path2, text3) => writeFile5(path2, text3, "utf8"),
70014
71126
  mkdir: async (path2) => {
70015
71127
  await mkdir4(path2, { recursive: true });
70016
71128
  },
@@ -70027,9 +71139,9 @@ Examples:
70027
71139
  const shellPorts = {
70028
71140
  mode: ctx.mode,
70029
71141
  emit,
70030
- human: (text2) => {
71142
+ human: (text3) => {
70031
71143
  if (ctx.mode === "human")
70032
- emit({ kind: "message", channel: "stdout", text: text2 });
71144
+ emit({ kind: "message", channel: "stdout", text: text3 });
70033
71145
  },
70034
71146
  engine: await repositoryEngine(name, () => localEngine(ports.cwd)),
70035
71147
  ...localFilePorts(ports.cwd)
@@ -70042,9 +71154,9 @@ Examples:
70042
71154
  const testPorts = {
70043
71155
  mode: ctx.mode,
70044
71156
  emit,
70045
- human: (text2) => {
71157
+ human: (text3) => {
70046
71158
  if (ctx.mode === "human")
70047
- emit({ kind: "message", channel: "stdout", text: text2 });
71159
+ emit({ kind: "message", channel: "stdout", text: text3 });
70048
71160
  },
70049
71161
  engine: await repositoryEngine(name, () => localEngine(ports.cwd)),
70050
71162
  checkout: await localCheckout(ports.cwd, (cmd, args, options) => ports.spawnCapture(cmd, args, options))
@@ -70053,9 +71165,9 @@ Examples:
70053
71165
  return await devopsTestReport({ path: parsed.positional[0], id: parsed.flags.id?.[0], upload: Boolean(parsed.flags.upload), project: parsed.flags.project?.[0] }, testPorts, {
70054
71166
  mode: ctx.mode,
70055
71167
  emit,
70056
- human: (text2) => {
71168
+ human: (text3) => {
70057
71169
  if (ctx.mode === "human")
70058
- emit({ kind: "message", channel: "stdout", text: text2 });
71170
+ emit({ kind: "message", channel: "stdout", text: text3 });
70059
71171
  },
70060
71172
  root: async () => await checkoutRoot(ports.cwd, ports.readFile),
70061
71173
  readFile: ports.readFile,
@@ -70085,13 +71197,13 @@ Examples:
70085
71197
  git: (args) => ports.spawnCapture("git", args, { cwd: ports.cwd }),
70086
71198
  mode: ctx.mode,
70087
71199
  emit,
70088
- human: (text2) => {
71200
+ human: (text3) => {
70089
71201
  if (ctx.mode === "human")
70090
- emit({ kind: "message", channel: "stdout", text: text2 });
71202
+ emit({ kind: "message", channel: "stdout", text: text3 });
70091
71203
  }
70092
71204
  });
70093
71205
  }
70094
- const flagPorts = flagPortsFor(ports, ctx, emit);
71206
+ const flagPorts = flagPortsFor(ports, ctx, emit, async () => await auth.client(org));
70095
71207
  if (name === "devops flag sync")
70096
71208
  return await devopsFlagSync({ check: Boolean(parsed.flags.check) }, flagPorts);
70097
71209
  if (name === "devops flag check")
@@ -70099,7 +71211,7 @@ Examples:
70099
71211
  if (name === "devops flag scaffold")
70100
71212
  return await devopsFlagScaffold(parsed.positional[0], { out: parsed.flags.out?.[0] }, flagPorts);
70101
71213
  if (name === "devops flag refs")
70102
- return await devopsFlagRefs(parsed.positional[0], flagPorts);
71214
+ return await devopsFlagRefs(parsed.positional[0], { report: Boolean(parsed.flags.report), project: parsed.flags.project?.[0] }, flagPorts);
70103
71215
  return await devopsFlagRemove(parsed.positional[0], flagPorts);
70104
71216
  }
70105
71217
  if (!quiet)
@@ -70137,9 +71249,9 @@ Examples:
70137
71249
  emit({ kind: "object", data: await auth.switchOrganization(parsed.positional[0]) });
70138
71250
  break;
70139
71251
  case "app create": {
70140
- const appPorts = { ...ports, mode: ctx.mode, emit, human: (text2) => {
71252
+ const appPorts = { ...ports, mode: ctx.mode, emit, human: (text3) => {
70141
71253
  if (ctx.mode === "human")
70142
- emit({ kind: "message", channel: "stdout", text: text2 });
71254
+ emit({ kind: "message", channel: "stdout", text: text3 });
70143
71255
  }, random: randomSecret };
70144
71256
  await appCreate({ name: parsed.positional[0], dir: parsed.flags.dir?.[0], template: parsed.flags.template?.[0], install: !parsed.flags["no-install"] }, config.env, appPorts);
70145
71257
  break;
@@ -70168,13 +71280,129 @@ Examples:
70168
71280
  wait: ports.wait,
70169
71281
  mode: ctx.mode,
70170
71282
  emit,
70171
- human: (text2) => {
71283
+ human: (text3) => {
70172
71284
  if (ctx.mode === "human")
70173
- emit({ kind: "message", channel: "stdout", text: text2 });
71285
+ emit({ kind: "message", channel: "stdout", text: text3 });
70174
71286
  },
70175
71287
  cwd: ports.cwd
70176
71288
  });
70177
71289
  }
71290
+ case "agent events wait": {
71291
+ const agent = assumeAgentOf(ports.env);
71292
+ const timeoutMs = (() => {
71293
+ try {
71294
+ return timeoutMsOf(parsed.flags.timeout?.[0]);
71295
+ } catch (error) {
71296
+ throw new UsageError(error.message, "Example: praxis agent events wait --timeout 3600");
71297
+ }
71298
+ })();
71299
+ const headers = async () => {
71300
+ const credential = await auth.get(org);
71301
+ return { Authorization: `Bearer ${credential.token}`, ...credential.source === "api-key" ? { "X-API-Key": credential.token } : {} };
71302
+ };
71303
+ const failure2 = (status, body) => `HTTP ${status}${body?.error?.code ? ` ${body.error.code}` : ""}${body?.error?.message ? `: ${String(redact(body.error.message, secrets))}` : ""}`;
71304
+ const session = (() => {
71305
+ try {
71306
+ return sessionOf(parsed.flags.session?.[0]);
71307
+ } catch (error) {
71308
+ throw new UsageError(error.message, "Example: praxis agent events wait --session 0f6c…");
71309
+ }
71310
+ })();
71311
+ const key = waitKeyOf(config.env, agent, session);
71312
+ const waitDir = join12(ports.env.HOME || homedir3(), ".praxis", "cli", "events-wait");
71313
+ const statePath = join12(waitDir, `${key}.json`);
71314
+ const pidPath = join12(waitDir, `${key}.pid`);
71315
+ await mkdir4(waitDir, { recursive: true, mode: 448 });
71316
+ const holder = await acquireWaitLock({
71317
+ self: process.pid,
71318
+ readPid: () => readFile7(pidPath, "utf8").catch(() => null),
71319
+ createPid: (text3) => writeFile5(pidPath, text3, { mode: 384, flag: "wx" }).then(() => true, () => false),
71320
+ replacePid: (text3) => writeFile5(pidPath, text3, { mode: 384 }),
71321
+ probe: async (pid) => {
71322
+ try {
71323
+ process.kill(pid, 0);
71324
+ } catch (error) {
71325
+ if (error.code !== "EPERM")
71326
+ return { alive: false };
71327
+ }
71328
+ const ps = spawnSync("ps", ["-o", "ppid=,command=", "-p", String(pid)], { encoding: "utf8" });
71329
+ const line = ps.stdout?.trim() ?? "";
71330
+ const match = /^(\d+)\s+(.*)$/.exec(line);
71331
+ return match ? { alive: true, ppid: Number(match[1]), command: match[2] } : { alive: false };
71332
+ },
71333
+ terminate: (pid) => {
71334
+ try {
71335
+ process.kill(pid, "SIGTERM");
71336
+ } catch {}
71337
+ }
71338
+ });
71339
+ if (holder !== null) {
71340
+ process.stdout.write(alreadyWaitingNotice(holder) + `
71341
+ `);
71342
+ return 0;
71343
+ }
71344
+ const release = () => {
71345
+ try {
71346
+ if (pidOf(readFileSync3(pidPath, "utf8")) === process.pid)
71347
+ unlinkSync(pidPath);
71348
+ } catch {}
71349
+ };
71350
+ const onSignal = (signal) => {
71351
+ release();
71352
+ process.exit(signal === "SIGINT" ? 130 : 143);
71353
+ };
71354
+ for (const signal of ["SIGTERM", "SIGINT", "SIGHUP"])
71355
+ process.once(signal, onSignal);
71356
+ try {
71357
+ return await runEventsWait({
71358
+ agent,
71359
+ timeoutMs,
71360
+ fetchLetters: async () => {
71361
+ const response = await wireFetch(inboxLettersUrl(config.apiUrl, agent), { headers: await headers(), signal: AbortSignal.timeout(30000), redirect: "error" });
71362
+ const body = await response.json().catch(() => null);
71363
+ if (!response.ok)
71364
+ throw new Error(failure2(response.status, body));
71365
+ return lettersOf(body);
71366
+ },
71367
+ openStream: async (signal, lastEventId) => {
71368
+ const response = await wireFetch(eventsStreamUrl(config.apiUrl, agent), {
71369
+ headers: streamHeaders(await headers(), lastEventId),
71370
+ signal,
71371
+ redirect: "error"
71372
+ });
71373
+ if (!response.ok || !response.body) {
71374
+ const body = await response.json().catch(() => null);
71375
+ return { status: response.status, reason: failure2(response.status, body) };
71376
+ }
71377
+ return { status: response.status, chunks: response.body.pipeThrough(new TextDecoderStream) };
71378
+ },
71379
+ readState: async () => waitStateOf(await readFile7(statePath, "utf8").catch(() => null)),
71380
+ writeState: async (next) => {
71381
+ await mkdir4(dirname10(statePath), { recursive: true, mode: 448 });
71382
+ await writeFile5(statePath, waitStateText(next), { mode: 384 });
71383
+ },
71384
+ print: (line) => {
71385
+ process.stdout.write(line + `
71386
+ `);
71387
+ },
71388
+ log: (line) => {
71389
+ process.stderr.write(String(redact(line, secrets)) + `
71390
+ `);
71391
+ },
71392
+ sleep: (ms, signal) => new Promise((resolve12) => {
71393
+ const timer = setTimeout(resolve12, ms);
71394
+ signal.addEventListener("abort", () => {
71395
+ clearTimeout(timer);
71396
+ resolve12();
71397
+ }, { once: true });
71398
+ })
71399
+ });
71400
+ } finally {
71401
+ release();
71402
+ for (const signal of ["SIGTERM", "SIGINT", "SIGHUP"])
71403
+ process.removeListener(signal, onSignal);
71404
+ }
71405
+ }
70178
71406
  case "canvas import": {
70179
71407
  const authorize = async () => {
70180
71408
  const credential = await auth.get(org);
@@ -70230,9 +71458,9 @@ Examples:
70230
71458
  cwd: ports.cwd,
70231
71459
  rpc,
70232
71460
  upload,
70233
- human: (text2) => {
71461
+ human: (text3) => {
70234
71462
  if (ctx.mode === "human")
70235
- emit({ kind: "message", channel: "stdout", text: text2 });
71463
+ emit({ kind: "message", channel: "stdout", text: text3 });
70236
71464
  }
70237
71465
  });
70238
71466
  }
@@ -70264,7 +71492,8 @@ if (true) {
70264
71492
  process.exit(0);
70265
71493
  throw error;
70266
71494
  });
70267
- process.exitCode = await main3(process.argv.slice(2));
71495
+ const argv = process.argv.slice(2);
71496
+ process.exitCode = isDevopsTestRun(route(argv).words) && needsCacheOffReexec(process.env) ? await reexecWithCacheOff() : await main3(argv);
70268
71497
  }
70269
71498
  export {
70270
71499
  main3 as main