@deepraxis/cli 0.2.1-dev.3cf83a0 → 0.2.1-dev.3eb4944

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/praxis.js CHANGED
@@ -10198,7 +10198,13 @@ Execution errors include error.details.prints containing output printed before f
10198
10198
  name: "loudness",
10199
10199
  type: "object",
10200
10200
  required: false,
10201
- description: "Optional loudness normalization target; normalization adds analysis and rendering work."
10201
+ description: "Loudness normalization target. Omitted, the export is normalized to -14 LUFS integrated and -1 dBTP true peak, the level short-video and streaming platforms play at; null renders without normalization. Normalization adds analysis and rendering work."
10202
+ },
10203
+ {
10204
+ name: "poster",
10205
+ type: "object",
10206
+ required: false,
10207
+ description: "Cover frame, in seconds on the project clock. Omitted, the cover is the first frame with picture that is not inside a fade-in or a transition — a black opening no longer makes the library thumbnail black. A frame inside a transition is skipped, and a timeline that is black throughout keeps its first frame (reported as BLACK_FIRST_FRAME). The frame actually used is reported as poster_at on the export."
10202
10208
  }
10203
10209
  ]
10204
10210
  }
@@ -10281,6 +10287,57 @@ Execution errors include error.details.prints containing output printed before f
10281
10287
  ]
10282
10288
  }
10283
10289
  },
