wicked-crew-api-types 0.175.0 → 0.178.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.
Files changed (2) hide show
  1. package/index.d.ts +237 -5
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -13157,6 +13157,8 @@ export interface SourceCatalogRelation {
13157
13157
  foreignKeys: Array<{ name: string; columns: string[]; references: { schema: string | null; table: string; columns: string[] } }>;
13158
13158
  /** Postgres: row security enabled or forced. */
13159
13159
  rowSecurity?: boolean;
13160
+ /** (api-types 0.176.0) Postgres: row security FORCED (it applies to the table's owner too). */
13161
+ rowSecurityForced?: boolean;
13160
13162
  }
13161
13163
 
13162
13164
  /** A `sql` source's catalog: structure only. */
@@ -15076,6 +15078,38 @@ export interface AppLockAction {
15076
15078
  contractHash: string;
15077
15079
  }
15078
15080
 
15081
+ /**
15082
+ * (api-types 0.176.0, DES-APPS-001 K2b) One argument of a `.json` query text: a declared parameter of the
15083
+ * query, or a literal fixed by the app (a string of at most 1,000 characters). Viewer values are declared on
15084
+ * the query's parameters (`from`), never here.
15085
+ */
15086
+ export type AppQueryArg = { kind: 'param'; name: string } | { kind: 'literal'; value: string | number | boolean | null };
15087
+
15088
+ /**
15089
+ * (api-types 0.176.0) `queries/<id>.json` of a `rest` or `mcp` query: one registry tool the person accepted
15090
+ * as a read on the source sheet, and its arguments (at most 50, each one of the tool's input properties).
15091
+ */
15092
+ export interface AppToolQueryText {
15093
+ tool: string;
15094
+ args: Record<string, AppQueryArg>;
15095
+ }
15096
+
15097
+ /**
15098
+ * (api-types 0.176.0) `queries/<id>.json` of a `crew` query: one route the built-in crew source reads
15099
+ * (`SourceCatalogResponse` of `crew` lists them, e.g. `/runs/:id`), every `:param` of it in `params`, and
15100
+ * query-string values in `query`.
15101
+ */
15102
+ export interface AppCrewQueryText {
15103
+ route: string;
15104
+ params: Record<string, AppQueryArg>;
15105
+ query: Record<string, AppQueryArg>;
15106
+ }
15107
+
15108
+ // How a query's text binds its parameters (api-types 0.176.0): SQL `$n` (Postgres) and the n-th `?` (MySQL,
15109
+ // SQLite) bind the n-th parameter in the order `params.properties` declares them, and every declared
15110
+ // parameter is used; GraphQL variables are the parameters by name; `.json` texts name them in `AppQueryArg`s.
15111
+ // The order is part of the query's contract, so reordering the parameters is checked again.
15112
+
15079
15113
  // ── Apps: the store and its routes (DES §6.4, §7.6, §9.1) ────────────────────────────────────────
15080
15114
 
15081
15115
  /**
@@ -15283,7 +15317,13 @@ export interface AppQueryBody {
15283
15317
  /** One cell: values are rendered as text by the runtime. */
15284
15318
  export type AppCell = string | number | boolean | null;
15285
15319
 
