aegis-platform-sdk 1.0.0 → 1.3.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 CHANGED
@@ -83,6 +83,7 @@ __export(index_exports, {
83
83
  PlatformV26Resource: () => PlatformV26Resource,
84
84
  ProjectsResource: () => ProjectsResource,
85
85
  PropertyMarkingsResource: () => PropertyMarkingsResource,
86
+ PublicGuestResource: () => PublicGuestResource,
86
87
  ResourceMarkingsResource: () => ResourceMarkingsResource,
87
88
  RetentionResource: () => RetentionResource,
88
89
  RowPoliciesResource: () => RowPoliciesResource,
@@ -861,6 +862,44 @@ var GeoResource = class {
861
862
  deleteZone(zoneId) {
862
863
  return this.t.request("DELETE", `/api/v1/geo/zones/${zoneId}`);
863
864
  }
865
+ // ── Reference Layer Builder (the AEGIS "My Maps") ──────────────────────
866
+ //
867
+ // Each layer is one editable dataset + one DAG board + one dedicated
868
+ // node_type. Publishing runs the board; the materialized nodes show up on
869
+ // their own under the map's "Reference layers" tab.
870
+ // Read: `security.geo.view`; write: `security.geo.camada.manage`.
871
+ /** Builder layers of the tenant, grouped by "map" (the project). */
872
+ layers() {
873
+ return this.t.request("GET", "/api/v1/geo/layers");
874
+ }
875
+ /** Creates a layer (empty inline dataset + published board). The
876
+ * `node_type` derives from the name and is IMMUTABLE. */
877
+ createLayer(input) {
878
+ return this.t.request("POST", "/api/v1/geo/layers", { json: input });
879
+ }
880
+ layerFeatures(boardId) {
881
+ return this.t.request("GET", `/api/v1/geo/layers/${boardId}/features`);
882
+ }
883
+ /** Saves the drawing as a versioned SNAPSHOT. `geometry` is GeoJSON
884
+ * `[lng,lat]`; `geo_style` travels PER FEATURE (colour/alpha/extrusion). */
885
+ saveLayerFeatures(boardId, rows) {
886
+ return this.t.request("PUT", `/api/v1/geo/layers/${boardId}/features`, {
887
+ json: { rows }
888
+ });
889
+ }
890
+ /** Runs the board and RECONCILES — a feature deleted in the builder leaves
891
+ * the map (the engine is upsert-only). */
892
+ publishLayer(boardId) {
893
+ return this.t.request("POST", `/api/v1/geo/layers/${boardId}/publish`);
894
+ }
895
+ /** Renames / regroups. Never changes the `node_type`; `mapa: ""` ungroups. */
896
+ patchLayer(boardId, changes) {
897
+ return this.t.request("PATCH", `/api/v1/geo/layers/${boardId}`, { json: changes });
898
+ }
899
+ /** Deletes the whole layer: materialized nodes + dataset + board. */
900
+ deleteLayer(boardId) {
901
+ return this.t.request("DELETE", `/api/v1/geo/layers/${boardId}`);
902
+ }
864
903
  };
865
904
  var MapTemplatesResource = class {
866
905
  constructor(t) {
@@ -998,6 +1037,82 @@ var TimeSeriesResource = class {
998
1037
  }
999
1038
  };
1000
1039
 
1040
+ // src/resources/publicGuest.ts
1041
+ var PublicGuestResource = class {
1042
+ constructor(t) {
1043
+ this.t = t;
1044
+ }
1045
+ t;
1046
+ base(token) {
1047
+ return `/public/v1/guest/${encodeURIComponent(token)}`;
1048
+ }
1049
+ /** Menu/resumo do token: label, subject, status, geo, ações permitidas. */
1050
+ menu(token) {
1051
+ return this.t.request("GET", this.base(token));
1052
+ }
1053
+ /** Reporta uma posição GPS; o backend avalia cerca/rota/destino. */
1054
+ fix(token, body) {
1055
+ return this.t.request("POST", `${this.base(token)}/fix`, { json: body });
1056
+ }
1057
+ /** Invoca uma ação permitida do token (ex.: abrir portão). */
1058
+ invoke(token, actionId, input = {}) {
1059
+ return this.t.request(
1060
+ "POST",
1061
+ `${this.base(token)}/actions/${encodeURIComponent(actionId)}`,
1062
+ { json: { input } }
1063
+ );
1064
+ }
1065
+ /**
1066
+ * Onda 2 — última posição do VISITANTE amarrado a um token de MORADOR
1067
+ * (`geo.live_ref`). Sem push: a SPA do morador faz polling desta rota. O
1068
+ * morador só vê ESSA visita (least-privilege). Retorna `{available, lat,
1069
+ * lng, ts, inside_fence, arrived, deviated, distance_to_target_m,
1070
+ * visit_status}`; `available:false` enquanto o visitante não mandou fix.
1071
+ */
1072
+ position(token) {
1073
+ return this.t.request("GET", `${this.base(token)}/position`);
1074
+ }
1075
+ /** Documento vinculado ao token (se `geo.document_id`). */
1076
+ document(token) {
1077
+ return this.t.request("GET", `${this.base(token)}/document`);
1078
+ }
1079
+ /** Consulta um object-set embutido no documento do token. */
1080
+ queryObjectSet(token, body) {
1081
+ return this.t.request(
1082
+ "POST",
1083
+ `${this.base(token)}/document/object-sets/query`,
1084
+ { json: body }
1085
+ );
1086
+ }
1087
+ /** Um nó da ontologia referenciado pelo documento (mascarado por ABAC). */
1088
+ documentNode(token, nodeId) {
1089
+ return this.t.request("GET", `${this.base(token)}/document/node`, {
1090
+ params: { node_id: nodeId }
1091
+ });
1092
+ }
1093
+ /** Descritor da Page vinculada ao token (`geo.page_slug`). */
1094
+ page(token, slug) {
1095
+ return this.t.request("GET", `${this.base(token)}/pages/${encodeURIComponent(slug)}`);
1096
+ }
1097
+ /** Avalia as variáveis da Page (com overrides só de variáveis estáticas). */
1098
+ evaluatePage(token, slug, overrides = {}) {
1099
+ return this.t.request(
1100
+ "POST",
1101
+ `${this.base(token)}/pages/${encodeURIComponent(slug)}/evaluate`,
1102
+ { json: { overrides } }
1103
+ );
1104
+ }
1105
+ /**
1106
+ * URL absoluta de um objeto de mídia do documento (bytes servidos com
1107
+ * `Cache-Control: private`). Retorna string p/ `<img src>`/`<a href>` —
1108
+ * NÃO faz request (o transporte é JSON-cêntrico). A `key` deve começar
1109
+ * com `notepad/{doc_id}/` (validado no backend).
1110
+ */
1111
+ mediaUrl(token, key) {
1112
+ return buildUrl(this.t.baseUrl, `${this.base(token)}/media`, { key });
1113
+ }
1114
+ };
1115
+
1001
1116
  // src/resources/operational.ts
1002
1117
  var AlertFeedsResource = class {
1003
1118
  constructor(t) {
@@ -1159,6 +1274,31 @@ var AlertsResource = class {
1159
1274
  channels() {
1160
1275
  return this.t.request("GET", "/alerts/channels");
1161
1276
  }
1277
+ /**
1278
+ * `PUT /alerts/channels/{ref}` — point a delivery channel at its
1279
+ * destination.
1280
+ *
1281
+ * Exists so this is a GESTURE: before it, sending alerts to the team's
1282
+ * Discord (or any webhook) meant editing the tenant's JSONB in the
1283
+ * database. Audited as `alert_channel.configured`.
1284
+ *
1285
+ * `ref` is the channel name (`"discord"`) or a named ref
1286
+ * (`"discord-plantao"`, then pass `channel: "discord"`). Fields are open
1287
+ * because the vocabulary belongs to the CHANNEL, not the core.
1288
+ *
1289
+ * The response returns the config MASKED — a webhook URL is the
1290
+ * credential, and reads never hand it back whole.
1291
+ * Perm: `alerts.routes.manage`.
1292
+ */
1293
+ setChannel(ref, config) {
1294
+ return this.t.request("PUT", `/alerts/channels/${encodeURIComponent(ref)}`, {
1295
+ json: config
1296
+ });
1297
+ }
1298
+ /** `DELETE /alerts/channels/{ref}` — audited as `alert_channel.removed`. */
1299
+ deleteChannel(ref) {
1300
+ return this.t.request("DELETE", `/alerts/channels/${encodeURIComponent(ref)}`);
1301
+ }
1162
1302
  };
1163
1303
  var AlarmsResource = class {
1164
1304
  constructor(t) {
@@ -1265,10 +1405,43 @@ var ConnectorsResource = class {
1265
1405
  json: { skill_key: "connector.http" }
1266
1406
  });
1267
1407
  }
1408
+ /**
1409
+ * Start/renew QR pairing for a skill with the `pairing` capability (WhatsApp
1410
+ * station). Pass `{ refresh: true }` to force a fresh code.
1411
+ */
1412
+ pairingStart(agentId, skillKey, opts = {}) {
1413
+ const { target, ...json } = opts;
1414
+ return this.t.request("POST", `/governance/agents/${agentId}/skills/${skillKey}/pairing`, {
1415
+ json,
1416
+ params: target ? { target } : void 0
1417
+ });
1418
+ }
1419
+ /** Read-only poll of the pairing state (no side effects). `target` aims a pool number. */
1420
+ pairingPoll(agentId, skillKey, opts = {}) {
1421
+ return this.t.request("GET", `/governance/agents/${agentId}/skills/${skillKey}/pairing`, {
1422
+ params: opts.target ? { target: opts.target } : void 0
1423
+ });
1424
+ }
1425
+ /**
1426
+ * Add / correct / remove a sub-unit administered by a connector that
1427
+ * declares the `inventory` capability — e.g. one number of a WhatsApp
1428
+ * number-station.
1429
+ *
1430
+ * Reading is NOT here: the inventory already reaches callers through the
1431
+ * snapshot the tick publishes on the device mirror (`GET /api/v1/edge/nodes`
1432
+ * → `nodes[].pool`). A second read path would drift between ticks.
1433
+ */
1434
+ applyInventory(agentId, skillKey, op, item) {
1435
+ return this.t.request(
1436
+ "POST",
1437
+ `/governance/agents/${agentId}/skills/${skillKey}/inventory`,
1438
+ { json: { op, item } }
1439
+ );
1440
+ }
1268
1441
  schedulerTick() {
1269
1442
  return this.t.request("POST", "/governance/agents/scheduler/tick");
1270
1443
  }
1271
- /** source ∈ native|clawhub */
1444
+ /** source ∈ native|clawhub. Rows carry an additive `capabilities` field. */
1272
1445
  skillCatalog(source) {
1273
1446
  return this.t.request("GET", "/governance/agents/skills", { params: { source } });
1274
1447
  }
@@ -2112,9 +2285,24 @@ var EdgeResource = class {
2112
2285
  this.t = t;
2113
2286
  }
2114
2287
  t;
2288
+ /**
2289
+ * Issue a single-use pairing code (short TTL). The plaintext `code` appears
2290
+ * ONLY in this response (hash at rest).
2291
+ *
2292
+ * `grants` GRANTS gestures to whichever device redeems the code (allowlist;
2293
+ * today `["retry"]`, so a desk app can ask the station to reconnect a
2294
+ * number). Empty — the default — is **read only**: least privilege, and
2295
+ * granting has to be a choice. The grant travels from the code to the node
2296
+ * and dies with it on `revoke`.
2297
+ *
2298
+ * Even when granted, the device never receives the gesture's ADDRESS
2299
+ * (`agent_id`/`skill_key`): it sends the verb and the server routes it.
2300
+ * Perm: `connectors.manage`.
2301
+ */
2115
2302
  createPairingCode(opts = {}) {
2116
2303
  return this.t.request("POST", "/api/v1/edge/pairing-codes", { json: opts });
2117
2304
  }
2305
+ /** Nodes carry an additive `kind` field — see {@link EdgeNode}. */
2118
2306
  listNodes() {
2119
2307
  return this.t.request("GET", "/api/v1/edge/nodes");
2120
2308
  }
@@ -3403,6 +3591,8 @@ var AegisClient = class {
3403
3591
  pages;
3404
3592
  dossier;
3405
3593
  timeseries;
3594
+ /** Public guest-token consumer surface (`/public/v1/guest/{token}/*`). */
3595
+ publicGuest;
3406
3596
  // Operational
3407
3597
  alerts;
3408
3598
  alarms;
@@ -3488,6 +3678,7 @@ var AegisClient = class {
3488
3678
  this.pages = new PagesResource(this);
3489
3679
  this.dossier = new DossierResource(this);
3490
3680
  this.timeseries = new TimeSeriesResource(this);
3681
+ this.publicGuest = new PublicGuestResource(this);
3491
3682
  this.alerts = new AlertsResource(this);
3492
3683
  this.alarms = new AlarmsResource(this);
3493
3684
  this.events = new EventsResource(this);
@@ -4426,6 +4617,7 @@ function asOsdkClient(client) {
4426
4617
  PlatformV26Resource,
4427
4618
  ProjectsResource,
4428
4619
  PropertyMarkingsResource,
4620
+ PublicGuestResource,
4429
4621
  ResourceMarkingsResource,
4430
4622
  RetentionResource,
4431
4623
  RowPoliciesResource,