10290
+ {
10291
+ resource: "cut.projects.renders",
10292
+ method: "create",
10293
+ summary: "Create draft range render",
10294
+ description: "Render one interval of the timeline so you can hear or look at how that passage comes out, without publishing anything to a media library. Choose kind audio for the mixed soundtrack as an .m4a file, or kind video for a draft-quality .mp4 with picture and sound. from and to are seconds on the project clock and must satisfy 0 <= from < to, to <= the timeline duration, and to - from <= 120; a longer passage is requested in several 分段请求 ranges and joined by the caller. The result is a temporary file (purpose user_data) that expires 24 hours after it is stored and is never imported into a library, so it is not a deliverable and carries no cut-export tag. HTTP 202 only accepts the job; poll praxis.cut.renders.retrieve using the returned id until status is done or failed, then read url while it lasts. A draft also bills like a draft export, by rendered seconds. Each project runs at most 2 draft renders at a time, a budget separate from its exports; a third answers HTTP 429 CUT_BUSY and the same call succeeds once one finishes.",
10295
+ http: "POST",
10296
+ path: "/cut/v1/projects/{project_id}/renders",
10297
+ streaming: "no",
10298
+ pagination: false,
10299
+ pathParams: [
10300
+ {
10301
+ name: "project_id",
10302
+ sdkName: "project_id",
10303
+ description: "Project identifier returned by its create or list operation; use the id, not a display name."
10304
+ }
10305
+ ],
10306
+ query: [],
10307
+ body: {
10308
+ required: true,
10309
+ fields: [
10310
+ {
10311
+ name: "kind",
10312
+ type: "string",
10313
+ enum: [
10314
+ "audio",
10315
+ "video"
10316
+ ],
10317
+ required: true,
10318
+ description: "audio renders the mixed soundtrack alone as an .m4a file for listening; video renders a draft-quality .mp4 with picture and sound for looking at. An audio draft is the cheaper of the two and is what a loudness or mix measurement asks for."
10319
+ },
10320
+ {
10321
+ name: "from",
10322
+ type: "number",
10323
+ required: true,
10324
+ description: "Start of the interval in seconds on the project clock, inclusive. Must be less than to."
10325
+ },
10326
+ {
10327
+ name: "to",
10328
+ type: "number",
10329
+ required: true,
10330
+ description: "End of the interval in seconds on the project clock, exclusive. At most 120 seconds after from, and never beyond the timeline duration; a longer passage is requested as several ranges."
10331
+ },
10332
+ {
10333
+ name: "revision",
10334
+ type: "integer",
10335
+ required: false,
10336
+ description: "Committed project revision from retrieve, state, timeline or execute; increases after each successful write."
10337
+ }
10338
+ ]
10339
+ }
10340
+ },
10284
10341
  {
10285
10342
  resource: "cut.projects",
10286
10343
  method: "retrieveState",
@@ -10422,7 +10479,159 @@ Execution errors include error.details.prints containing output printed before f
10422
10479
  resource: "cut.projects",
10423
10480
  method: "execute",
10424
10481
  summary: "Execute editing script",
10425
- description: 'Edit the current timeline atomically using synchronous JavaScript source. Read state or timeline first, then pass its revision as expected_revision to detect concurrent changes. Unlike Shotstack, execute applies script edits to a persistent project in one transaction. Provide script or a saved edit_id with literal edits, never both; failures roll back writes. A revision conflict while preparing the response may follow a committed edit: retrieve state before retrying. Minimal script after creating a project: `const t = AddTrack("video"); Insert(t, {type: "color", color: "#123456", start: 0, length: 3}); Print(t);`\n\n### Script function reference\n\nFunctions are synchronous globals; do not import them. `project` is the current project ID. TrackId and ClipId are strings returned by AddTrack and Insert or read from GetTimeline. JoinId is the string returned by Join or read from GetTimeline().joins. Reads see earlier writes in the same script.\n\n```ts\nGetTimeline(o?: { from?: number; to?: number; tracks?: TrackId[] }): TimelineView;\nGetItem(id: ClipId): ItemView;\nFindItems<T>(visit: (item: ItemView, ctx: { track: TrackView; index: number }) => T | undefined): T[];\nGetMedia(ref: MediaRef): MediaInfo;\nGetTranscript(ref: MediaRef, o?: { from?: number; to?: number }): Word[];\nGetAnalysis(ref: MediaRef, kind: AnalysisKind): Segment[];\nListTransitions(): TransitionInfo[];\nListEffects(): EffectInfo[];\nListTextStyles(): TextStylePreset[];\nListTextTemplates(): TextTemplate[];\nListAnimations(): { id: string; version: number; phase: "in" | "out" | "loop"; target: "any" | "text"; name: string; description: string; defaultDuration: number; params: { name: string; type: string; values?: string[]; default?: string | number; min?: number; max?: number; description: string }[] }[];\nListFonts(): { family: string; weights: number[]; scripts: ("latin"|"cjk")[]; source: "bundled"|"catalog" }[];\nInsert(track: TrackId, item: ItemInit, o?: { ripple?: boolean }): ClipId;\nUpdate(id: ClipId, patch: ItemPatchView): void;\nSetSpeed(id: ClipId, rate: number | { curve: { at: number; rate: number; ease?: Ease }[]; audio?: "mute" | "resample" }, o: { keep: "source" | "duration"; ripple?: boolean }): { length: number; sourceOut: number };\nDelete(id: ClipId, o?: { ripple?: boolean }): void;\nJoin(left: ClipId, right: ClipId, o: { length?: number; effect: TransitionInput }): JoinId;\nUpdateJoin(id: JoinId, patch: { length?: number; effect?: TransitionInput }): void;\nDeleteJoin(id: JoinId): void;\nSplit(id: ClipId, at: number): ClipId;\nTrim(id: ClipId, edge: "in" | "out", delta: number, o?: { ripple?: boolean }): void;\nMove(id: ClipId, start: number, track?: TrackId): void;\nRippleDeleteRange(from: number, to: number, tracks?: TrackId[]): void;\nAddTrack(kind: "video" | "audio" | "caption", init?: { name?: string; role?: "voice" | "music" | "sfx" }, index?: number): TrackId;\nUpdateTrack(id: TrackId, patch: TrackPatch): void;\nDeleteTrack(id: TrackId): void;\nSetSettings(patch: Partial<ProjectSettingsView>): void;\nAddCaptionsFromTranscript(track: TrackId, source: ClipId, o?: { style?: Partial<CaptionStyle> & { preset?: string }; maxChars?: number }): ClipId[];\nInsertTemplate(track: TrackId, o: { template: string; start: number; slots?: Record<string, string> }): ClipId[];\nAlignCaptions(trackId: TrackId, script: string, options?: { resplit?: boolean; maxChars?: number }): { replaced: number; added: number; deleted: number };\nImportCaptions(trackId: TrackId, text: string, o?: { format?: "srt" | "vtt"; offset?: number }): ClipId[];\nExportCaptions(trackId: TrackId, o: { format: "srt" | "vtt" }): string;\nSetMarker(at: number, label: string): string;\nPrint(...values: unknown[]): void;\nPreview(at: number[]): void;\n```\n\n| Functions | Behavior and arguments |\n| --- | --- |\n| GetTimeline, GetItem | Read compact item views: id, track, type, start, end, length, optional media, playback, sourceIn/sourceOut, text, effects, blend and offline reason. GetTimeline returns duration, tracks (id, kind, name, index, locked, items), and joins (id, track, left, right, length in seconds, normalized effect). from/to and tracks narrow the items and joins; joins are selected by their overlap window. |\n| ListEffects | Discover the shared visual-effect catalog with parameter types, ranges, defaults, cost and bounds. Effects are supported only on visual clips. |\n| ListTransitions | Discover the shared validation catalog: each entry contains kind (effect ID), name, description and params. Each parameter has name, type (enum/number/integer), default, description, enum values or numeric min/max. Use the returned kind and parameter names inside effect. |\n| ListAnimations | Discover animation presets. Each entry has id, version, phase (`in`, `out`, `loop`), target (`any`, `text`), name, description, defaultDuration (seconds), and params (name, type, values/default/min/max/description as applicable). A slot use is `{preset, duration?, ...params}`; duration is seconds. |\n| FindItems | Visit items with their track and index; return undefined to omit an item, any other value to collect it. |\n| GetMedia | Read metadata for `{libraryId, assetId}` in a bound library: kind, dimensions, fps, hasAudio and durationUs when available. durationUs is microseconds. |\n| GetTranscript, GetAnalysis | Read available transcript words or silence/filler/scenes segments. Transcript filter from/to is seconds; returned word and segment from/to values are source microseconds (divide by 1,000,000 for editing). Words contain text and optional speaker/filler; segments may include label/confidence. Request analysis first if unavailable. |\n| Insert, Update, Delete | Insert returns the new clip ID; Update changes supplied fields; Delete removes the clip. Optional ripple on Insert/Delete closes or opens space on the track. |\n| SetSpeed | Change video/audio rate in 0.25–4; keep is required. A `{curve: [{at, rate, ease?}, ...], audio?: "mute" | "resample"}` rate is forward-only and holds output duration fixed; pitch preservation is unavailable. Scalar rates: source preserves consumed source and changes length; duration preserves output length. Returns actual length and sourceOut in seconds. Optional ripple explicitly shifts same-track followers when keeping source; otherwise overlaps are rejected. |\n| Join, UpdateJoin, DeleteJoin | Join creates an overlap between two butt-adjacent visual clips on the same track and returns its ID. length defaults to 0.5 seconds; effect is required. The right clip and all same-track followers move left by length, shortening that track and potentially the project. UpdateJoin moves those followers by the difference in length; omitted fields are preserved. DeleteJoin moves them right to restore the butt cut. Other tracks stay in place. |\n| Split, Trim, Move | Split at a timeline position and return the new right-hand clip ID. Trim changes the in or out edge by delta seconds. Move sets the timeline start and optionally a new track. |\n| RippleDeleteRange | Delete a timeline interval and close its gap on the specified tracks, or all unlocked tracks when omitted. |\n| AddTrack, UpdateTrack, DeleteTrack | Add video/audio/caption tracks; index selects layer order (0 is top). TrackPatch supports name, locked, hidden, muted, gainDb, audio role (`voice`, `music`, `sfx`) and style as appropriate to track kind. |\n| SetSettings | Supply any of width/height (pixels), fps (frames per second), background (color). |\n| AddCaptionsFromTranscript | Create captions from an audio/video clip\'s kept words. Optional maxChars is 1–1000, default 16; style updates the caption track. Returns caption IDs. |\n| ImportCaptions, ExportCaptions | Import SRT or WebVTT text onto a caption track and export it back. format is inferred from a WEBVTT header when omitted. offset shifts imported cues in seconds. Import rejects more than 100000 bytes, more than 5000 cues, malformed or overlapping file cues with INVALID_CAPTION_FILE; overlap with existing timeline clips uses the normal OVERLAP rejection. Export sorts by timeline start and writes millisecond timecodes. |\n| SetMarker | Add a label at a timeline time and return its ID. |\n| Print, Preview | Print appends text to prints. Preview requests up to eight times total per execute and puts images in the result\'s frames. Each url is an inline PNG data URL, not an HTTP image link. Decode the base64 payload to save an image. Codemode returns at most four images per call; request at most four times there. |\n\n#### Joins between clips\n\nEndpoints may be video, image, text, color or shape; audio and caption are rejected. Require 0 < length < each endpoint\'s length. Each clip allows at most one incoming and one outgoing join; their summed lengths cannot exceed its length. Three-input overlaps, nonadjacent endpoints and cross-track joins are rejected with OPS_REJECTED. Read the rejection\'s code and message, shorten or remove conflicting joins, and retry the saved edit.\n\nTransitionInput is an object with kind plus the parameters returned by ListTransitions; omitted parameters use catalog defaults. Unknown kinds and invalid parameters return INVALID_TRANSITION_PARAM with available parameters. Effects: dissolve; dip color black/white default black; push and wipe direction left/right/up/down default left; wipe softness 0–1 default 0; iris centerX/centerY 0–1 default 0.5; blinds integer count 2–64 default 8 and orientation vertical/horizontal default vertical; blur radius 0–100 pixels at 1080-pixel frame height default 24; zoom direction in/out default in, amount 0.1–3 default 1, blur 0–1 default 0.5; clock direction clockwise/counterclockwise default clockwise, startAngle 0–360 degrees default 0 (twelve o\'clock), softness 0–1 default 0; flash color white/black default white, intensity 0–1 default 1. Zoom blur uses up to eight radial samples per shot and is slower on server rendering. Join options and UpdateJoin patches accept only length and effect. Effect updates replace the effect object and apply defaults for omitted parameters.\n\nMinimal example on an existing visual track with adjacent clips left and right: `Print(ListTransitions()); const j = Join(left, right, {length: 0.5, effect: {kind: "dissolve"}}); Print(GetTimeline().joins); Preview([GetItem(right).start + 0.25]);` Use `UpdateJoin(j, {length: 0.8})` to adjust it in a later edit or `DeleteJoin(j)` to restore the cut. Preview uses server-rendered frames and includes joins. Per-clip transitionIn/transitionOut remain separate entrance/exit effects.\n\n#### Insert fields (ItemInit)\n\nEvery item requires `type` and `start`. Times used for editing are seconds and snap to the project frame rate: start, length, sourceIn, fadeIn/fadeOut, transition length, keyframe at, reveal delay/stagger/duration. Keyframe and reveal times are relative to the clip start. Video/audio may omit length to use the remaining source duration; other types require length.\n\n| type | Required fields beyond type/start | Optional fields |\n| --- | --- | --- |\n| video | media | length, sourceIn, playback, volumeDb, transform, fit, blend, animate, animation, effects, mask, transitionIn, transitionOut |\n| image | media, length | transform, fit, blend, animate, animation, effects, mask, transitionIn, transitionOut |\n| text | text, length | style, transform, blend, reveal, animate, animation, effects, mask, transitionIn, transitionOut |\n| color | color, length | transform, fill, blend, animate, animation, effects, mask, transitionIn, transitionOut |\n| shape | shape, length, width, height, fill | radius, stroke, transform, blend, animate, animation, effects, mask, transitionIn, transitionOut |\n| audio | media | length, sourceIn, playback, volumeDb, gain, fadeIn, fadeOut, duck |\n| caption | text, length | — |\n\nVisual Insert/Update also accepts `blend`: `normal` (default), `screen`, `multiply`, `overlay`, or `add`; set it to null in Update to clear it. During a Join overlap, both inputs render with normal blending. Video tracks accept video/image/text/color/shape; audio and caption tracks accept their corresponding type. Media is `{libraryId: string, assetId: string}` from a bound library. sourceIn defaults to 0, volumeDb to 0 dB, audio fades to 0 seconds. fit defaults to contain: contain fits the whole image, cover fills and crops, fill stretches, none keeps native dimensions.\n\n| Field | Value |\n| --- | --- |\n| transform | Partial `{x, y, scale, rotation, opacity, crop, blur}`. x/y are normalized canvas center coordinates (default 0.5); scale 1 is fitted size; rotation is degrees (default 0); opacity is 0–1 (default 1). crop is `{top,right,bottom,left}`. blur is 0–100 pixels at 1080-pixel frame height. |\n| style | Partial `{fontFamily, fontSize, fontWeight, color, fill, stroke, strokes, shadows, glow, background, align, maxWidth, position, margin}`. fill accepts a color or linear/radial gradient across the entire text bounding box. strokes draw outside to inside; at most 4, width 0–40. shadows accepts at most 4 `{color,x,y,blur}` entries; blur is 0–100. glow is `{color,radius,strength}` with radius 0–100 and strength 0–1. All dimensions use pixels at 1080 frame height and scale with the text. Glow and large shadow blur increase render time. Invalid colors or ranges return actionable INVALID_STYLE errors. `ListFonts()` discovers family, available weights, scripts and bundled/catalog source. Text and captions share the style fields; caption style additionally supports highlightColor and maxLines: 2. |\n| animate | An object keyed by x, y, scale, rotation, opacity or blur. Each value is an array of `{at: number, value: number, ease?: Ease}` sorted by at with distinct frame-snapped times. Values hold before the first and after the last keyframe, overriding the static transform. |\n| animation | `{in?: AnimationUse, out?: AnimationUse, loop?: AnimationUse}` on visual clips. Each use is `{preset: string, duration?: number, ...params}`; duration and parameter units follow `ListAnimations()`. Presets replace existing animate and reveal when applied. Update accepts `animation: null` to clear the preset and its generated effects. |\n| Ease | linear, in, out, inOut, `{bezier: [x1,y1,x2,y2]}` or `{spring: {stiffness, damping, mass?}}`. Easing shapes the segment arriving at that keyframe; springs may overshoot. |\n| reveal | `{by, delay?: number, stagger: number, duration: number, from: {y?, opacity?, scale?, blur?}, ease?: Ease}`. by selects char, word or line. Unit k starts at delay + k * stagger and takes duration seconds to reach its resting state; from.y is a fraction of font size. |\n| fill | A color string (#RRGGBB or #RRGGBBAA), `{linear: {angle, stops: [{at,color}, ...]}}` or `{radial: {stops: [{at,color}, ...]}}`. Stop positions are 0–1; angle is degrees, 0 left to right. On color clips, fill replaces color when supplied. |\n| shape, width, height, radius, stroke | shape is rect or ellipse. width/height are fractions of canvas width/height before scaling. radius rounds rect corners in pixels at 1080-pixel frame height. stroke is `{color: string, width: number}`. |\n| transitionIn, transitionOut | `{kind, length: number}` at the clip\'s beginning/end. length is seconds. fade changes opacity; dissolve blends; push_left/push_right move horizontally; wipe_left reveals horizontally. |\n\n#### Visual effects\n\n`effects` is an ordered stack of at most 8 catalog entries. Call `ListEffects()` to discover the catalog; unknown kinds return `UNKNOWN_EFFECT`, invalid names/values/keyframes return `INVALID_EFFECT_PARAM`, and stacks over 8 return `TOO_MANY_EFFECTS`. Entries include blur, color adjustment, vignette, film grain, chromatic aberration, pixelate, glitch, shake, flash, light leak and built-in `lut` looks; user `.cube` LUTs are not supported. `speed` is cycles per second. Effects run on CPU during export and increase render time. Parameters are discovered with ListEffects(). Catalog entries expose their own parameters through ListEffects(), including `blur` (`radius` 0–100, default 24) and `color_adjust`: `brightness`, `contrast`, `temperature`, and `tint` each range -1–1 (default 0), while `saturation` ranges 0–2 (default 1). Disabled entries are skipped. `color_adjust` uses an SDR-only Rec.709 adjustment matrix with no color management.\n\nNumeric and integer effect parameters accept `keyframes: {parameter: [{at, value, ease?}, ...]}`; times are seconds relative to the clip, snap to frames like `animate`, must be strictly increasing and within clip duration, and values follow that parameter\'s catalog range. Omitted parameters use catalog defaults. Trim and Split preserve effect keyframes with the same clip-local behavior as `animate`. There are no custom shaders.\n\n`blend` applies to the completed visual layer after its content, effects and `transform.blur`; `add` maps to Skia Plus. The default `normal` path adds no blend layer. During Join overlaps, blending is forced to normal because each input is composed on transparency.\n\n#### Update fields (ItemPatchView)\n\nAll fields are optional; use only fields relevant to the item\'s type. Supported fields: start, length, sourceIn, playback, volumeDb, transform, fit, text, style, color, fadeIn, fadeOut, duck, animate, reveal, animation, fill, stroke, shape, width, height, radius, transitionIn, transitionOut, effects, blend, mask, gain. Values and units match Insert; set effects or blend to null to clear them. Set animation to null to clear the preset; set animate or reveal to null to remove that effect. Applying a preset replaces existing animate/reveal. Do not set animation together with animate or reveal in one Insert/Update call. Omit a field to preserve it.\n\n#### Animation presets\n\nDiscover the catalog with `ListAnimations()`. Its entries contain id, version, phase (`in`, `out`, `loop`), target (`any` or `text`), name, description, defaultDuration in seconds, and params. Slots may combine one in, one out and one loop preset. A loop runs only in the interval between in and out; if the same property is animated by multiple slots, loop occupies only that middle interval. Text-target presets are entrances. Their duration controls the rhythm per character/word/line, not the total reveal time. Out and loop presets apply to the whole clip, not per text unit.\n\nPresets replace the clip\'s existing animate and reveal when applied. The source preset is retained, so changing clip length or transform automatically regenerates its keyframes/reveal. If a clip becomes shorter, in/out durations shrink proportionally; when it grows, the requested durations are restored. Split keeps in on the left, out on the right, and loop on both. Writing animate or reveal directly detaches the preset; setting animation to null clears both source and generated effects. Insert/Update reject a call that supplies animation together with animate or reveal.\n\nErrors: UNKNOWN_ANIMATION (unknown preset), INVALID_ANIMATION_PARAM (invalid slot/parameter or frame/keyframe limit), ANIMATION_TOO_LONG (in+out exceed clip length), ANIMATION_TARGET_MISMATCH (text-only preset on a non-text or preset on non-visual clip), ANIMATION_PHASE_MISMATCH (preset in the wrong slot). Each animated property is limited to 600 keyframes; loop duration must be at least 4 frames. `ANIMATION_TOO_LONG` is avoided during later length changes by proportional fitting.\n\n#### Speed, reverse and freeze\n\nVideo/audio Insert and Update accept playback as `{kind: "rate", rate: number, direction: "forward" | "reverse", audio: "preservePitch" | "resample" | "mute"}` or `{kind: "freeze"}`. Rate is finite and inclusive 0.25–4. Omitted playback defaults to 1× forward with preservePitch; supply the complete rate object when changing playback. preservePitch keeps pitch, resample changes pitch with speed, mute removes audio. Reverse requires explicit audio: "mute"; preservePitch/resample are rejected with UNSUPPORTED_PLAYBACK rather than silently muted. Freeze holds sourceIn and is silent. GetItem/GetTimeline echo playback and the source interval in seconds; sourceOut is exclusive even for reverse and equals sourceIn for freeze.\n\nUpdate of playback keeps output length unless length is also supplied. SetSpeed preserves direction/audio, rejects frozen and non-video/audio clips, and requires keep: "source" or "duration". keep: "source" computes round(consumed source / new rate × fps) frames, falling back to floor if rounding would exceed the source end; the returned length/sourceOut are actual frame-rounded seconds. keep: "duration" keeps output length and changes source consumption. Length conflicts fail with OVERLAP; move/shorten the conflicting clip, keep duration, or explicitly use ripple: true to shift following clips on the same track. Source overflow fails with OUT_OF_SOURCE; rate limits fail with RATE_OUT_OF_RANGE. Unknown playback fields and SetSpeed options are rejected with UNKNOWN_FIELD; options only accept keep and boolean ripple.\n\nExample for an existing four-second video/audio clip id: `Print(SetSpeed(id, 0.5, {keep: "source"})); Print(SetSpeed(id, 2, {keep: "source"}));` returns lengths 8 then 2, keeping the same source interval. Reverse: `Update(id, {playback: {kind: "rate", rate: 1, direction: "reverse", audio: "mute"}})`. Freeze: `Update(id, {playback: {kind: "freeze"}})`. Ensure enough source remains for the chosen length/rate. Browser reverse playback currently displays a placeholder; server-rendered Preview/frames and exports support reverse normally. Speed-adjusted audio is generated asynchronously after the edit transaction commits; exports wait for that audio before rendering.\n\n#### Script names versus HTTP response names\n\nUse camelCase inside scripts, including nested objects. HTTP request/response JSON outside script source uses snake_case. Map media.library_id → media.libraryId, media.asset_id → media.assetId, source_in → sourceIn, volume_db → volumeDb, fade_in/fade_out → fadeIn/fadeOut, transition_in/transition_out → transitionIn/transitionOut, font_family/font_size/font_weight/max_width → fontFamily/fontSize/fontWeight/maxWidth, gain_db → gainDb, highlight_color/max_lines → highlightColor/maxLines. Fields such as animate, reveal, fill, stroke, at and length retain their spelling. GetTimeline/GetItem already return camelCase compact views; the expanded retrieveTimeline HTTP response is not an Insert object.\n\nUnrecognized script fields fail with OPS_REJECTED and rejection code UNKNOWN_FIELD; snake_case mistakes suggest the corresponding camelCase name. The error message lists each rejection\'s #opIndex, code and reason. Correct the named fields and retry the saved edit; do not assume an ignored field applied an effect.\n',
10482
+ description: `Edit the current timeline atomically using synchronous JavaScript source. Read state or timeline first, then pass its revision as expected_revision to detect concurrent changes. Unlike Shotstack, execute applies script edits to a persistent project in one transaction. Provide script or a saved edit_id with literal edits, never both; failures roll back writes. A revision conflict while preparing the response may follow a committed edit: retrieve state before retrying. Minimal script after creating a project: \`const t = AddTrack("video"); Insert(t, {type: "color", color: "#123456", start: 0, length: 3}); Print(t);\`
10483
+
10484
+ <!-- cut-reference:start -->
10485
+ ### Script function, field and error reference
10486
+
10487
+ Every script function, clip field and error code has its own section, read one at a time:
10488
+
10489
+ \`\`\`
10490
+ codemode.describe("praxis.cut.script.<Name>") // one function: signature, arguments, return, errors, example
10491
+ codemode.describe("praxis.cut.fields.<name>") // one field: type, unit, range, default, where writable
10492
+ codemode.describe("praxis.cut.errors.<CODE>") // one code: meaning, causes, fix
10493
+ codemode.describe("praxis.cut.script") // names, one page at a time
10494
+ \`\`\`
10495
+
10496
+ Published at https://docs.deepraxis.com/docs/developers/cut/script-reference with one anchor per entry. Names below omit the \`praxis.cut.<kind>.\` prefix.
10497
+
10498
+ #### Script functions (script)
10499
+
10500
+ - \`GetTimeline\` — Duration, tracks, joins; clips are under \`items\`.
10501
+ - \`GetItem\` — One clip's compact view, by id.
10502
+ - \`FindItems\` — Visit every clip with its track; collect results.
10503
+ - \`GetMedia\` — Media metadata; \`durationUs\` is microseconds.
10504
+ - \`GetTranscript\` — Transcript words in source microseconds.
10505
+ - \`GetAnalysis\` — Silence, filler or scene segments.
10506
+ - \`ListTransitions\` — Join transition kinds and parameters.
10507
+ - \`ListEffects\` — Visual-effect catalog and parameters.
10508
+ - \`ListAnimations\` — Animation presets by phase and target.
10509
+ - \`ListFonts\` — Font families, weights and scripts.
10510
+ - \`ListTextStyles\` — Text style presets for \`style.preset\`.
10511
+ - \`ListTextTemplates\` — Multi-layer templates and their slots.
10512
+ - \`Insert\` — Add a clip; a track never overlaps itself.
10513
+ - \`Append\` — Add a clip at the end of a track.
10514
+ - \`Update\` — Change named fields; the rest stay.
10515
+ - \`SetSpeed\` — Change rate, keeping source or duration.
10516
+ - \`Delete\` — Remove a clip. There is no \`Remove\`.
10517
+ - \`Join\` — Overlap clips; followers shift, track shortens.
10518
+ - \`UpdateJoin\` — Change a join's length or effect.
10519
+ - \`DeleteJoin\` — Remove a join; restore the butt cut.
10520
+ - \`Split\` — Cut a clip in two at a time.
10521
+ - \`Trim\` — Move one clip edge by seconds.
10522
+ - \`Move\` — Set a clip's start or track.
10523
+ - \`RippleDeleteRange\` — Cut a time range and close the gap.
10524
+ - \`AddTrack\` — Add a video, audio or caption track.
10525
+ - \`UpdateTrack\` — Change a track's name, lock, gain or role.
10526
+ - \`DeleteTrack\` — Remove a track and its clips.
10527
+ - \`SetSettings\` — Change canvas, frame rate or background.
10528
+ - \`AddCaptionsFromTranscript\` — Captions from a clip's kept words.
10529
+ - \`InsertTemplate\` — Insert a template and fill its slots.
10530
+ - \`AlignCaptions\` — Rebuild captions from text punctuation.
10531
+ - \`ImportCaptions\` — Import SRT or WebVTT onto captions.
10532
+ - \`ExportCaptions\` — Export captions as SRT or WebVTT.
10533
+ - \`SetMarker\` — Label a timeline position.
10534
+ - \`Print\` — Append values to the result's \`prints\`.
10535
+ - \`Preview\` — Up to 8 frames as inline PNG data URLs.
10536
+
10537
+ #### Fields (fields)
10538
+
10539
+ - \`type\` — Clip kind; decides which fields apply.
10540
+ - \`start\` — Clip start in seconds; snaps to frames.
10541
+ - \`length\` — Duration; optional for video and audio.
10542
+ - \`media\` — Source \`{ libraryId, assetId }\`.
10543
+ - \`sourceIn\` — First source second kept; default 0.
10544
+ - \`sourceOut\` — Exclusive source end; read-only.
10545
+ - \`text\` — Text of a text or caption clip.
10546
+ - \`color\` — Solid colour of a color clip.
10547
+ - \`shape\` — Shape clip kind: \`rect\` or \`ellipse\`.
10548
+ - \`width\` — Shape width, a fraction of canvas width.
10549
+ - \`height\` — Shape height, a fraction of canvas height.
10550
+ - \`radius\` — Rect corner rounding, in 1080-height px.
10551
+ - \`fill\` — Shape or text paint: colour or gradient.
10552
+ - \`stroke\` — Shape outline: colour and width.
10553
+ - \`transform\` — Position, scale, rotation, opacity, crop, blur.
10554
+ - \`fit\` — contain, cover, fill or none.
10555
+ - \`blend\` — Layer blend mode; null clears.
10556
+ - \`style\` — Text styling: font, fill, strokes, glow, position.
10557
+ - \`style.position\` — top, middle or bottom; omit it, never null.
10558
+ - \`playback\` — Rate, direction, audio policy, or freeze.
10559
+ - \`volumeDb\` — Audio level in dB; 0 is source level.
10560
+ - \`gain\` — Keyframed audio level in dB.
10561
+ - \`fadeIn\` — Fade-in seconds at the clip's start.
10562
+ - \`fadeOut\` — Fade-out seconds at the clip's end.
10563
+ - \`duck\` — Lower this clip while another track plays.
10564
+ - \`animate\` — Transform keyframes; \`at\` is clip-relative seconds.
10565
+ - \`reveal\` — Per-character, word or line reveal timing.
10566
+ - \`animation\` — Preset slots \`{ in, out, loop }\`; null clears.
10567
+ - \`effects\` — Effect stack, at most 8; null clears.
10568
+ - \`transitionIn\` — Entrance effect: kind plus seconds.
10569
+ - \`transitionOut\` — Exit effect: kind plus seconds.
10570
+ - \`mask\` — Shape, path or track matte.
10571
+ - \`words\` — Caption words with clip-local times.
10572
+
10573
+ #### Error codes (errors)
10574
+
10575
+ - \`JOIN_CONFLICT\` — A join is invalid or blocks this edit.
10576
+ - \`INVALID_TRANSITION\` — Bad transition kind, parameter or length.
10577
+ - \`INVALID_STYLE\` — A style value is out of range.
10578
+ - \`INVALID_MASK\` — A mask definition is malformed.
10579
+ - \`MASK_IN_USE\` — The edit would break a live mask.
10580
+ - \`TOO_MANY_MASKS\` — At most 16 masks per project.
10581
+ - \`RATE_OUT_OF_RANGE\` — A rate is outside 0.25-4.
10582
+ - \`UNSUPPORTED_PLAYBACK\` — Reverse without an explicit mute.
10583
+ - \`INVALID_PLAYBACK\` — A playback object is partial or malformed.
10584
+ - \`UNKNOWN_FONT\` — The family is not in \`ListFonts()\`.
10585
+ - \`UNKNOWN_FIELD\` — The field name is not accepted here.
10586
+ - \`UNKNOWN_TEXT_STYLE\` — \`style.preset\` is not in the catalog.
10587
+ - \`TEXT_STYLE_TARGET_MISMATCH\` — Preset on the wrong clip type.
10588
+ - \`CAPTION_ALIGN_LOW_CONFIDENCE\` — Alignment confidence too low; nothing changed.
10589
+ - \`OVERLAP\` — Two clips on one track would share time.
10590
+ - \`OUT_OF_SOURCE\` — The clip would read past its source.
10591
+ - \`LOCKED_TRACK\` — The edit targets a locked track.
10592
+ - \`UNBOUND_LIBRARY\` — The library is not bound to the project.
10593
+ - \`TRACK_KIND_MISMATCH\` — The clip type does not fit the track.
10594
+ - \`NOT_FOUND\` — The named id is not in this project.
10595
+ - \`TOO_SHORT\` — The result would be under one frame.
10596
+ - \`INVALID_DUCK\` — Bad \`duck\` level or a missing track.
10597
+ - \`UNKNOWN_ANIMATION\` — The preset is not in \`ListAnimations()\`.
10598
+ - \`INVALID_ANIMATION_PARAM\` — Bad slot, parameter or keyframe limit.
10599
+ - \`ANIMATION_TOO_LONG\` — In plus out exceed the clip length.
10600
+ - \`ANIMATION_TARGET_MISMATCH\` — The preset does not match the clip type.
10601
+ - \`ANIMATION_PHASE_MISMATCH\` — The preset is in the wrong slot.
10602
+ - \`UNKNOWN_EFFECT\` — The effect is not in \`ListEffects()\`.
10603
+ - \`INVALID_EFFECT_PARAM\` — Bad effect parameter or keyframe.
10604
+ - \`TOO_MANY_EFFECTS\` — More than 8 effects on one clip.
10605
+ - \`PROJECT_NOT_FOUND\` — No visible project has this id.
10606
+ - \`EXPORT_NOT_FOUND\` — No such export in this project.
10607
+ - \`DRAFT_RENDER_NOT_FOUND\` — No such draft render.
10608
+ - \`VERSION_NOT_FOUND\` — No saved version has this revision.
10609
+ - \`LIBRARY_NOT_FOUND\` — The library is missing or invisible.
10610
+ - \`BINDING_INVALID\` — The binding request is malformed.
10611
+ - \`BINDING_IN_USE\` — Clips still use this library's assets.
10612
+ - \`NOTHING_TO_UNDO\` — No earlier revision to return to.
10613
+ - \`NOTHING_TO_REDO\` — No undone revision is waiting.
10614
+ - \`UNDO_CONFLICT\` — The revision to undo is no longer head.
10615
+ - \`REVISION_CONFLICT\` — The project moved; your revision is stale.
10616
+ - \`CUT_BUSY\` — The project is busy; retry.
10617
+ - \`INVALID_CAPTION_FILE\` — The subtitle file is malformed or too big.
10618
+ - \`SCRIPT_ERROR\` — The script threw or did not parse.
10619
+ - \`SCRIPT_LIMIT\` — An execute budget was exceeded.
10620
+ - \`OPS_REJECTED\` — An op failed; the whole edit rolled back.
10621
+ - \`EDIT_EXPIRED\` — The saved edit id is over ten minutes old.
10622
+ - \`MEDIA_OFFLINE\` — The asset cannot be fetched right now.
10623
+ - \`MEDIA_UNAVAILABLE\` — The asset is not usable for rendering.
10624
+ - \`MEDIA_IMPORT_FAILED\` — Importing media failed.
10625
+ - \`FRAME_OUT_OF_RANGE\` — The preview time is outside the project.
10626
+ - \`PROJECT_TOO_LARGE\` — The project exceeds the size limit.
10627
+ - \`RESPONSE_TOO_LARGE\` — The response would exceed its budget.
10628
+ - \`EXPORT_FAILED\` — The render failed; read \`error.cause\`.
10629
+ - \`INVALID_PARAMS\` — The request is malformed.
10630
+ - \`PERMISSION_DENIED\` — This credential may not do that here.
10631
+ - \`NOT_IMPLEMENTED\` — Not available on this platform yet.
10632
+ - \`INTERNAL\` — Unexpected failure; retry with the request id.
10633
+ <!-- cut-reference:end -->
10634
+ `,
10426
10635
  http: "POST",
10427
10636
  path: "/cut/v1/projects/{project_id}:execute",
10428
10637
  streaming: "no",
@@ -10484,6 +10693,24 @@ Execution errors include error.details.prints containing output printed before f
10484
10693
  ],
