@withgateway/sdk 0.2.1 → 0.2.2

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.
@@ -581,7 +581,11 @@ class ToolsWorld:
581
581
  rows = args.get("rows")
582
582
  mode = args.get("mode", "append")
583
583
  if not isinstance(rows, dict):
584
- fail("host", "seed needs args.rows as {entity: [row, ...]}")
584
+ fail(
585
+ "host",
586
+ 'seed needs rows as {"rows": {entity: [row, ...]}, "mode": "append"|"replace"}; '
587
+ "a dependency's entity is named alias.entity",
588
+ )
585
589
  by_world: dict[int, tuple[World, dict[str, Any], str]] = {}
586
590
  for entity, entity_rows in rows.items():
587
591
  world, local = self._world_of(entity)
@@ -233,8 +233,8 @@ def equal(left: Any, right: Any) -> bool:
233
233
  def validate(schema: dict, value: Any, *, location: str = "", path: str = "") -> None:
234
234
  json_value(value, path)
235
235
 
236
- def error(code: str, message: str, keyword: str = "") -> NoReturn:
237
- fail(code, message, f"{location}/{keyword}" if keyword else location, path=path)
236
+ def error(code: str, message: str, keyword: str = "", **context: Any) -> NoReturn:
237
+ fail(code, message, f"{location}/{keyword}" if keyword else location, path=path, **context)
238
238
 
239
239
  expected = schema.get("type")
240
240
  types = expected if isinstance(expected, list) else [expected] if expected else []
@@ -275,7 +275,7 @@ def validate(schema: dict, value: Any, *, location: str = "", path: str = "") ->
275
275
  properties = schema.get("properties", {})
276
276
  for name in schema.get("required", []):
277
277
  if name not in value:
278
- error("required", f"Missing required property {name}", "required")
278
+ error("required", f"Missing required property {name}", "required", property=name)
279
279
  for name, item in value.items():
280
280
  if name in properties:
281
281
  validate(
@@ -289,6 +289,7 @@ def validate(schema: dict, value: Any, *, location: str = "", path: str = "") ->
289
289
  "additionalProperties",
290
290
  f"Unknown property {name}",
291
291
  "additionalProperties",
292
+ property=name,
292
293
  )
293
294
  elif isinstance(schema.get("additionalProperties"), dict):
294
295
  # A schema-valued additionalProperties types a map: every
@@ -244,12 +244,15 @@ crm-bench/
244
244
  Entities, tools and routes: `worlds-getting-started` §2 and `connector-schema-authoring`. Tasks:
245
245
 
246
246
  ```bash
247
+ gateway worlds schema verifier add ./crm-bench ticket_closed --entity crm_tickets --where "id = 'T-7' AND status = 'closed'"
247
248
  gateway worlds schema task add ./crm-bench close_ticket --prompt "Close ticket T-7 and note the reason." --verifier ticket_closed
248
249
  gateway worlds schema task add ./crm-bench escalate --prompt "..." --verifier state_present --world slack=state_present
249
250
  ```
250
251
 
251
252
  - `--prompt` is what the agent is told. `--verifier <name>` names `verifiers/<name>.sql`; it must
252
- exist. Each verifier becomes a key in `rewards`; `reward` is their mean.
253
+ exist — `schema verifier add <dir> <name> --entity <entity> [--where "<sql condition>"]` scaffolds
254
+ it (without `--where`, the `state_present` placeholder). Each verifier becomes a key in `rewards`;
255
+ `reward` is their mean.
253
256
  - A verifier is one SQL statement returning one number in 0..1 over the world's tables (entity
254
257
  names from `schema/world.json`): `SELECT CASE WHEN COUNT(*) > 0 THEN 1.0 ELSE 0.0 END FROM
255
258
  "crm_tickets" WHERE id = 'T-7' AND status = 'closed';`