@naturali/sdk 0.69.0 → 0.71.0
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/index.cjs +552 -5
- package/dist/index.d.cts +6649 -3853
- package/dist/index.d.mts +6649 -3853
- package/dist/index.mjs +549 -6
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -2080,7 +2080,7 @@ var Models = class {
|
|
|
2080
2080
|
/**
|
|
2081
2081
|
* List models
|
|
2082
2082
|
*
|
|
2083
|
-
* Lists catalog models, sorted by id. Filter by vendor, provider, input/output modality, status, or `managed` — the last being the axis that decides whether a model is usable without bringing your own provider credentials, so `?managed=true&status=available` is the set a project
|
|
2083
|
+
* Lists catalog models, sorted by id. Filter by vendor, provider, input/output modality, status, or `managed` — the last being the axis that decides whether a model is usable without bringing your own provider credentials, so `?managed=true&status=available` is the set a project's managed provider serves today.
|
|
2084
2084
|
*
|
|
2085
2085
|
*/
|
|
2086
2086
|
static listModels(options) {
|
|
@@ -2099,14 +2099,14 @@ var Models = class {
|
|
|
2099
2099
|
});
|
|
2100
2100
|
}
|
|
2101
2101
|
/**
|
|
2102
|
-
* Enable
|
|
2102
|
+
* Enable naturali models
|
|
2103
2103
|
*
|
|
2104
|
-
* Provisions
|
|
2104
|
+
* Provisions the project's managed provider — the one provider through which every model the catalog marks `managed: true` is available. It needs no credentials of yours (it runs on naturali's own model access) and is priced from the catalog for all managed models the moment it is created, so any of them is usable from an agent's `model` field — set it to the catalog's `provider_model` — and metered from the first generation. Models that join the catalog later are priced onto the provider automatically by the daily sync; enabling is a one-time act per project, not per model, and calling it again returns the existing provider as a `200` instead of creating a duplicate. The created resource is an ordinary provider: read, update and delete it through [`GET /v1/projects/{project_id}/ai-providers/{ai_provider_id}`](/docs/api/ai-providers/get-ai-provider) like any other. Requires the `admin` role in the project.
|
|
2105
2105
|
*
|
|
2106
2106
|
*/
|
|
2107
|
-
static
|
|
2107
|
+
static enableManagedModels(options) {
|
|
2108
2108
|
return (options.client ?? client).post({
|
|
2109
|
-
url: "/v1/projects/{project_id}/models/
|
|
2109
|
+
url: "/v1/projects/{project_id}/models/providers",
|
|
2110
2110
|
...options,
|
|
2111
2111
|
headers: {
|
|
2112
2112
|
"Content-Type": "application/json",
|
|
@@ -2115,6 +2115,219 @@ var Models = class {
|
|
|
2115
2115
|
});
|
|
2116
2116
|
}
|
|
2117
2117
|
};
|
|
2118
|
+
var Orchestrations = class {
|
|
2119
|
+
/**
|
|
2120
|
+
* List orchestrations
|
|
2121
|
+
*
|
|
2122
|
+
* Returns orchestrations accessible to the caller.
|
|
2123
|
+
*/
|
|
2124
|
+
static listOrchestrations(options) {
|
|
2125
|
+
return (options.client ?? client).get({
|
|
2126
|
+
url: "/v1/projects/{project_id}/orchestrations",
|
|
2127
|
+
...options
|
|
2128
|
+
});
|
|
2129
|
+
}
|
|
2130
|
+
/**
|
|
2131
|
+
* Create an orchestration
|
|
2132
|
+
*
|
|
2133
|
+
* Creates a new orchestration (pipeline) definition in the project.
|
|
2134
|
+
*/
|
|
2135
|
+
static createOrchestration(options) {
|
|
2136
|
+
return (options.client ?? client).post({
|
|
2137
|
+
url: "/v1/projects/{project_id}/orchestrations",
|
|
2138
|
+
...options,
|
|
2139
|
+
headers: {
|
|
2140
|
+
"Content-Type": "application/json",
|
|
2141
|
+
...options.headers
|
|
2142
|
+
}
|
|
2143
|
+
});
|
|
2144
|
+
}
|
|
2145
|
+
/**
|
|
2146
|
+
* Validate an orchestration graph
|
|
2147
|
+
*
|
|
2148
|
+
* Statically validates an orchestration graph without persisting anything. Checks that every node has its required field, node ids are unique, edges reference existing nodes, the graph is acyclic (unless it contains a loop node), and every `input_mapping` `{"var": "..."}` reference resolves to a state key written by an upstream node or seeded by `input_schema`. Returns blocking `errors` and non-blocking `warnings` (e.g. a state key only written on a conditional branch). The same `errors` checks are enforced on create and update, which fail with `400` when any error is present.
|
|
2149
|
+
*
|
|
2150
|
+
*/
|
|
2151
|
+
static validateOrchestration(options) {
|
|
2152
|
+
return (options.client ?? client).post({
|
|
2153
|
+
url: "/v1/projects/{project_id}/orchestrations/validate",
|
|
2154
|
+
...options,
|
|
2155
|
+
headers: {
|
|
2156
|
+
"Content-Type": "application/json",
|
|
2157
|
+
...options.headers
|
|
2158
|
+
}
|
|
2159
|
+
});
|
|
2160
|
+
}
|
|
2161
|
+
/**
|
|
2162
|
+
* Get orchestration queue stats
|
|
2163
|
+
*
|
|
2164
|
+
* Returns a point-in-time snapshot of the orchestration run queue: how many tasks are waiting to be claimed (`queue_depth`), how many are currently claimed with a valid lease (`claimed_tasks`), the age of the oldest waiting task, recent claim-latency percentiles over a rolling in-process window, and a per-project breakdown. Intended for admin/operator policies; guarded by `orchestrations:GetQueueStats`. A project-scoped caller sees only their own projects under `per_project`.
|
|
2165
|
+
*
|
|
2166
|
+
*/
|
|
2167
|
+
static getQueueStats(options) {
|
|
2168
|
+
return (options.client ?? client).get({
|
|
2169
|
+
security: [{
|
|
2170
|
+
scheme: "bearer",
|
|
2171
|
+
type: "http"
|
|
2172
|
+
}],
|
|
2173
|
+
url: "/v1/projects/{project_id}/orchestrations/queue/stats",
|
|
2174
|
+
...options
|
|
2175
|
+
});
|
|
2176
|
+
}
|
|
2177
|
+
/**
|
|
2178
|
+
* Delete an orchestration
|
|
2179
|
+
*
|
|
2180
|
+
* Deletes an orchestration definition and all its runs.
|
|
2181
|
+
*/
|
|
2182
|
+
static deleteOrchestration(options) {
|
|
2183
|
+
return (options.client ?? client).delete({
|
|
2184
|
+
url: "/v1/projects/{project_id}/orchestrations/{orchestration_id}",
|
|
2185
|
+
...options
|
|
2186
|
+
});
|
|
2187
|
+
}
|
|
2188
|
+
/**
|
|
2189
|
+
* Get an orchestration
|
|
2190
|
+
*
|
|
2191
|
+
* Returns the orchestration with nodes and edges.
|
|
2192
|
+
*/
|
|
2193
|
+
static getOrchestration(options) {
|
|
2194
|
+
return (options.client ?? client).get({
|
|
2195
|
+
url: "/v1/projects/{project_id}/orchestrations/{orchestration_id}",
|
|
2196
|
+
...options
|
|
2197
|
+
});
|
|
2198
|
+
}
|
|
2199
|
+
/**
|
|
2200
|
+
* Update an orchestration
|
|
2201
|
+
*
|
|
2202
|
+
* Partially updates an orchestration definition.
|
|
2203
|
+
*/
|
|
2204
|
+
static updateOrchestration(options) {
|
|
2205
|
+
return (options.client ?? client).patch({
|
|
2206
|
+
url: "/v1/projects/{project_id}/orchestrations/{orchestration_id}",
|
|
2207
|
+
...options,
|
|
2208
|
+
headers: {
|
|
2209
|
+
"Content-Type": "application/json",
|
|
2210
|
+
...options.headers
|
|
2211
|
+
}
|
|
2212
|
+
});
|
|
2213
|
+
}
|
|
2214
|
+
/**
|
|
2215
|
+
* List an orchestration's graph versions
|
|
2216
|
+
*
|
|
2217
|
+
* Returns the orchestration's archived graphs, newest first. A version is written on create and on every subsequent write that changes the graph (`nodes`, `edges`, `state_schema`, `input_schema`) — through the REST API or a formation apply alike. Metadata-only edits (name, description) do not archive a version. See [Versioning](/docs/modules/orchestrations#versioning).
|
|
2218
|
+
*
|
|
2219
|
+
*/
|
|
2220
|
+
static listOrchestrationVersions(options) {
|
|
2221
|
+
return (options.client ?? client).get({
|
|
2222
|
+
url: "/v1/projects/{project_id}/orchestrations/{orchestration_id}/versions",
|
|
2223
|
+
...options
|
|
2224
|
+
});
|
|
2225
|
+
}
|
|
2226
|
+
/**
|
|
2227
|
+
* Fetch an archived orchestration version
|
|
2228
|
+
*
|
|
2229
|
+
* Returns the exact graph a given version describes. Every run records the version it started on in `orchestration_version` and executes that graph for its whole life, so this is how you read the topology a run actually took — including a run whose orchestration has been rewired since.
|
|
2230
|
+
*
|
|
2231
|
+
*/
|
|
2232
|
+
static getOrchestrationVersion(options) {
|
|
2233
|
+
return (options.client ?? client).get({
|
|
2234
|
+
url: "/v1/projects/{project_id}/orchestrations/{orchestration_id}/versions/{version}",
|
|
2235
|
+
...options
|
|
2236
|
+
});
|
|
2237
|
+
}
|
|
2238
|
+
/**
|
|
2239
|
+
* Restore an archived orchestration graph
|
|
2240
|
+
*
|
|
2241
|
+
* Writes an archived version's graph back as the orchestration's live definition, which archives it again as a **new** version rather than rewinding the counter — so a run pinned to any version in between still resolves the graph it started on.
|
|
2242
|
+
*
|
|
2243
|
+
* The restore runs through the ordinary update path, so the archived graph goes through the same static validation as an authored one. Node resource references (`agent_id`, `tool_id`, `orchestration_id`) resolve when a run reaches the node, so a target deleted since the snapshot was taken restores cleanly and surfaces as a failed run rather than a `400`. Restoring the graph the orchestration already holds is a no-op and archives nothing. Runs already in flight are unaffected either way — a restore is an ordinary edit, and pinning is what keeps it from reaching them.
|
|
2244
|
+
*
|
|
2245
|
+
*/
|
|
2246
|
+
static restoreOrchestrationVersion(options) {
|
|
2247
|
+
return (options.client ?? client).post({
|
|
2248
|
+
url: "/v1/projects/{project_id}/orchestrations/{orchestration_id}/versions/{version}/restore",
|
|
2249
|
+
...options,
|
|
2250
|
+
headers: {
|
|
2251
|
+
"Content-Type": "application/json",
|
|
2252
|
+
...options.headers
|
|
2253
|
+
}
|
|
2254
|
+
});
|
|
2255
|
+
}
|
|
2256
|
+
/**
|
|
2257
|
+
* List orchestration runs
|
|
2258
|
+
*
|
|
2259
|
+
* Returns orchestration runs the caller can access, optionally filtered by orchestration.
|
|
2260
|
+
*/
|
|
2261
|
+
static listOrchestrationRuns(options) {
|
|
2262
|
+
return (options.client ?? client).get({
|
|
2263
|
+
url: "/v1/projects/{project_id}/orchestration-runs",
|
|
2264
|
+
...options
|
|
2265
|
+
});
|
|
2266
|
+
}
|
|
2267
|
+
/**
|
|
2268
|
+
* Start an orchestration run
|
|
2269
|
+
*
|
|
2270
|
+
* Creates a new run for the orchestration named by orchestration_id. By default the run executes durably in the background: the response returns immediately with status "queued" (a worker then claims it and moves it to "running") and progress is observed via get-orchestration-run or run lifecycle webhook events (orchestration_runs.started/awaiting_input/succeeded/failed). Delay and poll waits park the run as "sleeping" and are woken by a background scheduler, surviving restarts. Pass wait=true to block until the run reaches a terminal or awaiting_input state.
|
|
2271
|
+
*/
|
|
2272
|
+
static startOrchestrationRun(options) {
|
|
2273
|
+
return (options.client ?? client).post({
|
|
2274
|
+
url: "/v1/projects/{project_id}/orchestration-runs",
|
|
2275
|
+
...options,
|
|
2276
|
+
headers: {
|
|
2277
|
+
"Content-Type": "application/json",
|
|
2278
|
+
...options.headers
|
|
2279
|
+
}
|
|
2280
|
+
});
|
|
2281
|
+
}
|
|
2282
|
+
/**
|
|
2283
|
+
* Cancel an orchestration run
|
|
2284
|
+
*
|
|
2285
|
+
* Cancels a run that has not yet reached a terminal state.
|
|
2286
|
+
*/
|
|
2287
|
+
static cancelOrchestrationRun(options) {
|
|
2288
|
+
return (options.client ?? client).post({
|
|
2289
|
+
url: "/v1/projects/{project_id}/orchestration-runs/{orchestration_run_id}/cancel",
|
|
2290
|
+
...options
|
|
2291
|
+
});
|
|
2292
|
+
}
|
|
2293
|
+
/**
|
|
2294
|
+
* Submit human input
|
|
2295
|
+
*
|
|
2296
|
+
* Provides human input to a run that is awaiting_input at a human node.
|
|
2297
|
+
*/
|
|
2298
|
+
static submitHumanInput(options) {
|
|
2299
|
+
return (options.client ?? client).post({
|
|
2300
|
+
url: "/v1/projects/{project_id}/orchestration-runs/{orchestration_run_id}/human-input",
|
|
2301
|
+
...options,
|
|
2302
|
+
headers: {
|
|
2303
|
+
"Content-Type": "application/json",
|
|
2304
|
+
...options.headers
|
|
2305
|
+
}
|
|
2306
|
+
});
|
|
2307
|
+
}
|
|
2308
|
+
/**
|
|
2309
|
+
* Resume an orchestration run
|
|
2310
|
+
*
|
|
2311
|
+
* Re-drives an awaiting_input orchestration run from its last checkpoint. This does not satisfy the pause itself — it carries no node_id or payload, so a run parked on a human or webhook-receive node re-parks on the same node. Use submit-human-input to supply the awaited payload and advance the run.
|
|
2312
|
+
*/
|
|
2313
|
+
static resumeOrchestrationRun(options) {
|
|
2314
|
+
return (options.client ?? client).post({
|
|
2315
|
+
url: "/v1/projects/{project_id}/orchestration-runs/{orchestration_run_id}/resume",
|
|
2316
|
+
...options
|
|
2317
|
+
});
|
|
2318
|
+
}
|
|
2319
|
+
/**
|
|
2320
|
+
* Get an orchestration run
|
|
2321
|
+
*
|
|
2322
|
+
* Returns the status, state, and artifacts of a specific run.
|
|
2323
|
+
*/
|
|
2324
|
+
static getOrchestrationRun(options) {
|
|
2325
|
+
return (options.client ?? client).get({
|
|
2326
|
+
url: "/v1/projects/{project_id}/orchestration-runs/{orchestration_run_id}",
|
|
2327
|
+
...options
|
|
2328
|
+
});
|
|
2329
|
+
}
|
|
2330
|
+
};
|
|
2118
2331
|
var Projects = class {
|
|
2119
2332
|
/**
|
|
2120
2333
|
* List projects
|
|
@@ -2468,6 +2681,97 @@ var Sessions = class {
|
|
|
2468
2681
|
});
|
|
2469
2682
|
}
|
|
2470
2683
|
};
|
|
2684
|
+
var Tasks = class {
|
|
2685
|
+
/**
|
|
2686
|
+
* List tasks
|
|
2687
|
+
*
|
|
2688
|
+
* Lists tasks (the board query). Filter by workflow, state, status, or assignee — `GET /tasks?workflow_id=...&state=...` is one board column.
|
|
2689
|
+
*/
|
|
2690
|
+
static listTasks(options) {
|
|
2691
|
+
return (options.client ?? client).get({
|
|
2692
|
+
url: "/v1/projects/{project_id}/tasks",
|
|
2693
|
+
...options
|
|
2694
|
+
});
|
|
2695
|
+
}
|
|
2696
|
+
/**
|
|
2697
|
+
* Create a task
|
|
2698
|
+
*
|
|
2699
|
+
* Creates a task bound to a workflow. By default the task is placed in the workflow's initial state; passing `state` places it directly in that named state instead — an alternate entry point for starting a task mid-flow (e.g. "a new recorte for an existing theme by id"), rather than re-submitting from the initial state and hoping a guard or similarity gate recognizes it. Entering the resulting state, initial or named, behaves identically: that state's `on_enter` automation fires and its `stalled_after` clock arms.
|
|
2700
|
+
*/
|
|
2701
|
+
static createTask(options) {
|
|
2702
|
+
return (options.client ?? client).post({
|
|
2703
|
+
url: "/v1/projects/{project_id}/tasks",
|
|
2704
|
+
...options,
|
|
2705
|
+
headers: {
|
|
2706
|
+
"Content-Type": "application/json",
|
|
2707
|
+
...options.headers
|
|
2708
|
+
}
|
|
2709
|
+
});
|
|
2710
|
+
}
|
|
2711
|
+
/**
|
|
2712
|
+
* Delete a task
|
|
2713
|
+
*
|
|
2714
|
+
* Deletes a task. Its transition history cascades.
|
|
2715
|
+
*/
|
|
2716
|
+
static deleteTask(options) {
|
|
2717
|
+
return (options.client ?? client).delete({
|
|
2718
|
+
url: "/v1/projects/{project_id}/tasks/{task_id}",
|
|
2719
|
+
...options
|
|
2720
|
+
});
|
|
2721
|
+
}
|
|
2722
|
+
/**
|
|
2723
|
+
* Get a task
|
|
2724
|
+
*
|
|
2725
|
+
* Retrieves a task, including its active dispatch and automation status.
|
|
2726
|
+
*/
|
|
2727
|
+
static getTask(options) {
|
|
2728
|
+
return (options.client ?? client).get({
|
|
2729
|
+
url: "/v1/projects/{project_id}/tasks/{task_id}",
|
|
2730
|
+
...options
|
|
2731
|
+
});
|
|
2732
|
+
}
|
|
2733
|
+
/**
|
|
2734
|
+
* Update a task
|
|
2735
|
+
*
|
|
2736
|
+
* Updates a task's payload, title, or assignee. `state` is never directly writable — move it with a transition; sending a `state` field is rejected as an unknown field (`VALIDATION_FAILED`). `payload` is shallow-merged over the existing payload (PATCH semantics): keys the request omits are preserved. The payload is caller-owned; the automation result lives in the read-only `last_result` field, which no patch can reach. The merged payload is validated against the workflow's `payload_schema`.
|
|
2737
|
+
*/
|
|
2738
|
+
static updateTask(options) {
|
|
2739
|
+
return (options.client ?? client).patch({
|
|
2740
|
+
url: "/v1/projects/{project_id}/tasks/{task_id}",
|
|
2741
|
+
...options,
|
|
2742
|
+
headers: {
|
|
2743
|
+
"Content-Type": "application/json",
|
|
2744
|
+
...options.headers
|
|
2745
|
+
}
|
|
2746
|
+
});
|
|
2747
|
+
}
|
|
2748
|
+
/**
|
|
2749
|
+
* Transition a task
|
|
2750
|
+
*
|
|
2751
|
+
* Fires a named transition on a task. The transition must exist in the workflow and be valid from the task's current state; its guard must pass. This is the single path every state change routes through. A transition declaring `requires_approval` does not move the task — it parks a pending ApprovalItem and returns the task with `pending_transition` set; the move applies only when the approval is approved.
|
|
2752
|
+
*/
|
|
2753
|
+
static transitionTask(options) {
|
|
2754
|
+
return (options.client ?? client).post({
|
|
2755
|
+
url: "/v1/projects/{project_id}/tasks/{task_id}/transitions",
|
|
2756
|
+
...options,
|
|
2757
|
+
headers: {
|
|
2758
|
+
"Content-Type": "application/json",
|
|
2759
|
+
...options.headers
|
|
2760
|
+
}
|
|
2761
|
+
});
|
|
2762
|
+
}
|
|
2763
|
+
/**
|
|
2764
|
+
* Get task history
|
|
2765
|
+
*
|
|
2766
|
+
* Returns the append-only transition history of a task.
|
|
2767
|
+
*/
|
|
2768
|
+
static getTaskHistory(options) {
|
|
2769
|
+
return (options.client ?? client).get({
|
|
2770
|
+
url: "/v1/projects/{project_id}/tasks/{task_id}/history",
|
|
2771
|
+
...options
|
|
2772
|
+
});
|
|
2773
|
+
}
|
|
2774
|
+
};
|
|
2471
2775
|
var Tools = class {
|
|
2472
2776
|
/**
|
|
2473
2777
|
* List tools
|
|
@@ -2603,6 +2907,130 @@ var Traces = class {
|
|
|
2603
2907
|
});
|
|
2604
2908
|
}
|
|
2605
2909
|
};
|
|
2910
|
+
var Triggers = class {
|
|
2911
|
+
/**
|
|
2912
|
+
* List triggers
|
|
2913
|
+
*
|
|
2914
|
+
* Lists triggers. Filter by project, starter type, or target type.
|
|
2915
|
+
*/
|
|
2916
|
+
static listTriggers(options) {
|
|
2917
|
+
return (options.client ?? client).get({
|
|
2918
|
+
url: "/v1/projects/{project_id}/triggers",
|
|
2919
|
+
...options
|
|
2920
|
+
});
|
|
2921
|
+
}
|
|
2922
|
+
/**
|
|
2923
|
+
* Create a trigger
|
|
2924
|
+
*
|
|
2925
|
+
* Creates a new trigger for a project
|
|
2926
|
+
*/
|
|
2927
|
+
static createTrigger(options) {
|
|
2928
|
+
return (options.client ?? client).post({
|
|
2929
|
+
url: "/v1/projects/{project_id}/triggers",
|
|
2930
|
+
...options,
|
|
2931
|
+
headers: {
|
|
2932
|
+
"Content-Type": "application/json",
|
|
2933
|
+
...options.headers
|
|
2934
|
+
}
|
|
2935
|
+
});
|
|
2936
|
+
}
|
|
2937
|
+
/**
|
|
2938
|
+
* Delete a trigger
|
|
2939
|
+
*
|
|
2940
|
+
* Deletes a trigger
|
|
2941
|
+
*/
|
|
2942
|
+
static deleteTrigger(options) {
|
|
2943
|
+
return (options.client ?? client).delete({
|
|
2944
|
+
url: "/v1/projects/{project_id}/triggers/{trigger_id}",
|
|
2945
|
+
...options
|
|
2946
|
+
});
|
|
2947
|
+
}
|
|
2948
|
+
/**
|
|
2949
|
+
* Get a trigger
|
|
2950
|
+
*
|
|
2951
|
+
* Retrieves the details of a specific trigger
|
|
2952
|
+
*/
|
|
2953
|
+
static getTrigger(options) {
|
|
2954
|
+
return (options.client ?? client).get({
|
|
2955
|
+
url: "/v1/projects/{project_id}/triggers/{trigger_id}",
|
|
2956
|
+
...options
|
|
2957
|
+
});
|
|
2958
|
+
}
|
|
2959
|
+
/**
|
|
2960
|
+
* Update a trigger
|
|
2961
|
+
*
|
|
2962
|
+
* Updates an existing trigger's configuration. The type is immutable.
|
|
2963
|
+
*/
|
|
2964
|
+
static updateTrigger(options) {
|
|
2965
|
+
return (options.client ?? client).patch({
|
|
2966
|
+
url: "/v1/projects/{project_id}/triggers/{trigger_id}",
|
|
2967
|
+
...options,
|
|
2968
|
+
headers: {
|
|
2969
|
+
"Content-Type": "application/json",
|
|
2970
|
+
...options.headers
|
|
2971
|
+
}
|
|
2972
|
+
});
|
|
2973
|
+
}
|
|
2974
|
+
/**
|
|
2975
|
+
* Fire a trigger
|
|
2976
|
+
*
|
|
2977
|
+
* Fires a trigger synchronously and returns the terminal firing record. The firing itself always settles here; an `eval` target's run is queued rather than executed inline, so the record names a `queued` run to poll.
|
|
2978
|
+
*/
|
|
2979
|
+
static fireTrigger(options) {
|
|
2980
|
+
return (options.client ?? client).post({
|
|
2981
|
+
url: "/v1/projects/{project_id}/triggers/{trigger_id}/fire",
|
|
2982
|
+
...options,
|
|
2983
|
+
headers: {
|
|
2984
|
+
"Content-Type": "application/json",
|
|
2985
|
+
...options.headers
|
|
2986
|
+
}
|
|
2987
|
+
});
|
|
2988
|
+
}
|
|
2989
|
+
/**
|
|
2990
|
+
* Get trigger secret
|
|
2991
|
+
*
|
|
2992
|
+
* Retrieves the signing secret for a webhook trigger
|
|
2993
|
+
*/
|
|
2994
|
+
static getTriggerSecret(options) {
|
|
2995
|
+
return (options.client ?? client).get({
|
|
2996
|
+
url: "/v1/projects/{project_id}/triggers/{trigger_id}/secret",
|
|
2997
|
+
...options
|
|
2998
|
+
});
|
|
2999
|
+
}
|
|
3000
|
+
/**
|
|
3001
|
+
* Rotate trigger secret
|
|
3002
|
+
*
|
|
3003
|
+
* Rotates the signing secret for a webhook trigger
|
|
3004
|
+
*/
|
|
3005
|
+
static rotateTriggerSecret(options) {
|
|
3006
|
+
return (options.client ?? client).post({
|
|
3007
|
+
url: "/v1/projects/{project_id}/triggers/{trigger_id}/rotate-secret",
|
|
3008
|
+
...options
|
|
3009
|
+
});
|
|
3010
|
+
}
|
|
3011
|
+
/**
|
|
3012
|
+
* List trigger firings
|
|
3013
|
+
*
|
|
3014
|
+
* Lists firings for a trigger (trigger_id is required).
|
|
3015
|
+
*/
|
|
3016
|
+
static listTriggerFirings(options) {
|
|
3017
|
+
return (options.client ?? client).get({
|
|
3018
|
+
url: "/v1/projects/{project_id}/trigger-firings",
|
|
3019
|
+
...options
|
|
3020
|
+
});
|
|
3021
|
+
}
|
|
3022
|
+
/**
|
|
3023
|
+
* Get a trigger firing
|
|
3024
|
+
*
|
|
3025
|
+
* Retrieves the details of a specific trigger firing
|
|
3026
|
+
*/
|
|
3027
|
+
static getTriggerFiring(options) {
|
|
3028
|
+
return (options.client ?? client).get({
|
|
3029
|
+
url: "/v1/projects/{project_id}/trigger-firings/{firing_id}",
|
|
3030
|
+
...options
|
|
3031
|
+
});
|
|
3032
|
+
}
|
|
3033
|
+
};
|
|
2606
3034
|
var Users = class {
|
|
2607
3035
|
/**
|
|
2608
3036
|
* Get the current user
|
|
@@ -2752,6 +3180,113 @@ var Webhooks = class {
|
|
|
2752
3180
|
});
|
|
2753
3181
|
}
|
|
2754
3182
|
};
|
|
3183
|
+
var Workflows = class {
|
|
3184
|
+
/**
|
|
3185
|
+
* List workflows
|
|
3186
|
+
*
|
|
3187
|
+
* Lists workflow definitions in a project.
|
|
3188
|
+
*/
|
|
3189
|
+
static listWorkflows(options) {
|
|
3190
|
+
return (options.client ?? client).get({
|
|
3191
|
+
url: "/v1/projects/{project_id}/workflows",
|
|
3192
|
+
...options
|
|
3193
|
+
});
|
|
3194
|
+
}
|
|
3195
|
+
/**
|
|
3196
|
+
* Create a workflow
|
|
3197
|
+
*
|
|
3198
|
+
* Creates a new workflow definition. The definition is statically validated.
|
|
3199
|
+
*/
|
|
3200
|
+
static createWorkflow(options) {
|
|
3201
|
+
return (options.client ?? client).post({
|
|
3202
|
+
url: "/v1/projects/{project_id}/workflows",
|
|
3203
|
+
...options,
|
|
3204
|
+
headers: {
|
|
3205
|
+
"Content-Type": "application/json",
|
|
3206
|
+
...options.headers
|
|
3207
|
+
}
|
|
3208
|
+
});
|
|
3209
|
+
}
|
|
3210
|
+
/**
|
|
3211
|
+
* Delete a workflow
|
|
3212
|
+
*
|
|
3213
|
+
* Deletes a workflow. Rejected while open tasks exist.
|
|
3214
|
+
*/
|
|
3215
|
+
static deleteWorkflow(options) {
|
|
3216
|
+
return (options.client ?? client).delete({
|
|
3217
|
+
url: "/v1/projects/{project_id}/workflows/{workflow_id}",
|
|
3218
|
+
...options
|
|
3219
|
+
});
|
|
3220
|
+
}
|
|
3221
|
+
/**
|
|
3222
|
+
* Get a workflow
|
|
3223
|
+
*
|
|
3224
|
+
* Retrieves a workflow definition.
|
|
3225
|
+
*/
|
|
3226
|
+
static getWorkflow(options) {
|
|
3227
|
+
return (options.client ?? client).get({
|
|
3228
|
+
url: "/v1/projects/{project_id}/workflows/{workflow_id}",
|
|
3229
|
+
...options
|
|
3230
|
+
});
|
|
3231
|
+
}
|
|
3232
|
+
/**
|
|
3233
|
+
* Update a workflow
|
|
3234
|
+
*
|
|
3235
|
+
* Updates a workflow definition. Structural changes (states/transitions) are re-validated. Existing tasks in a removed state stay put but can only leave via transitions valid in the new definition.
|
|
3236
|
+
*/
|
|
3237
|
+
static updateWorkflow(options) {
|
|
3238
|
+
return (options.client ?? client).patch({
|
|
3239
|
+
url: "/v1/projects/{project_id}/workflows/{workflow_id}",
|
|
3240
|
+
...options,
|
|
3241
|
+
headers: {
|
|
3242
|
+
"Content-Type": "application/json",
|
|
3243
|
+
...options.headers
|
|
3244
|
+
}
|
|
3245
|
+
});
|
|
3246
|
+
}
|
|
3247
|
+
/**
|
|
3248
|
+
* List a workflow's versions
|
|
3249
|
+
*
|
|
3250
|
+
* Returns the workflow's archived state machines, newest first. A version is written on create and on every subsequent write that changes the definition (`states`, `transitions`, `payload_schema`) — through the REST API or a formation apply alike. Metadata-only edits (name, description) do not archive a version. See [Versioning](/docs/modules/workflows#versioning).
|
|
3251
|
+
*
|
|
3252
|
+
*/
|
|
3253
|
+
static listWorkflowVersions(options) {
|
|
3254
|
+
return (options.client ?? client).get({
|
|
3255
|
+
url: "/v1/projects/{project_id}/workflows/{workflow_id}/versions",
|
|
3256
|
+
...options
|
|
3257
|
+
});
|
|
3258
|
+
}
|
|
3259
|
+
/**
|
|
3260
|
+
* Fetch an archived workflow version
|
|
3261
|
+
*
|
|
3262
|
+
* Returns the exact state machine a given version describes. Every task records the version it entered on in `workflow_version` and runs on that machine for its whole life, so this is how you read the definition a task is actually being validated against — including a task whose workflow has been rewired since.
|
|
3263
|
+
*
|
|
3264
|
+
*/
|
|
3265
|
+
static getWorkflowVersion(options) {
|
|
3266
|
+
return (options.client ?? client).get({
|
|
3267
|
+
url: "/v1/projects/{project_id}/workflows/{workflow_id}/versions/{version}",
|
|
3268
|
+
...options
|
|
3269
|
+
});
|
|
3270
|
+
}
|
|
3271
|
+
/**
|
|
3272
|
+
* Restore an archived workflow state machine
|
|
3273
|
+
*
|
|
3274
|
+
* Writes an archived version's state machine back as the workflow's live definition, which archives it again as a **new** version rather than rewinding the counter — so a task pinned to any version in between still runs on the machine it entered on.
|
|
3275
|
+
*
|
|
3276
|
+
* The restore runs through the ordinary update path, so the archived definition goes through the same validation as an authored one. That includes resolving every `on_enter` dispatch target, so restoring a version whose agent or orchestration has since been deleted fails with `400` rather than writing a definition that would strand a task on entry. Restoring the definition the workflow already holds is a no-op and archives nothing. Tasks already in flight are unaffected either way — a restore is an ordinary edit, and pinning is what keeps it from reaching them.
|
|
3277
|
+
*
|
|
3278
|
+
*/
|
|
3279
|
+
static restoreWorkflowVersion(options) {
|
|
3280
|
+
return (options.client ?? client).post({
|
|
3281
|
+
url: "/v1/projects/{project_id}/workflows/{workflow_id}/versions/{version}/restore",
|
|
3282
|
+
...options,
|
|
3283
|
+
headers: {
|
|
3284
|
+
"Content-Type": "application/json",
|
|
3285
|
+
...options.headers
|
|
3286
|
+
}
|
|
3287
|
+
});
|
|
3288
|
+
}
|
|
3289
|
+
};
|
|
2755
3290
|
//#endregion
|
|
2756
3291
|
//#region src/naturaliClient.ts
|
|
2757
3292
|
/**
|
|
@@ -2812,13 +3347,17 @@ var NaturaliClient = class {
|
|
|
2812
3347
|
generations;
|
|
2813
3348
|
modelRoutes;
|
|
2814
3349
|
models;
|
|
3350
|
+
orchestrations;
|
|
2815
3351
|
projects;
|
|
2816
3352
|
secrets;
|
|
2817
3353
|
sessions;
|
|
3354
|
+
tasks;
|
|
2818
3355
|
tools;
|
|
2819
3356
|
traces;
|
|
3357
|
+
triggers;
|
|
2820
3358
|
users;
|
|
2821
3359
|
webhooks;
|
|
3360
|
+
workflows;
|
|
2822
3361
|
/** The underlying HTTP client, for interceptors or one-off requests. */
|
|
2823
3362
|
http;
|
|
2824
3363
|
constructor({ token, headers } = {}) {
|
|
@@ -2842,13 +3381,17 @@ var NaturaliClient = class {
|
|
|
2842
3381
|
this.generations = bindResource(Generations, this.http);
|
|
2843
3382
|
this.modelRoutes = bindResource(ModelRoutes, this.http);
|
|
2844
3383
|
this.models = bindResource(Models, this.http);
|
|
3384
|
+
this.orchestrations = bindResource(Orchestrations, this.http);
|
|
2845
3385
|
this.projects = bindResource(Projects, this.http);
|
|
2846
3386
|
this.secrets = bindResource(Secrets, this.http);
|
|
2847
3387
|
this.sessions = bindResource(Sessions, this.http);
|
|
3388
|
+
this.tasks = bindResource(Tasks, this.http);
|
|
2848
3389
|
this.tools = bindResource(Tools, this.http);
|
|
2849
3390
|
this.traces = bindResource(Traces, this.http);
|
|
3391
|
+
this.triggers = bindResource(Triggers, this.http);
|
|
2850
3392
|
this.users = bindResource(Users, this.http);
|
|
2851
3393
|
this.webhooks = bindResource(Webhooks, this.http);
|
|
3394
|
+
this.workflows = bindResource(Workflows, this.http);
|
|
2852
3395
|
}
|
|
2853
3396
|
};
|
|
2854
3397
|
//#endregion
|
|
@@ -2866,12 +3409,16 @@ exports.Generations = Generations;
|
|
|
2866
3409
|
exports.ModelRoutes = ModelRoutes;
|
|
2867
3410
|
exports.Models = Models;
|
|
2868
3411
|
exports.NaturaliClient = NaturaliClient;
|
|
3412
|
+
exports.Orchestrations = Orchestrations;
|
|
2869
3413
|
exports.Projects = Projects;
|
|
2870
3414
|
exports.Secrets = Secrets;
|
|
2871
3415
|
exports.Sessions = Sessions;
|
|
3416
|
+
exports.Tasks = Tasks;
|
|
2872
3417
|
exports.Tools = Tools;
|
|
2873
3418
|
exports.Traces = Traces;
|
|
3419
|
+
exports.Triggers = Triggers;
|
|
2874
3420
|
exports.Users = Users;
|
|
2875
3421
|
exports.Webhooks = Webhooks;
|
|
3422
|
+
exports.Workflows = Workflows;
|
|
2876
3423
|
exports.createClient = createClient;
|
|
2877
3424
|
exports.createConfig = createConfig;
|