10485
10694
  query: []
10486
10695
  },
10696
+ {
10697
+ resource: "cut.renders",
10698
+ method: "retrieve",
10699
+ summary: "Retrieve draft range render",
10700
+ description: "Poll a draft render id returned by projects.renders.create to see whether the interval is ready, then read url while it lasts. queued and rendering are in progress; done provides file_id and a short-lived url for the rendered .m4a or .mp4; failed provides error. Only done yields a url, and the file behind it disappears 24 hours after it was stored, so retrieve again when the link has expired.",
10701
+ http: "GET",
10702
+ path: "/cut/v1/renders/{render_id}",
10703
+ streaming: "no",
10704
+ pagination: false,
10705
+ pathParams: [
10706
+ {
10707
+ name: "render_id",
10708
+ sdkName: "render_id",
10709
+ description: "Draft render id (cutr_…) returned by projects.renders.create."
10710
+ }
10711
+ ],
10712
+ query: []
10713
+ },
10487
10714
  {
10488
10715
  resource: "cut.versions",
10489
10716
  method: "restore",
@@ -11456,6 +11683,696 @@ The default is return=minimal: success returns HTTP 201 with an empty body. Send
11456
11683
  ]
11457
11684
  }
11458
11685
  },
11686
+ {
11687
+ resource: "devops.projects.testCases",
11688
+ method: "list",
11689
+ summary: "List test cases",
11690
+ description: "List a project's cases with their health, state and recent statistics, so you can decide which ones a plan must run and which are quarantined. This is the read a test dashboard is built on; filter it to narrow by state or health instead of paging through everything. A case's id is a fingerprint of its own title and path, so it survives a rename — read aliases when reconciling history recorded under an older title.",
11691
+ http: "GET",
11692
+ path: "/devops/v1/projects/{project}/test-cases",
11693
+ streaming: "no",
11694
+ pagination: false,
11695
+ pathParams: [
11696
+ {
11697
+ name: "project",
11698
+ sdkName: "project",
11699
+ description: "Identifies the project whose data you are reading, from the project list or create answer."
11700
+ }
11701
+ ],
11702
+ query: [
11703
+ {
11704
+ name: "pageSize",
11705
+ type: "integer",
11706
+ required: false,
11707
+ description: "How many items this page returns, 1 to 100; omitted uses 50. A larger value is capped at 100 rather than refused, and 0 falls back to the default, so a paging loop never fails on a size alone."
11708
+ },
11709
+ {
11710
+ name: "pageToken",
11711
+ type: "string",
11712
+ required: false,
11713
+ description: "The cursor from the previous page's nextPageToken. Treat it as opaque and never build one yourself; omit it for the first page."
11714
+ },
11715
+ {
11716
+ name: "filter",
11717
+ type: "string",
11718
+ required: false,
11719
+ description: "AIP-160 equality filter over one declared field at a time, for example state=quarantined or health=broken. Fields a case list does not declare are refused with INVALID_ARGUMENT rather than ignored, so a typo never silently widens the result."
11720
+ },
11721
+ {
11722
+ name: "orderBy",
11723
+ type: "string",
11724
+ required: false,
11725
+ description: "Comma-separated fields to order by, each optionally suffixed with desc, for example createTime desc. Only the fields the resource declares are accepted; anything else is refused so an ordering typo cannot silently return a different order. Omitted uses the resource's own order."
11726
+ }
11727
+ ]
11728
+ },
11729
+ {
11730
+ resource: "devops.projects",
11731
+ method: "retrieveTestCatalog",
11732
+ summary: "Read a commit's test catalog",
11733
+ description: 'Read the catalog version discovered at one commit — how many suites and cases it holds, which frameworks they come from, and how the commit changed them. Call this first: it tells you which suites, cases and sizes exist before you list them or select them into a plan, and the reported diff explains why a case count moved. A commit whose discovery has not finished answers CATALOG_NOT_READY, which means "not yet", not "no tests"; wait and read again. Omit commit to read the newest catalog published for the project.',
11734
+ http: "GET",
11735
+ path: "/devops/v1/projects/{project}/test-catalog",
11736
+ streaming: "no",
11737
+ pagination: false,
11738
+ pathParams: [
11739
+ {
11740
+ name: "project",
11741
+ sdkName: "project",
11742
+ description: "Identifies the project whose data you are reading, from the project list or create answer."
11743
+ }
11744
+ ],
11745
+ query: [
11746
+ {
11747
+ name: "commit",
11748
+ type: "string",
11749
+ required: false,
11750
+ description: "Full 40-character commit sha whose catalog you want, from a project branch or commit read. Omit it to read the newest catalog published for the project."
11751
+ }
11752
+ ]
11753
+ },
11754
+ {
11755
+ resource: "devops.projects.testPlans",
11756
+ method: "list",
11757
+ summary: "List test plans",
11758
+ description: "List the project's plans — what each one selects, which stage and gate it belongs to, and when it runs next. Read this before creating a plan, so a new plan extends what exists instead of duplicating a selector an existing plan already covers.",
11759
+ http: "GET",
11760
+ path: "/devops/v1/projects/{project}/test-plans",
11761
+ streaming: "no",
11762
+ pagination: false,
11763
+ pathParams: [
11764
+ {
11765
+ name: "project",
11766
+ sdkName: "project",
11767
+ description: "Identifies the project whose data you are reading, from the project list or create answer."
11768
+ }
11769
+ ],
11770
+ query: [
11771
+ {
11772
+ name: "pageSize",
11773
+ type: "integer",
11774
+ required: false,
11775
+ description: "How many items this page returns, 1 to 100; omitted uses 50. A larger value is capped at 100 rather than refused, and 0 falls back to the default, so a paging loop never fails on a size alone."
11776
+ },
11777
+ {
11778
+ name: "pageToken",
11779
+ type: "string",
11780
+ required: false,
11781
+ description: "The cursor from the previous page's nextPageToken. Treat it as opaque and never build one yourself; omit it for the first page."
11782
+ },
11783
+ {
11784
+ name: "orderBy",
11785
+ type: "string",
11786
+ required: false,
11787
+ description: "Comma-separated fields to order by, each optionally suffixed with desc, for example createTime desc. Only the fields the resource declares are accepted; anything else is refused so an ordering typo cannot silently return a different order. Omitted uses the resource's own order."
11788
+ }
11789
+ ]
11790
+ },
11791
+ {
11792
+ resource: "devops.projects.testPlans",
11793
+ method: "create",
11794
+ summary: "Create a test plan",
11795
+ description: "Create a plan that decides which cases a stage must run. The plan's key is unique inside the project and is what a later run names; the selector chooses cases by size, purpose, tag, package or explicit ids, and the trigger says when the plan fires by itself. A merge or promotion gate must name the environment it guards, and a plan with a gate but no environment is refused with PLAN_GATE_ENVIRONMENT_MISMATCH rather than created and silently ignored. A plan has no revision history: update it with a patch.",
11796
+ http: "POST",
11797
+ path: "/devops/v1/projects/{project}/test-plans",
11798
+ streaming: "no",
11799
+ pagination: false,
11800
+ pathParams: [
11801
+ {
11802
+ name: "project",
11803
+ sdkName: "project",
11804
+ description: "Identifies the project whose data you are reading, from the project list or create answer."
11805
+ }
11806
+ ],
11807
+ query: [],
11808
+ body: {
11809
+ required: true,
11810
+ fields: [
11811
+ {
11812
+ name: "key",
11813
+ type: "string",
11814
+ required: true,
11815
+ description: "Short name for the plan, unique inside the project; a key already in use is refused rather than silently reused."
11816
+ },
11817
+ {
11818
+ name: "title",
11819
+ type: "string",
11820
+ required: true,
11821
+ description: "Display title of the plan, shown wherever the plan is listed."
11822
+ },
11823
+ {
11824
+ name: "stage",
11825
+ type: "string",
11826
+ enum: [
11827
+ "dev",
11828
+ "presubmit",
11829
+ "postsubmit",
11830
+ "nightly",
11831
+ "production"
11832
+ ],
11833
+ required: true,
11834
+ description: "Which stage of delivery this plan belongs to, which decides when it is expected to run."
11835
+ },
11836
+ {
11837
+ name: "trigger",
11838
+ type: "object",
11839
+ required: true,
11840
+ description: "What starts a run of this plan. Exactly one kind applies; the fields a kind needs are the ones it carries."
11841
+ },
11842
+ {
11843
+ name: "selector",
11844
+ type: "object",
11845
+ required: true,
11846
+ description: "Which cases a plan or run selects. Every member is optional and they combine as an intersection, so a selector with no member selects every case in the catalog."
11847
+ },
11848
+ {
11849
+ name: "environment",
11850
+ type: "string",
11851
+ required: false,
11852
+ description: "The environment this plan runs against; required by a merge or promotion gate, and refused with PLAN_GATE_ENVIRONMENT_MISMATCH when it disagrees with the gate."
11853
+ },
11854
+ {
11855
+ name: "gate",
11856
+ type: "string",
11857
+ enum: [
11858
+ "merge",
11859
+ "promotion",
11860
+ "observation",
11861
+ "none"
11862
+ ],
11863
+ required: true,
11864
+ description: "Whether this plan's result blocks a stage; a merge or promotion gate must name its environment."
11865
+ },
11866
+ {
11867
+ name: "repeat",
11868
+ type: "integer",
11869
+ required: false,
11870
+ description: "How many times each selected case runs in one run; omit for once. More than one is how a flake is told apart from a real failure."
11871
+ },
11872
+ {
11873
+ name: "timeoutMinutes",
11874
+ type: "integer",
11875
+ required: false,
11876
+ description: "How many minutes a run of this plan may take before it is timed out; omit for the service's default."
11877
+ }
11878
+ ]
11879
+ }
11880
+ },
11881
+ {
11882
+ resource: "devops.projects.testReports",
11883
+ method: "create",
11884
+ summary: "Upload an external test report",
11885
+ description: "Record the results of a run executed outside Praxis by uploading a CTRF or JUnit report. Nothing has to exist first: a first upload from CI creates the run it reports on (executor external) and catalogues the cases the report names, so there is no setup call before the first result. When the report already belongs to a run, pass ref and the upload joins it; the run's counts and verdict are recomputed from the report. Uploading the same reportId again is idempotent and counts once, so a retry after a timeout is safe — and a reported case is catalogued once, however many reports carry it. The report's bytes are kept as a file (the file field of the answer) rather than in the results database, so the original document stays retrievable.",
11886
+ http: "POST",
11887
+ path: "/devops/v1/projects/{project}/test-reports",
11888
+ streaming: "no",
11889
+ pagination: false,
11890
+ pathParams: [
11891
+ {
11892
+ name: "project",
11893
+ sdkName: "project",
11894
+ description: "Identifies the project whose data you are reading, from the project list or create answer."
11895
+ }
11896
+ ],
11897
+ query: [],
11898
+ body: {
11899
+ required: true,
11900
+ fields: [
11901
+ {
11902
+ name: "reportId",
11903
+ type: "string",
11904
+ required: true,
11905
+ description: "Your own identifier for this report. Uploading the same id again is idempotent and counts once, so a retry after a timeout is safe."
11906
+ },
11907
+ {
11908
+ name: "format",
11909
+ type: "string",
11910
+ enum: [
11911
+ "ctrf",
11912
+ "junit"
11913
+ ],
11914
+ required: true,
11915
+ description: "Which report format the document is in; it decides how the document is parsed."
11916
+ },
11917
+ {
11918
+ name: "ref",
11919
+ type: "object",
11920
+ required: true,
11921
+ description: "The exact revision a run tested. A commit is always named, because a run without one has nothing to report against."
11922
+ },
11923
+ {
11924
+ name: "report",
11925
+ type: "string",
11926
+ required: true,
11927
+ description: "The report document itself, as text — JSON for ctrf, XML for junit. Send the file's contents unchanged; a malformed document is refused with REPORT_INVALID and records nothing."
11928
+ }
11929
+ ]
11930
+ }
11931
+ },
11932
+ {
11933
+ resource: "devops.projects.testRuns",
11934
+ method: "list",
11935
+ summary: "List test runs",
11936
+ description: "List the project's runs newest first, with each run's state, result and counts. Use it to find the run id whose executions you want to read, or to see whether a commit's tests have finished. A run whose result is pending has not reached a verdict yet — read it again rather than treating it as passed. Filter by state or result to watch only the runs still in flight.",
11937
+ http: "GET",
11938
+ path: "/devops/v1/projects/{project}/test-runs",
11939
+ streaming: "no",
11940
+ pagination: false,
11941
+ pathParams: [
11942
+ {
11943
+ name: "project",
11944
+ sdkName: "project",
11945
+ description: "Identifies the project whose data you are reading, from the project list or create answer."
11946
+ }
11947
+ ],
11948
+ query: [
11949
+ {
11950
+ name: "pageSize",
11951
+ type: "integer",
11952
+ required: false,
11953
+ description: "How many items this page returns, 1 to 100; omitted uses 50. A larger value is capped at 100 rather than refused, and 0 falls back to the default, so a paging loop never fails on a size alone."
11954
+ },
11955
+ {
11956
+ name: "pageToken",
11957
+ type: "string",
11958
+ required: false,
11959
+ description: "The cursor from the previous page's nextPageToken. Treat it as opaque and never build one yourself; omit it for the first page."
11960
+ },
11961
+ {
11962
+ name: "filter",
11963
+ type: "string",
11964
+ required: false,
11965
+ description: "AIP-160 equality filter over one declared field, for example state=running or result=failed. An undeclared field is refused with INVALID_ARGUMENT; it is never ignored, so a mistyped filter cannot quietly return everything."
11966
+ },
11967
+ {
11968
+ name: "orderBy",
11969
+ type: "string",
11970
+ required: false,
11971
+ description: "Comma-separated fields to order by, each optionally suffixed with desc, for example createTime desc. Only the fields the resource declares are accepted; anything else is refused so an ordering typo cannot silently return a different order. Omitted uses the resource's own order."
11972
+ }
11973
+ ]
11974
+ },
11975
+ {
11976
+ resource: "devops.projects.testRuns",
11977
+ method: "create",
11978
+ summary: "Create a test run",
11979
+ description: "Start a run of the project's tests at one commit. Name a plan to use its selector, or pass a selector directly for this run alone; the ref says which commit to test and is required, because a run without a commit has nothing to report against. waitUntil decides how far the call waits before answering — queued, the default, returns as soon as the run exists; started waits until the run has begun, except for an external run, which is answered at once because it leaves queued only when your own CI uploads; finished waits for a verdict. The wait is bounded at about 25 seconds, and a wait that reaches that bound returns the run as it stands rather than failing — read state to see whether it finished. A retry of an earlier run is a new run: pass its commit and selector, and read the earlier run to compare.",
11980
+ http: "POST",
11981
+ path: "/devops/v1/projects/{project}/test-runs",
11982
+ streaming: "no",
11983
+ pagination: false,
11984
+ pathParams: [
11985
+ {
11986
+ name: "project",
11987
+ sdkName: "project",
11988
+ description: "Identifies the project whose data you are reading, from the project list or create answer."
11989
+ }
11990
+ ],
11991
+ query: [],
11992
+ body: {
11993
+ required: true,
11994
+ fields: [
11995
+ {
11996
+ name: "ref",
11997
+ type: "object",
11998
+ required: true,
11999
+ description: "The exact revision a run tested. A commit is always named, because a run without one has nothing to report against."
12000
+ },
12001
+ {
12002
+ name: "plan",
12003
+ type: "string",
12004
+ required: false,
12005
+ description: "Plan whose selector this run uses; omit it when passing selector instead. Naming a plan records the run against that plan, which is what a gate reads."
12006
+ },
12007
+ {
12008
+ name: "selector",
12009
+ type: "object",
12010
+ required: false,
12011
+ description: "An ad-hoc selector for this run alone, used instead of a plan's; it is not saved as a plan, so a run you want to repeat should name a plan."
12012
+ },
12013
+ {
12014
+ name: "environment",
12015
+ type: "string",
12016
+ required: false,
12017
+ description: "Environment to run against; it decides whether production-only cases become selectable. Omit it for a run that needs no environment."
12018
+ },
12019
+ {
12020
+ name: "repeat",
12021
+ type: "integer",
12022
+ required: false,
12023
+ description: "How many times each selected case runs, which is how a flake is told apart from a real failure; omit for once."
12024
+ },
12025
+ {
12026
+ name: "waitUntil",
12027
+ type: "string",
12028
+ enum: [
12029
+ "queued",
12030
+ "started",
12031
+ "finished"
12032
+ ],
12033
+ required: false,
12034
+ description: "How far the call waits before answering, bounded at about 25 seconds; omit it for queued, which returns at once. The wait reads the run's own state, so a wait that reaches the bound returns the run as it stands instead of failing — check state before assuming the request was honoured."
12035
+ },
12036
+ {
12037
+ name: "executor",
12038
+ type: "string",
12039
+ enum: [
12040
+ "cloud",
12041
+ "external"
12042
+ ],
12043
+ required: false,
12044
+ description: "Who carries the run out. cloud, the default, runs the selected cases in Praxis at the commit; external creates a run that waits for your own CI to upload a report with test-reports."
12045
+ },
12046
+ {
12047
+ name: "requestId",
12048
+ type: "string",
12049
+ required: false,
12050
+ description: "A key you choose to make creating this run idempotent: repeating the call with the same requestId returns the run it created instead of starting another, so a retry after a timeout is safe."
12051
+ }
12052
+ ]
12053
+ }
12054
+ },
12055
+ {
12056
+ resource: "devops.projects.testSuites",
12057
+ method: "list",
12058
+ summary: "List test suites",
12059
+ description: "List the suites the project's newest catalog discovered — one suite per test file and framework pair, with its size, purposes and question count. Use it to find the suite id a case belongs to, or to see which files make up an area before selecting cases from them. Suites come from the catalog, so a file added in code appears only after its commit's catalog is published. Archived suites are returned too; they carry archived true and no case is ever silently dropped from the list.",
12060
+ http: "GET",
12061
+ path: "/devops/v1/projects/{project}/test-suites",
12062
+ streaming: "no",
12063
+ pagination: false,
12064
+ pathParams: [
12065
+ {
12066
+ name: "project",
12067
+ sdkName: "project",
12068
+ description: "Identifies the project whose data you are reading, from the project list or create answer."
12069
+ }
12070
+ ],
12071
+ query: [
12072
+ {
12073
+ name: "pageSize",
12074
+ type: "integer",
12075
+ required: false,
12076
+ description: "How many items this page returns, 1 to 100; omitted uses 50. A larger value is capped at 100 rather than refused, and 0 falls back to the default, so a paging loop never fails on a size alone."
12077
+ },
12078
+ {
12079
+ name: "pageToken",
12080
+ type: "string",
12081
+ required: false,
12082
+ description: "The cursor from the previous page's nextPageToken. Treat it as opaque and never build one yourself; omit it for the first page."
12083
+ },
12084
+ {
12085
+ name: "orderBy",
12086
+ type: "string",
12087
+ required: false,
12088
+ description: "Comma-separated fields to order by, each optionally suffixed with desc, for example createTime desc. Only the fields the resource declares are accepted; anything else is refused so an ordering typo cannot silently return a different order. Omitted uses the resource's own order."
12089
+ }
12090
+ ]
12091
+ },
12092
+ {
12093
+ resource: "devops.testCases",
12094
+ method: "retrieve",
12095
+ summary: "Retrieve a test case",
12096
+ description: "Read one case in full — its steps, tags, declared owners, current state with the policy and ticket behind it, and its rolling 7 or 30 day statistics. Use it before quarantining or fixing a case, to see what the state already is and why. A case that was renamed is reachable by both its current fingerprint id and the ids listed in aliases.",
12097
+ http: "GET",
12098
+ path: "/devops/v1/test-cases/{id}",
12099
+ streaming: "no",
12100
+ pagination: false,
12101
+ pathParams: [
12102
+ {
12103
+ name: "id",
12104
+ sdkName: "id",
12105
+ description: "The case identifier returned by a case list, or an older id listed in that case's aliases."
12106
+ }
12107
+ ],
12108
+ query: []
12109
+ },
12110
+ {
12111
+ resource: "devops.testPlans",
12112
+ method: "delete",
12113
+ summary: "Delete a test plan",
12114
+ description: "Delete a plan so it schedules nothing further. The plan stops firing immediately; runs it already produced keep their own record and are not deleted with it. To stop a plan temporarily and keep it for later, pause it instead — deleting cannot be undone and the plan's key becomes free for another plan to take.",
12115
+ http: "DELETE",
12116
+ path: "/devops/v1/test-plans/{id}",
12117
+ streaming: "no",
12118
+ pagination: false,
12119
+ pathParams: [
12120
+ {
12121
+ name: "id",
12122
+ sdkName: "id",
12123
+ description: "The plan identifier returned by a plan list or create answer."
12124
+ }
12125
+ ],
12126
+ query: []
12127
+ },
12128
+ {
12129
+ resource: "devops.testPlans",
12130
+ method: "retrieve",
12131
+ summary: "Retrieve a test plan",
12132
+ description: "Read one plan by the id a plan list returned, to see its selector, gate, repeat count, timeout and pause state before updating or deleting it. A paused plan carries the reason, the actor and the time it resumes, so a pause you did not set is explained here rather than guessed at.",
12133
+ http: "GET",
12134
+ path: "/devops/v1/test-plans/{id}",
12135
+ streaming: "no",
12136
+ pagination: false,
12137
+ pathParams: [
12138
+ {
12139
+ name: "id",
12140
+ sdkName: "id",
12141
+ description: "The plan identifier returned by a plan list or create answer."
12142
+ }
12143
+ ],
12144
+ query: []
12145
+ },
12146
+ {
12147
+ resource: "devops.testPlans",
12148
+ method: "update",
12149
+ summary: "Update a test plan",
12150
+ description: "Change a plan's title, trigger, selector, gate, repeat count, timeout or enabled flag. Only the fields present in the body are changed, so a body naming one field leaves the rest exactly as they were. Changing a selector does not create a version — the plan is not a published artefact, and runs already started keep the selection they were created with. Read the plan first to know what you are leaving unchanged.",
12151
+ http: "PATCH",
12152
+ path: "/devops/v1/test-plans/{id}",
12153
+ streaming: "no",
12154
+ pagination: false,
12155
+ pathParams: [
12156
+ {
12157
+ name: "id",
12158
+ sdkName: "id",
12159
+ description: "The plan identifier returned by a plan list or create answer."
12160
+ }
12161
+ ],
12162
+ query: [],
12163
+ body: {
12164
+ required: true,
12165
+ fields: [
12166
+ {
12167
+ name: "plan",
12168
+ type: "object",
12169
+ required: true,
12170
+ description: "The fields to change. Anything absent keeps its current value, so read the plan first if you need to know what you are leaving alone."
12171
+ },
12172
+ {
12173
+ name: "updateMask",
12174
+ type: "string",
12175
+ required: false,
12176
+ description: "Comma-separated names of the plan fields this patch intends to change, for example title,enabled. Omit it to apply every field present in plan; naming fields makes the intent explicit and keeps a concurrent edit from being overwritten by accident."
12177
+ }
12178
+ ]
12179
+ }
12180
+ },
12181
+ {
12182
+ resource: "devops.testPlans",
12183
+ method: "pause",
12184
+ summary: "Pause a test plan",
12185
+ description: "Stop a plan from starting new runs while keeping it and its history. A reason is required and is recorded on the plan, so the next reader learns why it stopped. Give until to resume automatically at a time; omit it to stay paused until someone resumes it. Runs already in flight are not cancelled — cancel those individually.",
12186
+ http: "POST",
12187
+ path: "/devops/v1/test-plans/{id}:pause",
12188
+ streaming: "no",
12189
+ pagination: false,
12190
+ pathParams: [
12191
+ {
12192
+ name: "id",
12193
+ sdkName: "id",
12194
+ description: "The plan identifier returned by a plan list or create answer."
12195
+ }
12196
+ ],
12197
+ query: [],
12198
+ body: {
12199
+ required: true,
12200
+ fields: [
12201
+ {
12202
+ name: "reason",
12203
+ type: "string",
12204
+ required: true,
12205
+ description: "Why the plan is being paused; it is stored on the plan and read by whoever finds it stopped."
12206
+ },
12207
+ {
12208
+ name: "until",
12209
+ type: "string",
12210
+ required: false,
12211
+ description: "RFC 3339 UTC time the plan resumes by itself; omit it to stay paused until someone resumes it."
12212
+ }
12213
+ ]
12214
+ }
12215
+ },
12216
+ {
12217
+ resource: "devops.testPlans",
12218
+ method: "resume",
12219
+ summary: "Resume a test plan",
12220
+ description: "Clear a plan's pause so it schedules runs again. Resuming an active plan changes nothing and is safe to repeat. The plan keeps its selector, gate and key; only the pause is removed.",
12221
+ http: "POST",
12222
+ path: "/devops/v1/test-plans/{id}:resume",
12223
+ streaming: "no",
12224
+ pagination: false,
12225
+ pathParams: [
12226
+ {
12227
+ name: "id",
12228
+ sdkName: "id",
12229
+ description: "The plan identifier returned by a plan list or create answer."
12230
+ }
12231
+ ],
12232
+ query: []
12233
+ },
12234
+ {
12235
+ resource: "devops.testRuns",
12236
+ method: "retrieve",
12237
+ summary: "Retrieve a test run",
12238
+ description: "Read one run's current state, result and counts, and ask for its failed executions inline with expand. Poll this after creating a run whose result was pending. A result is monotonic once it reaches a verdict — a failed run never becomes passed by a later report, so read the run rather than the last report to know where it ended.",
12239
+ http: "GET",
12240
+ path: "/devops/v1/test-runs/{id}",
12241
+ streaming: "no",
12242
+ pagination: false,
12243
+ pathParams: [
12244
+ {
12245
+ name: "id",
12246
+ sdkName: "id",
12247
+ description: "The run identifier returned by a run list or create answer."
12248
+ }
12249
+ ],
12250
+ query: [
12251
+ {
12252
+ name: "expand",
12253
+ type: "array",
12254
+ itemType: "string",
12255
+ enum: [
12256
+ "failedExecutions"
12257
+ ],
12258
+ required: false,
12259
+ description: "Repeatable field to expand inline. failedExecutions returns the non-passed executions with the run, which saves a second call when you only need to see what broke; omit it for the bare run."
12260
+ }
12261
+ ]
12262
+ },
12263
+ {
12264
+ resource: "devops.testRuns",
12265
+ method: "cancel",
12266
+ summary: "Cancel a test run",
12267
+ description: "Stop a run that is still going. A reason is required and is recorded on the run, because a cancelled run is read later as evidence about why a commit was not verified. Cancelling a run that already reached a verdict is refused with RUN_ALREADY_FINISHED: its result is final and cancelling it would erase the verdict. Executions already recorded stay readable.",
12268
+ http: "POST",
12269
+ path: "/devops/v1/test-runs/{id}:cancel",
12270
+ streaming: "no",
12271
+ pagination: false,
12272
+ pathParams: [
12273
+ {
12274
+ name: "id",
12275
+ sdkName: "id",
12276
+ description: "The run identifier returned by a run list or create answer."
12277
+ }
12278
+ ],
12279
+ query: [],
12280
+ body: {
12281
+ required: true,
12282
+ fields: [
12283
+ {
12284
+ name: "reason",
12285
+ type: "string",
12286
+ required: true,
12287
+ description: "Why the run is being cancelled; it is stored on the run and is what a later reader finds instead of a result."
12288
+ }
12289
+ ]
12290
+ }
12291
+ },
12292
+ {
12293
+ resource: "devops.testRuns.executions",
12294
+ method: "list",
12295
+ summary: "List a run's executions",
12296
+ description: "List the executions recorded against one run — one entry per case the run selected, with its status, duration, attempts and evidence. Use it to find the case that failed, or to compare a repeat run against the previous one case by case. Reads happen while the run is still going, so a case may still be pending; filter by status to watch only the failures.",
12297
+ http: "GET",
12298
+ path: "/devops/v1/test-runs/{run}/executions",
12299
+ streaming: "no",
12300
+ pagination: false,
12301
+ pathParams: [
12302
+ {
12303
+ name: "run",
12304
+ sdkName: "run",
12305
+ description: "The run whose executions you are reading, from a run list or create answer."
12306
+ }
12307
+ ],
12308
+ query: [
12309
+ {
12310
+ name: "pageSize",
12311
+ type: "integer",
12312
+ required: false,
12313
+ description: "How many items this page returns, 1 to 100; omitted uses 50. A larger value is capped at 100 rather than refused, and 0 falls back to the default, so a paging loop never fails on a size alone."
12314
+ },
12315
+ {
12316
+ name: "pageToken",
12317
+ type: "string",
12318
+ required: false,
12319
+ description: "The cursor from the previous page's nextPageToken. Treat it as opaque and never build one yourself; omit it for the first page."
12320
+ },
12321
+ {
12322
+ name: "filter",
12323
+ type: "string",
12324
+ required: false,
12325
+ description: "AIP-160 equality filter over one declared field, for example result=failed to read only a run's failures. Fields an execution list does not declare are refused with INVALID_ARGUMENT rather than ignored."
12326
+ },
12327
+ {
12328
+ name: "orderBy",
12329
+ type: "string",
12330
+ required: false,
12331
+ description: "Comma-separated fields to order by, each optionally suffixed with desc, for example createTime desc. Only the fields the resource declares are accepted; anything else is refused so an ordering typo cannot silently return a different order. Omitted uses the resource's own order."
12332
+ }
12333
+ ]
12334
+ },
12335
+ {
12336
+ resource: "devops.testRuns.executions",
12337
+ method: "retrieve",
12338
+ summary: "Retrieve one case's execution in a run",
12339
+ description: "Read one case's execution inside one run, including every attempt with its own duration and message. Use it after a run reports a failure to see whether the case failed once and passed on retry — that is what flaky true means — and to reach the evidence files a triage needs. Both ids come from the run and case reads; an execution that does not exist for that pair is NOT_FOUND rather than an empty answer.",
12340
+ http: "GET",
12341
+ path: "/devops/v1/test-runs/{run}/executions/{case}",
12342
+ streaming: "no",
12343
+ pagination: false,
12344
+ pathParams: [
12345
+ {
12346
+ name: "run",
12347
+ sdkName: "run",
12348
+ description: "The run whose executions you are reading, from a run list or create answer."
12349
+ },
12350
+ {
12351
+ name: "case",
12352
+ sdkName: "case",
12353
+ description: "The case to read inside that run, from the run's execution list or the project's case list."
12354
+ }
12355
+ ],
12356
+ query: []
12357
+ },
12358
+ {
12359
+ resource: "devops.testSuites",
12360
+ method: "retrieve",
12361
+ summary: "Retrieve a test suite",
12362
+ description: "Read one suite by the id a suite list returned, to learn its file, framework, size, purposes and how many cases it holds. Use it when a case's suite id needs a name for display, or to confirm which commit's catalog a suite came from. The id is opaque; it comes from the list, never from the file path.",
12363
+ http: "GET",
12364
+ path: "/devops/v1/test-suites/{id}",
12365
+ streaming: "no",
12366
+ pagination: false,
12367
+ pathParams: [
12368
+ {
12369
+ name: "id",
12370
+ sdkName: "id",
12371
+ description: "The suite identifier returned by a suite list, not the file path it was discovered from."
12372
+ }
12373
+ ],
12374
+ query: []
12375
+ },
11459
12376
  {
11460
12377
  resource: "file.files",
11461
12378
  method: "list",
@@ -13372,10 +14289,13 @@ The default is return=minimal: success returns HTTP 201 with an empty body. Send
13372
14289
  "frame",
13373
14290
  "overview",
13374
14291
  "audio",
14292
+ "loudness",
14293
+ "beats",
14294
+ "content",
13375
14295
  "embedding"
13376
14296
  ],
