aegis-platform-sdk 0.1.0 → 1.0.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/CHANGELOG.md +67 -0
- package/README.md +38 -0
- package/dist/cli.js +3640 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.cjs +3797 -63
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1985 -110
- package/dist/index.d.ts +1985 -110
- package/dist/index.js +3715 -62
- package/dist/index.js.map +1 -1
- package/package.json +6 -1
- package/skills/aegis-sdk/SKILL.md +52 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aegis-platform-sdk",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "AEGIS Ontology SDK — typed TypeScript client for the AEGIS HTTPS API (Safe-Core Technologies)",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"author": "Safe-Core Technologies",
|
|
@@ -8,6 +8,9 @@
|
|
|
8
8
|
"main": "./dist/index.cjs",
|
|
9
9
|
"module": "./dist/index.js",
|
|
10
10
|
"types": "./dist/index.d.ts",
|
|
11
|
+
"bin": {
|
|
12
|
+
"aegis-osdk": "./dist/cli.js"
|
|
13
|
+
},
|
|
11
14
|
"exports": {
|
|
12
15
|
".": {
|
|
13
16
|
"types": "./dist/index.d.ts",
|
|
@@ -31,6 +34,7 @@
|
|
|
31
34
|
"typecheck": "tsc --noEmit",
|
|
32
35
|
"test": "vitest run",
|
|
33
36
|
"test:watch": "vitest",
|
|
37
|
+
"docs": "typedoc src/index.ts --out docs/api",
|
|
34
38
|
"prepublishOnly": "npm run typecheck && npm run test && npm run build"
|
|
35
39
|
},
|
|
36
40
|
"repository": {
|
|
@@ -47,6 +51,7 @@
|
|
|
47
51
|
"devDependencies": {
|
|
48
52
|
"@types/node": "^22.10.0",
|
|
49
53
|
"tsup": "^8.3.5",
|
|
54
|
+
"typedoc": "^0.28.20",
|
|
50
55
|
"typescript": "^5.7.2",
|
|
51
56
|
"vitest": "^3.0.0"
|
|
52
57
|
}
|
|
@@ -48,7 +48,41 @@ const client = new AegisClient({
|
|
|
48
48
|
Server-side only for secrets: in browser apps, never embed an `osdk_…`
|
|
49
49
|
token — proxy through your backend or use the login flow.
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
**Proxy mode** (cookie-auth frontends — e.g. a Next.js app whose `/api/*`
|
|
52
|
+
routes inject the Bearer from an httpOnly cookie): relative `baseUrl` +
|
|
53
|
+
`fetchInit`, no token in JS:
|
|
54
|
+
|
|
55
|
+
```ts
|
|
56
|
+
export const aegis = new AegisClient({
|
|
57
|
+
baseUrl: "/api",
|
|
58
|
+
fetchInit: { credentials: "include", cache: "no-store" },
|
|
59
|
+
});
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## OSDK codegen (typed ontology objects)
|
|
63
|
+
|
|
64
|
+
`npx aegis-osdk generate --lang typescript` (env `AEGIS_API_URL`/`AEGIS_TOKEN`
|
|
65
|
+
or `--base-url`/`--token`) writes a typed module from the LIVE ontology —
|
|
66
|
+
one interface per Object Type + a `Functions` class. Wire it with
|
|
67
|
+
`asOsdkClient(client)`. Regenerate when the ontology contract changes
|
|
68
|
+
(the file header carries the contract version). `npx aegis-osdk manifest`
|
|
69
|
+
dumps the raw manifest JSON.
|
|
70
|
+
|
|
71
|
+
## Hardening (v1.0)
|
|
72
|
+
|
|
73
|
+
- **Typed results, no casts**: every direct resource method takes a type
|
|
74
|
+
parameter — `client.geo.nodes<GeoNodesOut>(opts)`, `client.ontology.objects.list<Camera>("Camera")`.
|
|
75
|
+
Default `T = Json` when omitted.
|
|
76
|
+
- **Retry**: transient failures (network/timeout/429/502/503/504) auto-retry
|
|
77
|
+
with backoff on GET/HEAD (2 retries default). Tune via `retry` option;
|
|
78
|
+
`{retries: 0}` disables; `retryPost: true` extends to writes (only when
|
|
79
|
+
the endpoint is idempotent!).
|
|
80
|
+
- **JWT refresh**: after `auth.login`, a 401 transparently rotates the
|
|
81
|
+
refresh token (`POST /auth/refresh`) and retries once — no manual
|
|
82
|
+
re-login loops needed. OSDK tokens (`osdk_…`) don't refresh — rotate via
|
|
83
|
+
`client.osdk.rotate`.
|
|
84
|
+
|
|
85
|
+
## Resource surface (v1.0 — full parity with the Python SDK)
|
|
52
86
|
|
|
53
87
|
- `client.auth` — `login`, `me` (WhoAmI: roles/permissions/tenant), `enableDevMode`
|
|
54
88
|
- `client.iam` — `users.list/get`, `roles.list/get`, `groups` CRUD + members, `permissions.list(resource?)`, `nav.tree(asRoleId?)`
|
|
@@ -63,9 +97,26 @@ token — proxy through your backend or use the login flow.
|
|
|
63
97
|
- `client.functions` — Code Functions: CRUD, `invoke(slug, inputs)`, tests, `publish`, `versions`, pull-request lifecycle + CI
|
|
64
98
|
- `client.codeRepositories` — repos, branches, CI, merge
|
|
65
99
|
- `client.datasets` — `list/get/sample`, branches, transactions (`beginTransaction(name, "SNAPSHOT"|"APPEND"|"UPDATE"|"DELETE")` → `commitTransaction`/`abortTransaction`), `mergeFastForward`/`mergeThreeWay`, classification, markings
|
|
100
|
+
- **Reading**: `client.geo` (nodes/nodeTypes/sources/edges/zones), `client.mapTemplates` (list/get/create/instantiate/exportSvg), `client.media` (sets + item metadata), `client.docs` (tree/read), `client.pages` (registry CRUD/publish), `client.dossier` (startGeneric/startComposite → poll `get`), `client.timeseries` (charts + render)
|
|
101
|
+
- **Operational**: `client.alerts` (`feeds`/`watches`/`geofences`/`shares`/`routes` incl. silence/`inbox` + `escalate`/`channels`), `client.alarms` (threshold rules), `client.events` (pipelineStatus + DLQ retry/purge), `client.connectors` (list/patch/register/test/run/skillCatalog), `client.pipelines` (CRUD/build/runs/previews), `client.chat` (channels/messages), `client.notepad`
|
|
102
|
+
- **Governance**: `client.lineage` (graph/events), `client.accessAudit`, `client.markings` (+`categories`, eligibility), `client.resourceMarkings`, `client.propertyMarkings`, `client.rowPolicies`, `client.erasure` (ALWAYS `preview` before `forget`; `forget` needs `confirm:true`), `client.retention`, `client.guestTokens` (issue returns plaintext once)
|
|
103
|
+
- **Platform**: `client.workshop` (`briefings`/`dossiers`/`covs`/`widgetCatalog` — no apps/widgets CRUD, by design), `client.compute` (`providers`/`releases`/selectModel/visionCount + `control(providerId)` scoped plane), `client.inference` (complete/chat/chatWithRag/models/auditTrail — server-audited LLM), `client.codegen`, `client.correlation` (quickLinks/startChain→getChain→saveChain), `client.situational` (nearby/correlate/cut), `client.merge` (suggestTarget/preview/apply)
|
|
104
|
+
- **Domain**: `client.atlas` (layers/KML/evaluator), `client.briefing`, `client.cctv` (streams/detections/recordings/exports/bookmarks/gcps/hotlist; `recordingsPlaylist` returns raw m3u8 text), `client.edge` (pairing codes/fleet version), `client.video`, `client.comunicados`, `client.campaign.briefing`
|
|
105
|
+
- **Collaboration**: `client.forms` (governed submissions), `client.appShell` (banner/footer/userMenu/sidenav/homepage get/put), `client.groups`, `client.projects` (move + `constraints`), `client.organizations`, `client.spaces`, `client.solutions` (design→materialize→teardown; marketplace listings), `client.workspaces` (+`versions`, navigation, promotions, kiosk), `client.workspaceUpdates`, `client.marketplace` (storefront/install wizard)
|
|
106
|
+
- **Versioned surfaces** (`client.platformV22`…`platformV26`): action-log/quiver/usage (v22); aip-logic/action-types/assist/automate/health/contour/vertex/repos/object-sets/styles incl. `styles.uploadLogo` multipart (v23); rules/checkpoints/expectations/change-requests/scenarios/searchAround/aggregateObjectSet (v24); machinery/branch-protection/kiosk/analyst/dataset rollback/freshness/code-scan/evals (v25); promotions/object-views/capacity/listeners/scanner/monitoring/health-checks/insight/peers/run-history (v26)
|
|
107
|
+
- **SSE streaming**: `for await (const ev of client.stream(path, {params, json, signal}))` — yields `{event, data, id?, retry?}`; pass `signal` to cancel (no default timeout). `parseSseStream` is exported for custom transports.
|
|
108
|
+
- **Static catalogs (no HTTP)**: `NAV_PERMISSIONS`/`CAPABILITY_PERMISSIONS`/`ALL_PERMISSIONS` + `PermissionKey` union + `isSystemPermission()` — reference permission keys statically, never hardcode strings; `APPLICATIONS`/`applicationBySlug()` — OSDK app permission scopes for `osdk.create`.
|
|
109
|
+
- Client-side helpers (no HTTP): `maxLevel`, `validateInvariant`, `CLASSIFICATION_RANK` — validate the classification invariant before writes.
|
|
66
110
|
|
|
67
111
|
## Conventions
|
|
68
112
|
|
|
113
|
+
- **Declare request-body shapes with `type`, not `interface`**: SDK input
|
|
114
|
+
params are typed `Json` (`Record<string, unknown>`); TS gives object
|
|
115
|
+
`type` aliases an implicit index signature (assignable to `Json`) but
|
|
116
|
+
NOT interfaces — an `interface` argument fails with "Index signature
|
|
117
|
+
for type 'string' is missing". Result shapes can be either (they flow
|
|
118
|
+
through the generic, not assignability).
|
|
119
|
+
|
|
69
120
|
- Wire fields are `snake_case` (backend-shaped); SDK method names are
|
|
70
121
|
`camelCase`. Request bodies you build use snake_case keys (e.g.
|
|
71
122
|
`{ prompt_text, project_id }`).
|