anbaric 1.56.7 → 1.56.9

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/docs/api/cli.md CHANGED
@@ -46,7 +46,7 @@ anbaric app status link-media-brief # a different app, from anywhere
46
46
  | --- | --- |
47
47
  | `anbaric state-machines` | List registered state machines. |
48
48
  | `anbaric jobs create <sm-id> <start-state> [k=v …]` | Create a job and queue it for processing. |
49
- | `anbaric jobs list [state-machine-id]` | List jobs, optionally filtered by workflow. |
49
+ | `anbaric jobs list [state-machine-id]` | List jobs, newest first, a page at a time (100 by default — `--page 1` for the next). Narrow with `--state`, `--status`, `--app`; `--oldest` flips the order. Filters apply on the platform, across every job, before paging. |
50
50
  | `anbaric jobs stats` | Job counts per state and the queue size. |
51
51
  | `anbaric jobs watch <job-id>` | Follow a job's state and property changes live. |
52
52
  | `anbaric jobs set-state <job-id> <state>` | Move a job to a state and re-queue it. |
@@ -67,6 +67,9 @@ ask for, so the CLI runs unattended in scripts and CI.
67
67
  | `--name <name>` | `app configure`/`deploy`/`update` | App name; prompts if omitted (suggested from `package.json`). |
68
68
  | `--port <port>` | `app configure`/`deploy`/`update` | Internal port (1–65535); prompts if omitted. |
69
69
  | `--yes` | `app deploy`, `app tear-down`, `jobs kill-old` | Skip confirmation. (`app update` implies it.) |
70
+ | `--state <state>`, `--status <status>`, `--app <app>` | `jobs list` | Only jobs in that state / with that status (`active`, `Awaiting input`, `Failed`) / belonging to that app. |
71
+ | `--page <n>`, `--page-size <n>` | `jobs list` | Which page (from 0) and how many per page (default 100). |
72
+ | `--oldest` | `jobs list` | Oldest first instead of newest. |
70
73
  | `--help`, `-h` | all | Print usage. |
71
74
 
72
75
  ## Configuration and storage
@@ -49,6 +49,7 @@ Used by the store implementations the factories return:
49
49
  | `ANBARIC_SQL_DATABASE_URL` | PostgreSQL | connection string |
50
50
  | `ANBARIC_SQL_SCHEMA` | PostgreSQL | schema name (default `anbaric_app_data`) |
51
51
  | `ANBARIC_FILE_STORAGE_PATH` | local file storage | directory to keep files in (default `<temp dir>/anbaric/files`) |
52
+ | `ANBARIC_SCHEDULER_TICK_MS` | the job run scheduler | how often due runs are checked for, in milliseconds (default `10000`) |
52
53
 
53
54
  ## Platform-injected variables
54
55
 
@@ -268,6 +268,30 @@ A job whose action threw is `FAILED`, with the reason in its audit trail. It
268
268
  stays in its state rather than transitioning, and an update that moves it on
269
269
  returns it to `ACTIVE` — so a failure is recoverable, not terminal.
270
270
 
271
+ ### Listing jobs
272
+
273
+ ```ts
274
+ const persistence = JobPersistenceFactory.instance();
275
+
276
+ persistence.list(actor) : Promise<Array<Job>> // first 100, oldest first
277
+ persistence.list(actor, pageSize, page, query?) : Promise<Array<Job>>
278
+
279
+ type JobPersistence.Query = {
280
+ workflowId? : string,
281
+ appId? : string,
282
+ state? : string,
283
+ status? : string, // "active", "Awaiting input", "Failed"
284
+ killed? : boolean,
285
+ order? : "oldest" | "newest" // by when the job was started; oldest by default
286
+ }
287
+ ```
288
+
289
+ A listing is a **page**, never a cap: `pageSize` jobs (default 100) at `page`
290
+ (from 0), and every job the store holds is reachable by asking for the next
291
+ page until one comes back short. The query narrows the set on the store before
292
+ paging — a filter sees every job, and page numbers count matching jobs only.
293
+ Deployed, the store holds every job on the tenant across all apps and machines.
294
+
271
295
  ---
272
296
 
273
297
  ## `PropertyDefinition`
package/docs/api/web.md CHANGED
@@ -94,10 +94,32 @@ GET /api/v2/whoami → { "id": "user-123", "roles": ["admin"] }
94
94
 
95
95
  Returns the authenticated user for the current request.
96
96
 
97
+ ### Jobs
98
+
99
+ ```
100
+ GET /api/v2/jobs?page=0&pageSize=100&order=newest&workflowId=…&appId=…&state=…&status=…&killed=false
101
+ ```
102
+
103
+ Every job on the tenant, across all apps and state machines, **paged**: the
104
+ response is one page of at most `pageSize` jobs (default 100) at page `page`
105
+ (from 0). The page size is not a cap — keep asking for the next page until one
106
+ comes back shorter than `pageSize`, which is the last. `order` is by when the
107
+ job was started: `oldest` (the default, for compatibility) or `newest`.
108
+
109
+ The other parameters are filters, applied on the platform **before** paging, so
110
+ a filter sees every job and page numbers count matching jobs only. All are
111
+ optional and combine with AND: `workflowId` (the state machine), `appId`,
112
+ `state`, `status` (`active`, `Awaiting input`, `Failed`) and `killed`
113
+ (`true`/`false`).
114
+
115
+ In code the same listing is `JobPersistenceFactory.instance().list(actor,
116
+ pageSize, page, query)`; the CLI's `anbaric jobs list` and the MCP tool
117
+ `anbaric_jobs_list` take the same filters.
118
+
97
119
  ### Other resources
98
120
 
99
121
  Also under `/api/v2`, reached through the cloud clients rather than raw HTTP:
100
- `jobs`, `state-machines`, `queue`, `consumers`, and (when enabled) `documents`,
122
+ `state-machines`, `queue`, `consumers`, and (when enabled) `documents`,
101
123
  `secrets`, `audits`. Prefer the typed clients and factories over calling these by
102
124
  hand.
103
125
 
@@ -73,6 +73,9 @@ processRun.run = async (job) => {
73
73
 
74
74
  ## Spreading the load
75
75
 
76
+ The scheduler checks for due runs every ten seconds (`ANBARIC_SCHEDULER_TICK_MS`
77
+ changes that), so a run starts within ten seconds of its planned time.
78
+
76
79
  Machines scheduled at the same time would otherwise all start on the same
77
80
  second. Each machine gets a small random offset — up to two minutes by default —
78
81
  applied **when the run is planned**, so the stored time is the time it really
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "anbaric",
3
- "version": "1.56.7",
3
+ "version": "1.56.9",
4
4
  "description": "Everything needed to write an Anbaric app: state machines, jobs, document and secret stores, local in-memory implementations and the Anbaric Cloud clients",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -24,9 +24,9 @@
24
24
  "prepublishOnly": "npm run build"
25
25
  },
26
26
  "dependencies": {
27
- "anbaric-impl-cloud": "^1.56.7",
28
- "anbaric-data-store": "^1.56.7",
29
- "anbaric-state-machine": "^1.56.7",
30
- "anbaric-tsapi": "^1.56.7"
27
+ "anbaric-impl-cloud": "^1.56.9",
28
+ "anbaric-data-store": "^1.56.9",
29
+ "anbaric-state-machine": "^1.56.9",
30
+ "anbaric-tsapi": "^1.56.9"
31
31
  }
32
32
  }