13377
14297
  required: false,
13378
- description: "Return one output kind: caption is a visual description, tags are generated labels, ocr is visible text, transcript is speech, frame is a video shot, overview is a video summary, audio is sampled audio understanding, and embedding reports a failed embedding step."
14298
+ description: "Return one output kind: caption is a visual description, tags are generated labels, ocr is visible text, transcript is speech, frame is a video shot, overview is a video summary, audio is sampled audio understanding, loudness is measured loudness, beats is the measured tempo and beat grid, content is the derived speech, music and silence split, and embedding reports a failed embedding step."
13379
14299
  },
13380
14300
  {
13381
14301
  name: "cursor",
@@ -14127,7 +15047,7 @@ The default is return=minimal: success returns HTTP 201 with an empty body. Send
14127
15047
  name: "kinds",
14128
15048
  type: "string",
14129
15049
  required: false,
14130
- description: "Comma-separated output kinds: caption, tags, ocr, frame, transcript, overview, audio, embedding. Omit or empty to include every kind."
15050
+ description: "Comma-separated output kinds: caption, tags, ocr, frame, transcript, overview, audio, loudness, beats, content, embedding. Omit or empty to include every kind."
14131
15051
  },
14132
15052
  {
14133
15053
  name: "cursor",
@@ -21901,6 +22821,8 @@ function problemFrom(status, headers, body, statusText) {
21901
22821
  param: typeof param === "string" ? param : param === null || nested.param === null ? null : undefined,
21902
22822
  errors: Array.isArray(value.errors) ? value.errors : [],
21903
22823
  requestId: headers.get("x-request-id") ?? string(value.requestId) ?? string(value.request_id),
22824
+ docUrl: string(nested.doc_url) ?? string(value.doc_url) ?? string(nested.docUrl) ?? string(value.docUrl),
22825
+ describe: string(nested.describe) ?? string(value.describe),
21904
22826
  raw: body
21905
22827
  };
21906
22828
  }