15286
- /** `POST /apps/:app/query` 200 (DES §7.2). `rows` are aligned with `columns`. */
15320
+ /**
15321
+ * `POST /apps/:app/query` 200 (DES §7.2). `rows` are aligned with `columns`, which are exactly the query's
15322
+ * declared output (api-types 0.177.0: values coerced to their declared types; `integer` and `number` cells
15323
+ * are JS numbers within ±2^53; `date` is `YYYY-MM-DD`, `datetime` ISO 8601). `truncated`: a cap cut the
15324
+ * answer (5,000 rows, 10 MB, a cell past 64 KB cut). `hasMore`: the more path says another page exists.
15325
+ * `ms`: this request's time. Identical reads within the query's cache life share one answer.
15326
+ */
15287
15327
  export interface AppQueryResponse {
15288
15328
  columns: AppOutputColumn[];
15289
15329
  rows: AppCell[][];
@@ -15294,6 +15334,151 @@ export interface AppQueryResponse {
15294
15334
  cachedAt: number | null;
15295
15335
  }
15296
15336
 
15337
+ // ── Apps: the write path (api-types 0.178.0, DES-APPS-001 §7.3, §7.4, §9.4, slice K2b) ─────────────────
15338
+
15339
+ /** Where a value on an action card comes from (DES §7.3: "your sign-in", "fixed by the app", "filled by studio: now"). */
15340
+ export type AppActionValueSource = 'param' | 'app' | 'viewer' | 'crew';
15341
+
15342
+ /** One value on a card: the column or argument, the value as it will be sent, and where it comes from. */
15343
+ export interface AppActionCardValue {
15344
+ name: string;
15345
+ /** A list argument shows its items (an array parameter, the viewer's groups). */
15346
+ value: string | number | boolean | null | Array<string | number | boolean>;
15347
+ from: AppActionValueSource;
15348
+ /** The words for `from`: "you entered it", "fixed by the app", "your sign-in", "filled by studio: now". */
15349
+ label: string;
15350
+ }
15351
+
15352
+ /**
15353
+ * The card crew generates from the RESOLVED operation (DES §7.3) and the host draws outside the app's
15354
+ * frame: the only per-run consent. Every value is on it, literals included.
15355
+ */
15356
+ export type AppActionCard =
15357
+ | {
15358
+ kind: 'api';
15359
+ app: string;
15360
+ action: string;
15361
+ source: string;
15362
+ /** The source's kind: `rest`, `mcp-http`, `mcp-stdio` or `graphql`. */
15363
+ sourceKind: string;
15364
+ /** `POST /v1/tickets/4821/assign`, `mutation assign`, or `tool assign_ticket`. */
15365
+ operation: string;
15366
+ args: AppActionCardValue[];
15367
+ /** The request as it will be sent (method and URL and body, the GraphQL document and variables, or the tool call). */
15368
+ request: string;
15369
+ /** The action's description, labelled "The app says" by the host. */
15370
+ appSays?: string;
15371
+ }
15372
+ | {
15373
+ kind: 'row-write';
15374
+ app: string;
15375
+ action: string;
15376
+ source: string;
15377
+ /** The login the write runs as. */
15378
+ login: string;
15379
+ verb: 'INSERT' | 'UPDATE' | 'DELETE';
15380
+ /** Schema-qualified: `support.tickets`. */
15381
+ table: string;
15382
+ /** Every column it sets (an insert: every column of the table), with its value. */
15383
+ columns: AppActionCardValue[];
15384
+ /** The key (`id = 4821`). */
15385
+ key: AppActionCardValue[];
15386
+ /** "exactly 1 row, verified". */
15387
+ rows: string;
15388
+ /** "plain table: no triggers, rules, inheritance or row security; checked just now". */
15389
+ checks: string;
15390
+ /** The statement as it will run (values are its `$n` parameters, listed above). */
15391
+ statement: string;
15392
+ appSays?: string;
15393
+ };
15394
+
15395
+ /** `POST /apps/:app/actions/:id/prepare` (HUMAN operator). `params` are the action's declared, non-viewer parameters. */
15396
+ export interface AppActionPrepareBody {
15397
+ version: number | string;
15398
+ params?: Record<string, unknown>;
15399
+ }
15400
+
15401
+ /** `POST /apps/:app/actions/:id/prepare` 200: the record to run within 2 minutes, and its card. */
15402
+ export interface AppActionPrepareResponse {
15403
+ record: string;
15404
+ card: AppActionCard;
15405
+ /** Unix millis. */
15406
+ expiresAt: number;
15407
+ }
15408
+
15409
+ /** `POST /apps/:app/actions/:id/run` (HUMAN operator, the person who prepared it). */
15410
+ export interface AppActionRunBody {
15411
+ record: string;
15412
+ }
15413
+
15414
+ /**
15415
+ * An action record's states (DES §7.3): `prepared → running → succeeded | failed | unknown`. `running` is the
15416
+ * linearization point (persisted before the upstream call); `unknown` = the outcome could not be known (the
15417
+ * daemon restarted during the call, or the call was sent and no answer came). Nothing is ever re-run.
15418
+ */
15419
+ export type AppActionState = 'prepared' | 'running' | 'succeeded' | 'failed' | 'unknown';
15420
+
15421
+ /** `POST /apps/:app/actions/:id/run` 200: how it ended. */
15422
+ export interface AppActionRunResponse {
15423
+ record: string;
15424
+ state: 'succeeded' | 'failed' | 'unknown';
15425
+ /** Why it failed or is unknown, in crew's words. */
15426
+ reason?: string;
15427
+ /** A row write: `{ table, op, key }`; an API action: the answer, scrubbed and cut at 64 KB. */
15428
+ result?: unknown;
15429
+ }
15430
+
15431
+ /** `GET /apps/:app/actions/records/:id` 200 (the person who prepared it): answers a lost response. */
15432
+ export interface AppActionRecordView {
15433
+ id: string;
15434
+ app: string;
15435
+ action: string;
15436
+ version: number | null;
15437
+ tree: string;
15438
+ state: AppActionState;
15439
+ reason?: string;
15440
+ result?: unknown;
15441
+ card: AppActionCard;
15442
+ createdAt: number;
15443
+ expiresAt: number;
15444
+ endedAt?: number;
15445
+ }
15446
+
15447
+ /** `POST /apps/:app/actions/:id/grant` (HUMAN operator): grant the action as it is in this version. */
15448
+ export interface AppActionGrantBody {
15449
+ version: number | string;
15450
+ }
15451
+
15452
+ /**
15453
+ * A grant (DES §9.4): keyed by app and action, bound to the action hash, the contract hash (a row write's
15454
+ * holds the table's safety fingerprint) and the source descriptor; any change withdraws it. Turning a
15455
+ * source's Allow writes off withdraws its row-write grants.
15456
+ */
15457
+ export interface AppActionGrant {
15458
+ app: string;
15459
+ action: string;
15460
+ kind: 'api' | 'row-write';
15461
+ source: string;
15462
+ actionHash: string;
15463
+ contractHash: string;
15464
+ descriptorHash: string;
15465
+ /** A row write: the table safety check's fingerprint at grant. */
15466
+ fingerprint?: string;
15467
+ grantedBy: Actor;
15468
+ /** Unix millis. */
15469
+ grantedAt: number;
15470
+ }
15471
+
15472
+ /** `POST …/grant` 200 and `GET …/grant` 200 (observer). */
15473
+ export interface AppActionGrantResponse {
15474
+ grant: AppActionGrant;
15475
+ }
15476
+
15477
+ /** `DELETE …/grant` 200: whether a grant was there. */
15478
+ export interface AppActionRevokeResponse {
15479
+ revoked: boolean;
15480
+ }
15481
+
15297
15482
  /** One reason a check refused a tree. `path` is a JSON path into `apps.json`, or a repo path. */
15298
15483
  export interface AppCheckFinding {
15299
15484
  stage: 'spec' | 'files' | 'policy' | 'source';
@@ -15317,6 +15502,26 @@ export interface AppCheckFinding {
15317
15502
  * - 429 `rate_limited` (with `retryAfterMs`: a query queue or a per-viewer rate is full, DES §7.5);
15318
15503
  * - 501 `not_implemented` (a route a later slice serves; nothing happened);
15319
15504
  * - 503 `apps_unavailable`.
15505
+ *
15506
+ * (api-types 0.178.0, K2b) The action routes also answer: 409 `read_only` (`APPS_READ_ONLY` is set: no
15507
+ * write at all), `not_granted` (no grant for the action as it is now; a stale grant is withdrawn and says
15508
+ * so), `writes_off` (the source's Allow writes switch is off), `table_changed` (the row write's table no
15509
+ * longer passes the safety check, or its fingerprint differs from the grant's: the grant is withdrawn),
15510
+ * `value_does_not_fit` (a value its column would change, P28), `record_used` (the record already ran or is
15511
+ * running: nothing is re-run), `record_expired`, `missing_grants` (granting a row write whose login lacks a
15512
+ * privilege the write needs: the message lists the exact `GRANT` statements); 404 `unknown_action`,
15513
+ * `unknown_record`.
15514
+ *
15515
+ * (api-types 0.177.0, K2b) `POST /apps/:app/query` also answers: 400 `bad_params` (a parameter that is not
15516
+ * declared, does not satisfy its schema, is required and missing, or is viewer-bound and was sent); 403
15517
+ * `human_only` for an agent or plugin actor (an app's rows reach a person, never a model); 409
15518
+ * `viewer_unavailable` (a viewer-bound value crew does not know, e.g. no git `user.email` locally, or groups
15519
+ * in local preview), `contract_changed` (the source's connection, or what the query reads there, changed
15520
+ * since this version was checked: check it again), `query_refused` (the read policy or the source's live
15521
+ * relation checks refuse it now); 422 `result_invalid` (a value does not fit its declared column: the
15522
+ * message names the column and row, never the value); 502 `source_failed` / `source_unavailable` (the
15523
+ * source answered an error or could not be reached: a class and a SQLSTATE, never the source's words); 504
15524
+ * `source_timeout` (stopped at the 10 s deadline, at the source).
15320
15525
  */
15321
15526
  export interface AppErrorBody {
15322
15527
  code:
@@ -15342,7 +15547,25 @@ export interface AppErrorBody {
15342
15547
  | 'not_this_turn'
15343
15548
  | 'not_checked'
15344
15549
  | 'reviewer_not_distinct'
15345
- | 'apps_unavailable';
15550
+ | 'apps_unavailable'
15551
+ | 'bad_params'
15552
+ | 'viewer_unavailable'
15553
+ | 'contract_changed'
15554
+ | 'query_refused'
15555
+ | 'result_invalid'
15556
+ | 'source_failed'
15557
+ | 'source_unavailable'
15558
+ | 'source_timeout'
15559
+ | 'read_only'
15560
+ | 'not_granted'
15561
+ | 'writes_off'
15562
+ | 'table_changed'
15563
+ | 'value_does_not_fit'
15564
+ | 'record_used'
15565
+ | 'record_expired'
15566
+ | 'unknown_action'
15567
+ | 'unknown_record'
15568
+ | 'missing_grants';
15346
15569
  error: string;
15347
15570
  /** `rate_limited`: when to try again (also sent as `Retry-After`). */
15348
15571
  retryAfterMs?: number;
@@ -15380,9 +15603,15 @@ export type AppsCheckResponse =
15380
15603
  * serves that route for real rather than answering `501`.
15381
15604
  */
15382
15605
  export interface AppsCapabilities {
15383
- /** `POST /apps/:app/query` runs queries (until then it checks the receipt, then answers `501`). */
15606
+ /**
15607
+ * `POST /apps/:app/query` runs queries (until then it checks the receipt, then answers `501`). True since
15608
+ * api-types 0.177.0 (K2b, the executor).
15609
+ */
15384
15610
  query: boolean;
15385
- /** `POST /apps/:app/actions/:id/prepare|run|grant`, `GET …/actions/records/:id`. */
15611
+ /**
15612
+ * `POST /apps/:app/actions/:id/prepare|run|grant`, `GET|DELETE …/grant`, `GET …/actions/records/:id`. True
15613
+ * since api-types 0.178.0 (K2b, the write path: API actions and Postgres row writes).
15614
+ */
15386
15615
  actions: boolean;
15387
15616
  /** `POST /apps/:app/turns` launches `apps-turn` runs. */
15388
15617
  turns: boolean;
@@ -15390,7 +15619,10 @@ export interface AppsCapabilities {
15390
15619
  publish: boolean;
15391
15620
  /** `POST /apps/uploads`. */
15392
15621
  uploads: boolean;
15393
- /** The read policy and the per-kind source check run, so a change to queries or actions can land. */
15622
+ /**
15623
+ * The read policy and the per-kind source check run, so a change to queries or actions can land (true since
15624
+ * api-types 0.176.0 on a daemon with a connector registry: crew's source stage, DES §9.2 step 3).
15625
+ */
15394
15626
  sourceCheck: boolean;
15395
15627
  }
15396
15628
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wicked-crew-api-types",
3
- "version": "0.175.0",
3
+ "version": "0.178.0",
4
4
  "description": "The wire contract of the wicked-crew daemon's /api/v1 REST surface and /ws CoreEvent frames \u2014 types only, zero runtime",
5
5
  "type": "module",
6
6
  "types": "./index.d.ts",