@@ -21914,6 +22836,8 @@ class PraxisError extends Error {
21914
22836
  errors;
21915
22837
  requestId;
21916
22838
  param;
22839
+ docUrl;
22840
+ describe;
21917
22841
  raw;
21918
22842
  constructor(problem = {}, options) {
21919
22843
  super(problem.message ?? problem.detail ?? problem.title ?? `Praxis request failed${problem.status ? ` (${problem.status})` : ""}`, options);
@@ -21926,6 +22850,8 @@ class PraxisError extends Error {
21926
22850
  this.errors = problem.errors ?? [];
21927
22851
  this.requestId = problem.requestId;
21928
22852
  this.param = problem.param;
22853
+ this.docUrl = problem.docUrl;
22854
+ this.describe = problem.describe;
21929
22855
  this.raw = problem.raw;
21930
22856
  }
21931
22857
  static fromResponse(response, body) {
@@ -27730,6 +28656,36 @@ var cutCreateExport = (options) => (options.client ?? client).post({
27730
28656
  ...options.headers
27731
28657
  }
27732
28658
  });
28659
+ var cutCreateRender = (options) => (options.client ?? client).post({
28660
+ security: [{
28661
+ key: "BearerAuth",
28662
+ scheme: "bearer",
28663
+ type: "http"
28664
+ }, {
28665
+ key: "ApiKeyAuth",
28666
+ name: "X-API-Key",
28667
+ type: "apiKey"
28668
+ }],
28669
+ url: "/cut/v1/projects/{project_id}/renders",
28670
+ ...options,
28671
+ headers: {
28672
+ "Content-Type": "application/json",
28673
+ ...options.headers
28674
+ }
28675
+ });
28676
+ var cutRetrieveRender = (options) => (options.client ?? client).get({
28677
+ security: [{
28678
+ key: "BearerAuth",
28679
+ scheme: "bearer",
28680
+ type: "http"
28681
+ }, {
28682
+ key: "ApiKeyAuth",
28683
+ name: "X-API-Key",
28684
+ type: "apiKey"
28685
+ }],
28686
+ url: "/cut/v1/renders/{render_id}",
28687
+ ...options
28688
+ });
27733
28689
  var cutRetrieveExport = (options) => (options.client ?? client).get({
27734
28690
  security: [{
27735
28691
  key: "BearerAuth",
@@ -28020,6 +28976,201 @@ var databaseInsert = (options) => (options.client ?? client).post({
28020
28976
  ...options.headers
28021
28977
  }
28022
28978
  });
28979
+ var devopsTestCatalogGet = (options) => (options.client ?? client).get({
28980
+ security: [{
28981
+ key: "devops-bearerAuth",
28982
+ scheme: "bearer",
28983
+ type: "http"
28984
+ }],
28985
+ url: "/devops/v1/projects/{project}/test-catalog",
28986
+ ...options
28987
+ });
28988
+ var devopsTestSuitesList = (options) => (options.client ?? client).get({
28989
+ security: [{
28990
+ key: "devops-bearerAuth",
28991
+ scheme: "bearer",
28992
+ type: "http"
28993
+ }],
28994
+ url: "/devops/v1/projects/{project}/test-suites",
28995
+ ...options
28996
+ });
28997
+ var devopsTestSuitesGet = (options) => (options.client ?? client).get({
28998
+ security: [{
28999
+ key: "devops-bearerAuth",
29000
+ scheme: "bearer",
29001
+ type: "http"
29002
+ }],
29003
+ url: "/devops/v1/test-suites/{id}",
29004
+ ...options
29005
+ });
29006
+ var devopsTestCasesList = (options) => (options.client ?? client).get({
29007
+ security: [{
29008
+ key: "devops-bearerAuth",
29009
+ scheme: "bearer",
29010
+ type: "http"
29011
+ }],
29012
+ url: "/devops/v1/projects/{project}/test-cases",
29013
+ ...options
29014
+ });
29015
+ var devopsTestCasesGet = (options) => (options.client ?? client).get({
29016
+ security: [{
29017
+ key: "devops-bearerAuth",
29018
+ scheme: "bearer",
29019
+ type: "http"
29020
+ }],
29021
+ url: "/devops/v1/test-cases/{id}",
29022
+ ...options
29023
+ });
29024
+ var devopsTestPlansList = (options) => (options.client ?? client).get({
29025
+ security: [{
29026
+ key: "devops-bearerAuth",
29027
+ scheme: "bearer",
29028
+ type: "http"
29029
+ }],
29030
+ url: "/devops/v1/projects/{project}/test-plans",
29031
+ ...options
29032
+ });
29033
+ var devopsTestPlansCreate = (options) => (options.client ?? client).post({
29034
+ security: [{
29035
+ key: "devops-bearerAuth",
29036
+ scheme: "bearer",
29037
+ type: "http"
29038
+ }],
29039
+ url: "/devops/v1/projects/{project}/test-plans",
29040
+ ...options,
29041
+ headers: {
29042
+ "Content-Type": "application/json",
29043
+ ...options.headers
29044
+ }
29045
+ });
29046
+ var devopsTestPlansDelete = (options) => (options.client ?? client).delete({
29047
+ security: [{
29048
+ key: "devops-bearerAuth",
29049
+ scheme: "bearer",
29050
+ type: "http"
29051
+ }],
29052
+ url: "/devops/v1/test-plans/{id}",
29053
+ ...options
29054
+ });
29055
+ var devopsTestPlansGet = (options) => (options.client ?? client).get({
29056
+ security: [{
29057
+ key: "devops-bearerAuth",
29058
+ scheme: "bearer",
29059
+ type: "http"
29060
+ }],
29061
+ url: "/devops/v1/test-plans/{id}",
29062
+ ...options
29063
+ });
29064
+ var devopsTestPlansUpdate = (options) => (options.client ?? client).patch({
29065
+ security: [{
29066
+ key: "devops-bearerAuth",
29067
+ scheme: "bearer",
29068
+ type: "http"
29069
+ }],
29070
+ url: "/devops/v1/test-plans/{id}",
29071
+ ...options,
29072
+ headers: {
29073
+ "Content-Type": "application/json",
29074
+ ...options.headers
29075
+ }
29076
+ });
29077
+ var devopsTestPlansPause = (options) => (options.client ?? client).post({
29078
+ security: [{
29079
+ key: "devops-bearerAuth",
29080
+ scheme: "bearer",
29081
+ type: "http"
29082
+ }],
29083
+ url: "/devops/v1/test-plans/{id}:pause",
29084
+ ...options,
29085
+ headers: {
29086
+ "Content-Type": "application/json",
29087
+ ...options.headers
29088
+ }
29089
+ });
29090
+ var devopsTestPlansResume = (options) => (options.client ?? client).post({
29091
+ security: [{
29092
+ key: "devops-bearerAuth",
29093
+ scheme: "bearer",
29094
+ type: "http"
29095
+ }],
29096
+ url: "/devops/v1/test-plans/{id}:resume",
29097
+ ...options
29098
+ });
29099
+ var devopsTestRunsList = (options) => (options.client ?? client).get({
29100
+ security: [{
29101
+ key: "devops-bearerAuth",
29102
+ scheme: "bearer",
29103
+ type: "http"
29104
+ }],
29105
+ url: "/devops/v1/projects/{project}/test-runs",
29106
+ ...options
29107
+ });
29108
+ var devopsTestRunsCreate = (options) => (options.client ?? client).post({
29109
+ security: [{
29110
+ key: "devops-bearerAuth",
29111
+ scheme: "bearer",
29112
+ type: "http"
29113
+ }],
29114
+ url: "/devops/v1/projects/{project}/test-runs",
29115
+ ...options,
29116
+ headers: {
29117
+ "Content-Type": "application/json",
29118
+ ...options.headers
29119
+ }
29120
+ });
29121
+ var devopsTestRunsGet = (options) => (options.client ?? client).get({
29122
+ security: [{
29123
+ key: "devops-bearerAuth",
29124
+ scheme: "bearer",
29125
+ type: "http"
29126
+ }],
29127
+ url: "/devops/v1/test-runs/{id}",
29128
+ ...options
29129
+ });
29130
+ var devopsTestRunsCancel = (options) => (options.client ?? client).post({
29131
+ security: [{
29132
+ key: "devops-bearerAuth",
29133
+ scheme: "bearer",
29134
+ type: "http"
29135
+ }],
29136
+ url: "/devops/v1/test-runs/{id}:cancel",
29137
+ ...options,
29138
+ headers: {
29139
+ "Content-Type": "application/json",
29140
+ ...options.headers
29141
+ }
29142
+ });
29143
+ var devopsTestExecutionsList = (options) => (options.client ?? client).get({
29144
+ security: [{
29145
+ key: "devops-bearerAuth",
29146
+ scheme: "bearer",
29147
+ type: "http"
29148
+ }],
29149
+ url: "/devops/v1/test-runs/{run}/executions",
29150
+ ...options
29151
+ });
29152
+ var devopsTestExecutionsGet = (options) => (options.client ?? client).get({
29153
+ security: [{
29154
+ key: "devops-bearerAuth",
29155
+ scheme: "bearer",
29156
+ type: "http"
29157
+ }],
29158
+ url: "/devops/v1/test-runs/{run}/executions/{case}",
29159
+ ...options
29160
+ });
29161
+ var devopsTestReportsUpload = (options) => (options.client ?? client).post({
29162
+ security: [{
29163
+ key: "devops-bearerAuth",
29164
+ scheme: "bearer",
29165
+ type: "http"
29166
+ }],
29167
+ url: "/devops/v1/projects/{project}/test-reports",
29168
+ ...options,
29169
+ headers: {
29170
+ "Content-Type": "application/json",
29171
+ ...options.headers
29172
+ }
29173
+ });
28023
29174
  var knowledgeListVectorStores = (options) => (options?.client ?? client).get({
28024
29175
  security: [{
28025
29176
  key: "knowledge-bearerAuth",
@@ -31097,6 +32248,9 @@ function createCut(transport) {
31097
32248
  media: {
31098
32249
  import: bind(transport, cutImportMedia)
31099
32250
  },
32251
+ renders: {
32252
+ create: bind(transport, cutCreateRender)
32253
+ },
31100
32254
  retrieve: bind(transport, cutRetrieveProject),
31101
32255
  retrieveState: bind(transport, cutRetrieveState),
31102
32256
  retrieveTimeline: bind(transport, cutRetrieveTimeline),
@@ -31107,6 +32261,9 @@ function createCut(transport) {
31107
32261
  list: bind(transport, cutListVersions)
31108
32262
  }
31109
32263
  },
32264
+ renders: {
32265
+ retrieve: bind(transport, cutRetrieveRender)
32266
+ },
31110
32267
  versions: {
31111
32268
  restore: bind(transport, cutRestoreVersion)
31112
32269
  }
@@ -31149,6 +32306,51 @@ function createDatabase(transport) {
31149
32306
  }
31150
32307
  };
31151
32308
  }
32309
+ function createDevops(transport) {
32310
+ return {
32311
+ projects: {
32312
+ retrieveTestCatalog: bind(transport, devopsTestCatalogGet),
32313
+ testCases: {
32314
+ list: bind(transport, devopsTestCasesList)
32315
+ },
32316
+ testPlans: {
32317
+ create: bind(transport, devopsTestPlansCreate),
32318
+ list: bind(transport, devopsTestPlansList)
32319
+ },
32320
+ testReports: {
32321
+ create: bind(transport, devopsTestReportsUpload)
32322
+ },
32323
+ testRuns: {
32324
+ create: bind(transport, devopsTestRunsCreate),
32325
+ list: bind(transport, devopsTestRunsList)
32326
+ },
32327
+ testSuites: {
32328
+ list: bind(transport, devopsTestSuitesList)
32329
+ }
32330
+ },
32331
+ testCases: {
32332
+ retrieve: bind(transport, devopsTestCasesGet)
32333
+ },
32334
+ testPlans: {
32335
+ delete: bind(transport, devopsTestPlansDelete),
32336
+ pause: bind(transport, devopsTestPlansPause),
32337
+ resume: bind(transport, devopsTestPlansResume),
32338
+ retrieve: bind(transport, devopsTestPlansGet),
32339
+ update: bind(transport, devopsTestPlansUpdate)
32340
+ },
32341
+ testRuns: {
32342
+ cancel: bind(transport, devopsTestRunsCancel),
32343
+ executions: {
32344
+ list: bind(transport, devopsTestExecutionsList),
32345
+ retrieve: bind(transport, devopsTestExecutionsGet)
32346
+ },
32347
+ retrieve: bind(transport, devopsTestRunsGet)
32348
+ },
32349
+ testSuites: {
32350
+ retrieve: bind(transport, devopsTestSuitesGet)
32351
+ }
32352
+ };
32353
+ }
31152
32354
  function createFile(transport) {
31153
32355
  return {
31154
32356
  files: {
@@ -31693,6 +32895,7 @@ var resourceFactories = {
31693
32895
  crm: createCrm,
31694
32896
  cut: createCut,
31695
32897
  database: createDatabase,
32898
+ devops: createDevops,
31696
32899
  file: createFile,
31697
32900
  knowledge: createKnowledge,
31698
32901
  media: createMedia,
@@ -33133,6 +34336,7 @@ var workflows = [
33133
34336
  { words: ["app", "create"], usage: "app create <name> [--dir <path>] [--template <dir>] [--no-install]", summary: "Create an application project from the standard template and install its dependencies.", example: "praxis app create my-app" },
33134
34337
  { words: ["app", "deploy"], usage: "app deploy [--dir <path>] [--no-build]", summary: "Build the project, publish it, create declared secrets, run the health check and print the URL.", example: "praxis app deploy --dir ./my-app" },
33135
34338
  { words: ["app", "rollback"], usage: "app rollback [--dir <path>] [--to <version_id>]", summary: "Deploy the previous version again (or --to a given version) and wait until it is active.", example: "praxis app rollback --to <version_id>" },
34339
+ { words: ["devops", "test", "run"], usage: "devops test run --remote [--project <dvp_…>] [--no-wait] [--repeat <n>] [--select <kind:value>]", summary: "Run the DevOps test selection for the pushed HEAD on the Praxis cloud, wait for the verdict and list the failed cases.", example: "praxis devops test run --remote --select smoke" },
33136
34340
  { words: ["skill"], usage: "skill [--install <dir>]", summary: "Print the AI skill, or write <dir>/praxis-cli/SKILL.md." }
33137
34341
  ];
33138
34342
  var workflowNouns = [...new Set(workflows.filter((w) => w.words.length > 1).map((w) => w.words[0]))];
@@ -33363,21 +34567,90 @@ function toStored(tokens, now, previous) {
33363
34567
  return { ...previous?.organization_id ? { organization_id: previous.organization_id } : {}, access_token: tokens.access_token, ...refresh ? { refresh_token: refresh } : {}, expires_at: now + (tokens.expires_in ?? 900) * 1000 };
33364
34568
  }
33365
34569
  var REFRESH_SKEW_MS = 30000;
33366
- async function refreshTokens(stored, accountUrl, fetchImpl, now) {
33367
- if (!stored.refresh_token)
33368
- return null;
33369
- const res = await fetchImpl(`${accountUrl}/api/auth/oauth2/token`, {
33370
- method: "POST",
33371
- headers: { "content-type": "application/x-www-form-urlencoded" },
33372
- body: new URLSearchParams({ grant_type: "refresh_token", refresh_token: stored.refresh_token, client_id: CLIENT_ID }).toString()
34570
+ var ATTEMPT_TIMEOUT_MS = 8000;
34571
+ var RETRY_DELAYS_MS = [1000, 3000];
34572
+ var RETRY_DEADLINE_MS = 20000;
34573
+ var REFRESH_UNKNOWN_SAFE_MS = 25000;
34574
+ var defaultSleep = (ms, signal) => new Promise((resolve) => {
34575
+ if (signal?.aborted) {
34576
+ resolve();
34577
+ return;
34578
+ }
34579
+ const timer = setTimeout(finish, ms);
34580
+ function finish() {
34581
+ clearTimeout(timer);
34582
+ signal?.removeEventListener("abort", finish);
34583
+ resolve();
34584
+ }
34585
+ signal?.addEventListener("abort", finish, { once: true });
34586
+ });
34587
+ var defaultSchedule = (ms, fire) => {
34588
+ const timer = setTimeout(fire, ms);
34589
+ return () => clearTimeout(timer);
34590
+ };
34591
+ var TRANSIENT_STATUSES = new Set([408, 425, 429]);
34592
+ async function attemptRefresh(stored, accountUrl, fetchImpl, now, schedule) {
34593
+ const controller = new AbortController;
34594
+ let timedOut = false;
34595
+ const cancel = schedule(ATTEMPT_TIMEOUT_MS, () => {
34596
+ timedOut = true;
34597
+ controller.abort();
33373
34598
  });
33374
- const body = await res.json().catch(() => ({}));
33375
- if (!res.ok || typeof body.access_token !== "string")
33376
- return null;
33377
- return toStored(body, now, stored);
34599
+ let response;
34600
+ try {
34601
+ response = await fetchImpl(`${accountUrl}/api/auth/oauth2/token`, {
34602
+ method: "POST",
34603
+ headers: { "content-type": "application/x-www-form-urlencoded" },
34604
+ body: new URLSearchParams({ grant_type: "refresh_token", refresh_token: stored.refresh_token, client_id: CLIENT_ID }).toString(),
34605
+ signal: controller.signal
34606
+ });
34607
+ } catch (error2) {
34608
+ const name = error2?.name;
34609
+ return { kind: "transient", reason: timedOut || name === "AbortError" || name === "TimeoutError" ? "timeout" : "network" };
34610
+ } finally {
34611
+ cancel();
34612
+ }
34613
+ let body;
34614
+ try {
34615
+ body = await response.json();
34616
+ } catch {
34617
+ return { kind: "transient", reason: response.ok ? "unparseable" : `http ${response.status}` };
34618
+ }
34619
+ const error = body.error;
34620
+ if (response.ok) {
34621
+ if (typeof body.access_token !== "string")
34622
+ return { kind: "transient", reason: "unparseable" };
34623
+ return { kind: "ok", tokens: toStored(body, now, stored) };
34624
+ }
34625
+ if (response.status === 400 && error === "invalid_grant")
34626
+ return { kind: "rejected" };
34627
+ if (response.status === 401)
34628
+ return { kind: "rejected" };
34629
+ if (response.status >= 500 || TRANSIENT_STATUSES.has(response.status))
34630
+ return { kind: "transient", reason: `http ${response.status}` };
34631
+ return { kind: "rejected" };
34632
+ }
34633
+ async function refreshWithRetry(stored, accountUrl, fetchImpl, now, sleep2, schedule) {
34634
+ const startedAt = now();
34635
+ let outcome = { kind: "transient", reason: "no attempt made" };
34636
+ for (let attempt = 0;attempt <= RETRY_DELAYS_MS.length; attempt += 1) {
34637
+ if (attempt > 0) {
34638
+ if (now() + RETRY_DELAYS_MS[attempt - 1] - startedAt > RETRY_DEADLINE_MS)
34639
+ break;
34640
+ await sleep2(RETRY_DELAYS_MS[attempt - 1]);
34641
+ }
34642
+ if (now() - startedAt > RETRY_DEADLINE_MS)
34643
+ break;
34644
+ outcome = await attemptRefresh(stored, accountUrl, fetchImpl, now(), schedule);
34645
+ if (outcome.kind !== "transient")
34646
+ return outcome;
34647
+ }
34648
+ return outcome;
33378
34649
  }
33379
34650
  async function currentAccessToken(options) {
33380
34651
  const now = options.now ?? Date.now;
34652
+ const sleep2 = options.sleep ?? defaultSleep;
34653
+ const schedule = options.schedule ?? defaultSchedule;
33381
34654
  const path = options.path ?? tokenPath(options.env);
33382
34655
  const fresh = (t) => t !== null && t.expires_at - REFRESH_SKEW_MS > now();
33383
34656
  const store = options.store ?? createTokenStore(options.env, path, options.secretStore);
@@ -33387,17 +34660,41 @@ async function currentAccessToken(options) {
33387
34660
  return null;
33388
34661
  if (fresh(current))
33389
34662
  return current.access_token;
33390
- const refreshed = await refreshTokens(current, options.accountUrl, options.fetch, now());
33391
- if (!refreshed)
34663
+ const unknownSince = current.rotation_unknown_since;
34664
+ if (unknownSince !== undefined && now() - unknownSince >= REFRESH_UNKNOWN_SAFE_MS) {
34665
+ await session.delete();
33392
34666
  return null;
33393
- await session.save(refreshed);
33394
- return refreshed.access_token;
34667
+ }
34668
+ const firstAttempt = now();
34669
+ await session.save({ ...current, rotation_unknown_since: unknownSince ?? firstAttempt });
34670
+ const outcome = await refreshWithRetry(current, options.accountUrl, options.fetch, () => now(), sleep2, schedule);
34671
+ switch (outcome.kind) {
34672
+ case "ok":
34673
+ await session.save(outcome.tokens);
34674
+ return outcome.tokens.access_token;
34675
+ case "rejected":
34676
+ await session.delete();
34677
+ return null;
34678
+ case "transient":
34679
+ throw new PraxisError({ code: "AUTH_REFRESH_UNAVAILABLE", message: `The token service is temporarily unavailable (${outcome.reason}); the login is kept, retry shortly.` });
34680
+ }
33395
34681
  });
33396
34682
  }
33397
- var LOCK_STALE_MS = 15000;
33398
- async function withLock(lockPath, run) {
34683
+ var REFRESH_MAX_HOLD_MS = RETRY_DEADLINE_MS + ATTEMPT_TIMEOUT_MS;
34684
+ var LOCK_STALE_MS = REFRESH_MAX_HOLD_MS + 1e4;
34685
+ function isLockStale(ageMs, waitedMs) {
34686
+ return ageMs > LOCK_STALE_MS || waitedMs > LOCK_STALE_MS;
34687
+ }
34688
+ var fileLockAge = (lockPath) => Date.now() - statSync(lockPath).mtimeMs;
34689
+ async function withLock(lockPath, run, ports = {}) {
34690
+ const now = ports.now ?? Date.now;
34691
+ const wait = ports.wait ?? ((ms) => new Promise((resolve) => {
34692
+ setTimeout(resolve, ms);
34693
+ }));
34694
+ const lockAge = ports.lockAge ?? fileLockAge;
33399
34695
  mkdirSync(join(lockPath, ".."), { recursive: true, mode: 448 });
33400
- for (let waited = 0;; waited += 50) {
34696
+ const startedAt = now();
34697
+ for (;; ) {
33401
34698
  try {
33402
34699
  closeSync(openSync(lockPath, "wx", 384));
33403
34700
  break;
@@ -33406,15 +34703,15 @@ async function withLock(lockPath, run) {
33406
34703
  throw error;
33407
34704
  let age = 0;
33408
34705
  try {
33409
- age = Date.now() - statSync(lockPath).mtimeMs;
34706
+ age = lockAge(lockPath);
33410
34707
  } catch {
33411
34708
  continue;
33412
34709
  }
33413
- if (age > LOCK_STALE_MS || waited > LOCK_STALE_MS) {
34710
+ if (isLockStale(age, now() - startedAt)) {
33414
34711
  rmSync(lockPath, { force: true });
33415
34712
  continue;
33416
34713
  }
33417
- await new Promise((resolve) => setTimeout(resolve, 50));
34714
+ await wait(50);
33418
34715
  }
33419
34716
  }
33420
34717
  try {
@@ -33480,7 +34777,7 @@ function credentials(config, vars, ports) {
33480
34777
  if (stored.refresh_token)
33481
34778
  remember(stored.refresh_token);
33482
34779
  }
33483
- const opaque = await currentAccessToken({ env: config.env, accountUrl: config.accountUrl, path, store, now: ports.now, fetch: (url, init) => ports.fetch(url, { ...init, signal: AbortSignal.timeout(1e4), redirect: "error" }) });
34780
+ const opaque = await currentAccessToken({ env: config.env, accountUrl: config.accountUrl, path, store, now: ports.now, fetch: (url, init) => ports.fetch(url, { ...init, redirect: "error" }) });
33484
34781
  if (!opaque)
33485
34782
  throw new PraxisError({ code: "NOT_LOGGED_IN", message: "Not logged in or login has expired." });
33486
34783
  remember(opaque);
@@ -33589,7 +34886,18 @@ function skillDocument(commands) {
33589
34886
  "## Account and CLI",
33590
34887
  "",
33591
34888
  ...workflows.map((w) => `praxis ${w.usage} — ${w.summary.replace("Print the AI skill, or write", "Print this skill; use --install <dir> to write")}`),
33592
- "praxis api <METHOD> <path> — Call an API path directly. (--data for a request body)"
34889
+ "praxis api <METHOD> <path> — Call an API path directly. (--data for a request body)",
34890
+ "",
34891
+ "## devops test run (workflow)",
34892
+ "",
34893
+ "Run the project's tests at the commit HEAD is on, on the Praxis cloud executor, and wait for the verdict:",
34894
+ "",
34895
+ "- Only the pushed commit is tested. HEAD must be on a remote branch (`git push` first); this command never pushes for you. Uncommitted changes are a warning only — the working tree is not what runs.",
34896
+ "- The project comes from `--project dvp_…`, or from `devops.project` in the current directory's praxis.jsonc. Neither present is a usage error, exit code 2.",
34897
+ "- `--select` narrows the run: `tag:<tag>` (a bare word reads as a tag), `package:<path>`, `suite:<path>`, `file:<path>`. `--repeat N` runs each selected case N times (a flake then shows up as flaky, not as a failure).",
34898
+ "- The run waits by default and polls every 5s; `--no-wait` returns as soon as the run exists, with `result` still `pending`.",
34899
+ "- Exit code 0 means the verdict passed (or is still pending); 1 means failed, errored, cancelled or timed out — the failed cases are listed, up to 20, with the run URL for the rest; 2 is a usage error.",
34900
+ "- The run URL is on the Console of the environment the CLI talks to; the run id is also on stdout with `--json`."
33593
34901
  ];
33594
34902
  let domain;
33595
34903
  for (const command of commands) {
@@ -34135,6 +35443,191 @@ async function appRollback(args, client2, ports) {
34135
35443
  ports.emit({ kind: "object", data: { url: worker.subdomain?.url ?? null, worker_id: worker.id, from_version: from, to_version: to, deployment_id: done.id } });
34136
35444
  }
34137
35445
 
35446
+ // src/commands/devops.ts
35447
+ import { join as join4 } from "node:path";
35448
+
35449
+ // src/devops/pure.ts
35450
+ import { createHash as createHash2 } from "node:crypto";
35451
+ var PROJECT_ID = /^dvp_[a-z0-9]+$/;
35452
+ var POLL_MS = 5000;
35453
+ var FAILURE_LIMIT = 20;
35454
+ var hint = 'Pass --project dvp_…, or add "devops": { "project": "dvp_…" } to praxis.jsonc in the current directory.';
35455
+ function checkProject(value, hintText = hint) {
35456
+ if (typeof value !== "string" || !value.trim())
35457
+ throw new UsageError("A DevOps project id must be a non-empty string", hintText);
35458
+ if (!PROJECT_ID.test(value.trim()))
35459
+ throw new UsageError(`Not a DevOps project id: ${value}`, "A project id starts with dvp_ and comes from the project list. " + hintText);
35460
+ return value.trim();
35461
+ }
35462
+ function parseDevopsProject(value) {
35463
+ if (value === null || value === undefined || typeof value !== "object" || Array.isArray(value))
35464
+ return;
35465
+ const devops = value.devops;
35466
+ if (devops === undefined)
35467
+ return;
35468
+ if (devops === null || typeof devops !== "object" || Array.isArray(devops))
35469
+ throw new UsageError("praxis.jsonc devops must be an object", 'Write {"devops":{"project":"dvp_…"}}. ' + hint);
35470
+ const project = devops.project;
35471
+ if (project === undefined)
35472
+ return;
35473
+ return checkProject(project);
35474
+ }
35475
+ function resolveProject(flag, projectFile) {
35476
+ if (flag !== undefined)
35477
+ return checkProject(flag);
35478
+ const fromFile = parseDevopsProject(projectFile);
35479
+ if (fromFile !== undefined)
35480
+ return fromFile;
35481
+ throw new UsageError("No DevOps project named for this run", hint);
35482
+ }
35483
+ var sorted = (values) => [...values].sort();
35484
+ var SELECT_KINDS = { tag: "anyTags", package: "packages", suite: "packages", file: "packages" };
35485
+ function parseSelect(values) {
35486
+ if (!values.length)
35487
+ return;
35488
+ const tags = [], packages = [];
35489
+ for (const raw of values) {
35490
+ const at = raw.indexOf(":");
35491
+ const kind = at < 0 ? "tag" : raw.slice(0, at).trim().toLowerCase();
35492
+ const value = (at < 0 ? raw : raw.slice(at + 1)).trim();
35493
+ const kinds = Object.keys(SELECT_KINDS).join(", ");
35494
+ if (!value)
35495
+ throw new UsageError(`--select ${raw} names no value`, `Use --select <kind>:<value>, or a bare tag name; kinds are ${kinds}.`);
35496
+ if (!Object.hasOwn(SELECT_KINDS, kind))
35497
+ throw new UsageError(`--select ${raw}: unknown kind "${kind}"`, `Use one of: ${kinds}.`);
35498
+ (SELECT_KINDS[kind] === "anyTags" ? tags : packages).push(value);
35499
+ }
35500
+ return { ...tags.length ? { anyTags: sorted(tags) } : {}, ...packages.length ? { packages: sorted(packages) } : {} };
35501
+ }
35502
+ function parseRepeat(value) {
35503
+ if (value === undefined)
35504
+ return 1;
35505
+ const n = typeof value === "string" && value.trim() ? Number(value) : NaN;
35506
+ if (!Number.isSafeInteger(n) || n < 1)
35507
+ throw new UsageError("--repeat must be an integer of at least 1");
35508
+ return n;
35509
+ }
35510
+ function requireRemote(remote) {
35511
+ if (!remote)
35512
+ throw new UsageError("Only remote test runs are available", "Add --remote to run the selected cases on the Praxis cloud executor.");
35513
+ }
35514
+ function requestIdFor(input) {
35515
+ const selector = input.selector === undefined ? null : {
35516
+ sizes: sorted(input.selector.sizes ?? []),
35517
+ anyTags: sorted(input.selector.anyTags ?? []),
35518
+ packages: sorted(input.selector.packages ?? []),
35519
+ cases: sorted(input.selector.cases ?? [])
35520
+ };
35521
+ const material = JSON.stringify(["devops-test-run", input.project, input.commit, input.repeat, selector]);
35522
+ return `req_${createHash2("sha256").update(material).digest("hex").slice(0, 32)}`;
35523
+ }
35524
+ var isTerminal = (state) => state === "finished";
35525
+ function shortSha(commit) {
35526
+ return commit.slice(0, 7);
35527
+ }
35528
+ function headBranch(output) {
35529
+ const name = output.trim();
35530
+ return !name || name === "HEAD" ? undefined : name;
35531
+ }
35532
+ function requirePushed(remoteContains, commit, branch) {
35533
+ if (remoteContains.trim())
35534
+ return;
35535
+ throw new UsageError(`Commit ${shortSha(commit)}${branch ? ` on ${branch}` : ""} is not on any remote branch`, `Push it first (git push${branch ? ` origin ${branch}` : ""}); the run tests the pushed commit, and this command never pushes for you.`);
35536
+ }
35537
+ function dirtyNotice(status, commit) {
35538
+ const files = status.split(`
35539
+ `).filter((line) => line.trim()).length;
35540
+ if (files === 0)
35541
+ return;
35542
+ return `Warning: ${files} uncommitted change${files === 1 ? "" : "s"}; the run tests the pushed commit ${shortSha(commit)}, not this working tree.`;
35543
+ }
35544
+ function exitCodeFor(result) {
35545
+ return result === "passed" || result === "pending" ? 0 : 1;
35546
+ }
35547
+ var wantsFailures = (result) => result !== "passed" && result !== "pending";
35548
+ function failedList(items, nextPageToken2, url) {
35549
+ const shown = items.slice(0, FAILURE_LIMIT);
35550
+ if (items.length <= FAILURE_LIMIT && !nextPageToken2)
35551
+ return { shown };
35552
+ return { shown, hint: `Showing ${FAILURE_LIMIT} of the failed cases; the run page lists them all: ${url}` };
35553
+ }
35554
+ var CONSOLE = { develop: "https://console-develop.deepraxis.com", production: "https://console.deepraxis.com" };
35555
+ function runUrl(env, project, id, viewerUrl) {
35556
+ return viewerUrl?.trim() || `${CONSOLE[env]}/devops/projects/${project}/test-runs/${id}`;
35557
+ }
35558
+
35559
+ // src/commands/devops.ts
35560
+ async function projectFile(cwd, ports) {
35561
+ let text;
35562
+ try {
35563
+ text = await ports.readFile(join4(cwd, "praxis.jsonc"));
35564
+ } catch (error) {
35565
+ if (error.code === "ENOENT")
35566
+ return;
35567
+ throw error;
35568
+ }
35569
+ try {
35570
+ return parseJsonc(text);
35571
+ } catch (error) {
35572
+ throw new UsageError(`praxis.jsonc is not valid JSONC: ${error.message}`);
35573
+ }
35574
+ }
35575
+ var COUNT_ORDER = ["passed", "failed", "flaky", "skipped", "pending", "other"];
35576
+ var countLine = (counts) => COUNT_ORDER.filter((key) => counts?.[key]).map((key) => `${counts[key]} ${key}`).join(", ") || "no counts reported";
35577
+ async function devopsTestRun(args, connect, env, ports) {
35578
+ requireRemote(args.remote);
35579
+ const project = resolveProject(args.project, await projectFile(ports.cwd, ports));
35580
+ const selector = parseSelect(args.select ?? []);
35581
+ const repeat = parseRepeat(args.repeat);
35582
+ const git = async (gitArgs) => (await ports.git(gitArgs, ports.cwd)).output;
35583
+ const commit = (await git(["rev-parse", "HEAD"])).trim();
35584
+ if (!commit)
35585
+ throw new UsageError("git rev-parse HEAD answered no commit", "Run this command inside a git repository.");
35586
+ const branch = headBranch(await git(["rev-parse", "--abbrev-ref", "HEAD"]));
35587
+ requirePushed(await git(["branch", "-r", "--contains", "HEAD"]), commit, branch);
35588
+ const notice = dirtyNotice(await git(["status", "--porcelain"]), commit);
35589
+ if (notice)
35590
+ ports.emit({ kind: "message", channel: "stderr", text: notice });
35591
+ const client2 = await connect();
35592
+ const requestId = requestIdFor({ project, commit, selector, repeat });
35593
+ let run = await client2.devops.projects.testRuns.create({ path: { project }, body: { ref: { ...branch ? { branch } : {}, commit }, ...selector ? { selector } : {}, repeat, executor: "cloud", requestId } });
35594
+ while (args.wait && !isTerminal(run.state)) {
35595
+ await ports.wait(POLL_MS);
35596
+ run = await client2.devops.testRuns.retrieve({ path: { id: run.id } });
35597
+ }
35598
+ const url = runUrl(env, project, run.id, run.viewerUrl);
35599
+ let failures = [], failureHint;
35600
+ if (wantsFailures(run.result)) {
35601
+ const page = await client2.devops.testRuns.executions.list({ path: { run: run.id }, query: { pageSize: FAILURE_LIMIT, filter: "result=failed" } });
35602
+ ({ shown: failures, hint: failureHint } = failedList(page.items, page.nextPageToken, url));
35603
+ }
35604
+ const data = {
35605
+ id: run.id,
35606
+ url,
35607
+ project,
35608
+ state: run.state,
35609
+ result: run.result,
35610
+ repeat,
35611
+ commit,
35612
+ ...branch ? { branch } : {},
35613
+ selected: run.selection?.selectedCount ?? null,
35614
+ counts: run.counts ?? null,
35615
+ request_id: requestId,
35616
+ failures: failures.map((execution) => ({ case: execution.case, title: execution.title, package: execution.package ?? null, status: execution.status })),
35617
+ ...failureHint ? { failures_hint: failureHint } : {}
35618
+ };
35619
+ ports.emit({ kind: "object", data });
35620
+ ports.human([
35621
+ `${run.result} — ${project} @ ${commit.slice(0, 7)}${branch ? ` (${branch})` : ""}`,
35622
+ `state ${run.state}, ${countLine(run.counts)}`,
35623
+ url,
35624
+ ...failures.map((execution) => ` failed ${execution.title}`),
35625
+ ...failureHint ? [failureHint] : []
35626
+ ].join(`
35627
+ `));
35628
+ return exitCodeFor(run.result);
35629
+ }
35630
+
34138
35631
  // src/main.ts
34139
35632
  import { spawnSync } from "node:child_process";
34140
35633
 
@@ -34723,22 +36216,22 @@ function errorInput(error, ctx) {
34723
36216
  message = serverText(problem?.detail) ?? serverText(problem?.title) ?? message;
34724
36217
  const authFailure = status === 401 || ["NOT_LOGGED_IN", "UNAUTHENTICATED", "TOKEN_REVOKED", "LOGIN_FAILED"].includes(code);
34725
36218
  const source = ctx.credentialSource ?? "login";
34726
- let hint = genericHint;
36219
+ let hint2 = genericHint;
34727
36220
  if (error instanceof UsageError)
34728
- hint = error.hint;
36221
+ hint2 = error.hint;
34729
36222
  else if (serverText(problem?.hint))
34730
- hint = serverText(problem?.hint);
36223
+ hint2 = serverText(problem?.hint);
34731
36224
  else if (authFailure)
34732
- hint = authHint(source);
36225
+ hint2 = authHint(source);
34733
36226
  else if (status === 404)
34734
- hint = ctx.listCommand ? `Check the id; list existing ones with \`${ctx.listCommand}\`` : "Check the id.";
36227
+ hint2 = ctx.listCommand ? `Check the id; list existing ones with \`${ctx.listCommand}\`` : "Check the id.";
34735
36228
  else if (status === 403)
34736
- hint = "Check that your account or API key has permission to access this resource.";
36229
+ hint2 = "Check that your account or API key has permission to access this resource.";
34737
36230
  else if (status === 429)
34738
- hint = "Rate limited; retry later.";
36231
+ hint2 = "Rate limited; retry later.";
34739
36232
  else if (status !== undefined && status >= 500)
34740
- hint = `Server error; retry later.${request_id ? ` Request id: ${request_id}.` : ""}`;
34741
- return { kind: "error", code, message, hint, ...details !== undefined ? { details } : {}, ...problem !== undefined ? { problem } : {}, env: ctx.env, ...authFailure ? { credential_source: source } : {}, ...status !== undefined ? { status } : {}, ...request_id ? { request_id } : {} };
36233
+ hint2 = `Server error; retry later.${request_id ? ` Request id: ${request_id}.` : ""}`;
36234
+ return { kind: "error", code, message, hint: hint2, ...details !== undefined ? { details } : {}, ...problem !== undefined ? { problem } : {}, env: ctx.env, ...authFailure ? { credential_source: source } : {}, ...status !== undefined ? { status } : {}, ...request_id ? { request_id } : {} };
34742
36235
  }
34743
36236
 
34744
36237
  // src/output/progress.ts
@@ -34768,7 +36261,7 @@ function startProgress(ctx, write = (text) => writeOutput({ stderr: text })) {
34768
36261
  }
34769
36262
 
34770
36263
  // src/main.ts
34771
- var version = "0.2.1-dev.3cf83a0";
36264
+ var version = "0.2.1-dev.3eb4944";
34772
36265
  var commands = commandTree(operations);
34773
36266
  var manual = [...workflows.map((w) => w.words), [API_WORD]];
34774
36267
  function route(argv) {
@@ -34853,7 +36346,14 @@ var defaults = {
34853
36346
  var appOptions = {
34854
36347
  "app create": [{ name: "dir", type: "string", description: "Directory to create the project in (default: ./<name>)." }, { name: "template", type: "string", description: "Copy a local template directory instead of downloading the standard template." }, { name: "no-install", type: "boolean", description: "Skip installing dependencies." }],
34855
36348
  "app deploy": [{ name: "dir", type: "string", description: "Project directory (default: the nearest parent containing praxis.jsonc)." }, { name: "no-build", type: "boolean", description: "Publish the existing dist/ output without building." }],
34856
- "app rollback": [{ name: "dir", type: "string", description: "Project directory (default: the nearest parent containing praxis.jsonc)." }, { name: "to", type: "string", description: "Version id to deploy (default: the previous version)." }]
36349
+ "app rollback": [{ name: "dir", type: "string", description: "Project directory (default: the nearest parent containing praxis.jsonc)." }, { name: "to", type: "string", description: "Version id to deploy (default: the previous version)." }],
36350
+ "devops test run": [
36351
+ { name: "project", type: "string", description: "DevOps project id (dvp_…); default: the devops.project field of praxis.jsonc in the current directory." },
36352
+ { name: "remote", type: "boolean", description: "Run the cases on the Praxis cloud executor. Required; local execution does not exist yet." },
36353
+ { name: "no-wait", type: "boolean", description: "Return as soon as the run exists instead of waiting for a verdict." },
36354
+ { name: "repeat", type: "string", description: "How many times each selected case runs (default: 1)." },
36355
+ { name: "select", type: "string", repeated: true, description: "Narrow the selection; repeatable. tag:<tag> (a bare word reads as a tag), package:<path>, suite:<path> or file:<path>." }
36356
+ ]
34857
36357
  };
34858
36358
  async function main(argv, injected = {}) {
34859
36359
  const ports = { ...defaults, ...injected };
@@ -35088,6 +36588,26 @@ Examples:
35088
36588
  await appRollback({ dir, to: parsed.flags.to?.[0] }, client2, appPorts);
35089
36589
  break;
35090
36590
  }
36591
+ case "devops test run": {
36592
+ return await devopsTestRun({
36593
+ project: parsed.flags.project?.[0],
36594
+ remote: Boolean(parsed.flags.remote),
36595
+ wait: !parsed.flags["no-wait"],
36596
+ repeat: parsed.flags.repeat?.[0],
36597
+ select: parsed.flags.select
36598
+ }, async () => await auth.client(org), config.env, {
36599
+ git: (args, cwd) => ports.spawnCapture("git", args, { cwd }),
36600
+ readFile: ports.readFile,
36601
+ wait: ports.wait,
36602
+ mode: ctx.mode,
36603
+ emit,
36604
+ human: (text) => {
36605
+ if (ctx.mode === "human")
36606
+ emit({ kind: "message", channel: "stdout", text });
36607
+ },
36608
+ cwd: ports.cwd
36609
+ });
36610
+ }
35091
36611
  case "api": {
35092
36612
  const method = parsed.positional[0];
35093
36613
  if (!HTTP_METHOD.test(method))