@aaes-ai/govern-sdk 0.0.0-stage → 0.2.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 +52 -0
- package/README.md +55 -2
- package/aaes.d.mts +180 -0
- package/aaes.mjs +1722 -0
- package/package.json +40 -4
- package/wire.d.ts +78 -0
package/package.json
CHANGED
|
@@ -1,6 +1,42 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aaes-ai/govern-sdk",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "TypeScript/JavaScript SDK for AAES — the AI governance platform for the action layer: permissions, human approvals, and spending limits on routed agent actions",
|
|
5
|
+
"license": "LicenseRef-AAES-Proprietary",
|
|
6
|
+
"keywords": ["aaes", "ai-governance", "agentic-ai", "agent-governance", "ai-agents", "agent-permissions", "human-approval", "spending-limits", "audit-trail"],
|
|
7
|
+
"type": "module",
|
|
8
|
+
"main": "./aaes.mjs",
|
|
9
|
+
"types": "./aaes.d.mts",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./aaes.d.mts",
|
|
13
|
+
"import": "./aaes.mjs"
|
|
14
|
+
},
|
|
15
|
+
"./wire": {
|
|
16
|
+
"types": "./wire.d.ts"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"aaes.mjs",
|
|
21
|
+
"aaes.d.mts",
|
|
22
|
+
"wire.d.ts",
|
|
23
|
+
"README.md",
|
|
24
|
+
"CHANGELOG.md"
|
|
25
|
+
],
|
|
26
|
+
"engines": {
|
|
27
|
+
"node": ">=18"
|
|
28
|
+
},
|
|
29
|
+
"repository": {
|
|
30
|
+
"type": "git",
|
|
31
|
+
"url": "git+https://github.com/aaes-ai/aaes.git",
|
|
32
|
+
"directory": "sdk/typescript"
|
|
33
|
+
},
|
|
34
|
+
"homepage": "https://aaes.ai/developers/sdks.html",
|
|
35
|
+
"bugs": "https://github.com/aaes-ai/aaes/issues",
|
|
36
|
+
"publishConfig": {
|
|
37
|
+
"access": "public"
|
|
38
|
+
},
|
|
39
|
+
"scripts": {
|
|
40
|
+
"test": "node --test *.test.mjs"
|
|
41
|
+
}
|
|
42
|
+
}
|
package/wire.d.ts
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
// Wire response shapes from api/openapi.yaml. These retain daemon field names.
|
|
2
|
+
export type ModelRequest = { "model": string; "stream"?: boolean; };
|
|
3
|
+
export type ModelUsage = { "input_tokens": number; "output_tokens": number; "total_tokens": number; "settled_minor": number; "currency": string; "estimated"?: true; };
|
|
4
|
+
export type ModelListOpenAI = { "object": "list"; "data": Array<{ "id": string; "object": "model"; "created": number; "owned_by": "aaes-govern"; }>; };
|
|
5
|
+
export type ModelListAnthropic = { "data": Array<{ "type": "model"; "id": string; "display_name": string; "created_at": string; }>; "has_more": false; "first_id": string | null; "last_id": string | null; };
|
|
6
|
+
export type ModelResponse = Record<string, unknown>;
|
|
7
|
+
export type AnthropicError = { "type": "error"; "error": { "type": "authentication_error" | "permission_error" | "rate_limit_error" | "request_too_large" | "invalid_request_error" | "api_error"; "message": string; }; };
|
|
8
|
+
export type OpenAIError = { "error": { "message": string; "type": "invalid_request_error" | "permission_error" | "insufficient_quota" | "api_error"; "param"?: string | null; "code": "invalid_api_key" | "govern_refused" | "govern_approval_required" | "insufficient_quota" | "request_too_large" | "invalid_request" | "upstream_error" | "govern_unavailable"; }; };
|
|
9
|
+
export type ExecutionConstraints = { "business_id": string; "purpose": string; "configuration_hash": string; "policy_bundle_hash": string; "actor_ids": Array<string>; "steps": Array<ExecutionStep>; };
|
|
10
|
+
export type ExecutionStep = { "step_id": string; "capability_hash": string; "capability_id": string; "version": string; "action": "read" | "write" | "create" | "update" | "delete" | "send" | "execute" | "pay" | "deploy" | "invoke" | "approve" | "share" | "transfer"; "resource_id": string; "endpoint": string; "method": string; "payload_hash": string; "amount": { "minor": number; "currency"?: string; }; "require_scoped_delegation"?: boolean; "require_human_approval"?: boolean; "prerequisites"?: Array<string>; };
|
|
11
|
+
export type ExecutionContext = { "root_task_id": string; "constraints": ExecutionConstraints; "constraints_hash": string; "reservations": Record<string, unknown>; };
|
|
12
|
+
export type Refusal = { "reason": string; "remedy"?: string; };
|
|
13
|
+
export type IntegrationCredentialRef = { "path": string; "version"?: string; "key"?: string; };
|
|
14
|
+
export type IntegrationCheckRequest = { "surface": string; "credential": IntegrationCredentialRef; };
|
|
15
|
+
export type IntegrationCheckResponse = { "surface": string; "reached": boolean; "detail": string; "note": string; };
|
|
16
|
+
export type IntegrationRotateRequest = { "surface": string; "secret_ref_id"?: string; "from": IntegrationCredentialRef; "to": IntegrationCredentialRef; };
|
|
17
|
+
export type IntegrationRotateResponse = { "surface": string; "from": string; "to": string; "at": string; "authority": string; "note": string; "also_retired"?: string; };
|
|
18
|
+
export type IntegrationRevokeRequest = { "surface": string; "reason"?: string; };
|
|
19
|
+
export type IntegrationRevokeResponse = { "surface": string; "at": string; "authority": string; "reason": string; "note": string; };
|
|
20
|
+
export type MeteringError = { "error": string; };
|
|
21
|
+
export type LicenseStatus = { "state": string; "label": string; "reason": string; "warning": boolean; "persistent": boolean; "governance": string; "checked_at": string; "license": Record<string, unknown> | null; "usage": Record<string, unknown> | null; };
|
|
22
|
+
export type UsageSummary = { "period": Record<string, unknown>; "index": "ok" | "unknown"; "governed_decisions": number; "records": Record<string, unknown>; "dedupe": "full" | "partial"; "retention_inside_period": boolean; "term": Record<string, unknown> | null; };
|
|
23
|
+
export type IntegrationOpsError = { "error": string; };
|
|
24
|
+
export type ActionRequest = { "tenant_id": string; "actor_id": string; "caller_task_id"?: string; "task_id"?: string; "effect_key_step"?: string; "capability": string; "tier": "R0" | "R1" | "R2" | "R3" | "R4" | number; "action"?: string; "correlation_id"?: string; "parent_intent_id"?: string; "contract_id"?: string; "model"?: string; "amount_minor": number; "amount_currency"?: string; "grant_ttl_ms"?: number; "provenance_status"?: "asserted" | "unknown"; "external_refs"?: Array<ExternalRef>; "payload"?: unknown; };
|
|
25
|
+
export type ExternalRef = { "registry": string; "kind": string; "value": string; "source": "registered"; };
|
|
26
|
+
export type Grant = { "grant_id": string; "actor_id": string; "tenant_id": string; "capability": string; "tier": string; "task_id"?: string; "issued_at": string; "expires_at": string; "ttl_seconds": number; "spend_cap_minor"?: number; "spend_cap_currency"?: string; "non_transferable": true; "budget_grant_id"?: string; "issuer"?: string; "signature"?: string; };
|
|
27
|
+
export type GrantPresentRequest = { "grant_id": string; };
|
|
28
|
+
export type GrantPresentView = { "grant_id": string; "actor_id": string; "tenant_id": string; "capability": string; "tier": string; "task_id"?: string; "issued_at": string; "expires_at": string; "spend_cap_minor"?: number; "spend_cap_currency"?: string; };
|
|
29
|
+
export type GrantReceiptRequest = { "grant_id": string; "executed"?: boolean; "rail_confirmed"?: boolean; };
|
|
30
|
+
export type GrantReceiptView = { "grant_id": string; "intent_id": string; "executed": boolean; "rail_confirmed": boolean; "receipt": Receipt; };
|
|
31
|
+
export type Receipt = { "receipt_id"?: string; "intent_id"?: string; "tenant_id"?: string; "task_id"?: string; "approval_id"?: string; "custody"?: string; "grant_id"?: string; "effect_id"?: string; "effect"?: string; "record_hash"?: string; "issued_at"?: string; "class"?: number; "rail_confirmed"?: boolean; "confirmed_at"?: string; "reported_by"?: string; "reported_at"?: string; "observed_at"?: string; "reported_outcome"?: string; "note"?: string; "result_mode"?: "inline_bounded" | "rendezvous"; "payload_returned"?: boolean; "result_bytes"?: number; "result_content_type"?: string; "result_digest"?: string; "result_resource_id"?: string; "receipt_hash"?: string; "policy_bundle_hash"?: string; "input_hash"?: string; "engine_version"?: string; "model_usage"?: ModelUsage; };
|
|
32
|
+
export type ActionResponse = { "allowed": boolean; "approval_id"?: string; "approval_state"?: "pending" | "raised"; "approval_expires_at"?: string; "deferred"?: boolean; "reason"?: string; "intent_id"?: string; "grant"?: Grant; "receipt"?: Receipt; "latency_added_ms": number; };
|
|
33
|
+
export type BrokeredRequest = { "tenant_id": string; "actor_id": string; "caller_task_id"?: string; "task_id"?: string; "effect_key_step"?: string; "capability": string; "tier": "R0" | "R1" | "R2" | "R3" | "R4" | number; "action"?: string; "correlation_id"?: string; "parent_intent_id"?: string; "contract_id"?: string; "model"?: string; "provenance_status"?: "asserted" | "unknown"; "amount_minor": number; "amount_currency"?: string; "grant_ttl_ms"?: number; "external_refs"?: Array<ExternalRef>; "payload"?: unknown; };
|
|
34
|
+
export type Outcome = { "executed": boolean; "status_code"?: number; "rail_effect_id"?: string; "rail_confirmed": boolean; "latency_added_ms": number; "response_digest"?: string; "result"?: { "mode": "inline_bounded"; "content_type": string; "bytes": number; "digest"?: string; "body_base64"?: string; }; "result_resource_id"?: string; };
|
|
35
|
+
export type BrokeredResponse = { "allowed": boolean; "approval_id"?: string; "approval_state"?: "pending" | "raised"; "approval_expires_at"?: string; "deferred"?: boolean; "reason"?: string; "intent_id"?: string; "grant"?: Grant; "receipt"?: Receipt; "latency_added_ms": number; "outcome": Outcome; };
|
|
36
|
+
export type FederateRequest = { "capability": string; "action"?: string; "task_id": string; "effect_key_step": string; "amount_minor": number; "amount_currency"?: string; "grant_ttl_ms"?: number; "rotate"?: boolean; "correlation_id"?: string; };
|
|
37
|
+
export type FederateResponse = { "allowed": boolean; "reason"?: string; "intent_id"?: string; "grant"?: FederateGrant; };
|
|
38
|
+
export type FederateGrant = { "federation_id": string; "intent_id": string; "decision_grant_id"?: string; "tenant_id": string; "actor_id": string; "capability": string; "capability_version"?: string; "actions": Array<string>; "resource_id"?: string; "task_id"?: string; "data_class"?: string; "tier": string; "spend_cap"?: { "minor"?: number; "currency"?: string; }; "scope_key": string; "backend": "custody" | "oauth_token_exchange" | "aws_sts_web_identity" | "azure_federated_credential" | "gcp_workload_identity" | "customer_broker"; "locator": FederateLocator; "issued_at": string; "expires_at": string; "ttl_seconds": number; "material": FederateMaterial; "record": FederateRecord; };
|
|
39
|
+
export type FederateLocator = { "capability": string; "endpoint": string; "method"?: string; "authority"?: string; "resource_id"?: string; };
|
|
40
|
+
export type FederateMaterial = { "kind": "credential" | "instructions"; "credential"?: string; "instructions"?: FederateInstructions; "expires_at"?: string; "audience"?: string; };
|
|
41
|
+
export type FederateInstructions = { "backend": string; "method": string; "url": string; "headers"?: Record<string, unknown>; "form"?: Record<string, unknown>; "json"?: Record<string, unknown>; "subject_token_in": "form" | "json"; "subject_token_field": string; "subject_token_type"?: string; "duration_seconds"?: number; "documentation": string; "not_built"?: Array<string>; "notes"?: Array<string>; };
|
|
42
|
+
export type FederateRecord = { "intent_id": string; "mode": "federated"; "payload_seen": false; "marker_receipt_hash"?: string; "receipt_id"?: string; };
|
|
43
|
+
export type ObserveRequest = { "intent_id": string; "effect_id"?: string; "outcome"?: string; "observed_at"?: string; "note"?: string; };
|
|
44
|
+
export type ObserveResponse = { "intent_id": string; "receipt": Receipt; "label": string; "enforcement": string; "counts_toward_coverage": false; };
|
|
45
|
+
export type CapabilityEntry = { "registration_hash"?: string; "policy_bundle_hash"?: string; "capability_id": string; "version": string; "pinned": boolean; "kind"?: string; "owner": string; "risk_tier": string; "actions"?: Array<string>; "resource_id"?: string; "data_class"?: string; "custody"?: string; "enforcement": string; "result_mode"?: "digest" | "inline_bounded" | "rendezvous"; "result_resource_id"?: string; "result_ack_owner"?: string; "result_ack_reason"?: string; "task_id"?: string; "caller_task_id"?: string; };
|
|
46
|
+
export type CapabilitiesResponse = { "tenant_id": string; "actor_id": string; "capabilities": Array<CapabilityEntry>; };
|
|
47
|
+
export type CataloguePolicy = { "policy_id": string; "label": string; "required": number; "min_humans": number; "classes": Array<string>; "authority": string; };
|
|
48
|
+
export type CatalogueEntry = { "capability_id": string; "version": string; "kind"?: string; "owner": string; "risk_tier": string; "actions": Array<string>; "resource_id"?: string; "data_class": string; "custody"?: string; "policy": CataloguePolicy; };
|
|
49
|
+
export type CatalogueResponse = { "tenant_id": string; "actor_id": string; "requestable": Array<CatalogueEntry>; };
|
|
50
|
+
export type AccessRequestCreate = { "capability": string; "actions": Array<string>; "resource_id"?: string; "data_class"?: string; "tier": string; "budget_minor"?: number; "budget_currency"?: string; "ttl_seconds": number; "task_id": string; "justification": string; "surface_resource_id"?: string; "team_id"?: string; "duration"?: "just_in_time" | "standing" | "scheduled_window" | "task_bound" | "break_glass"; "review_days"?: number; "window_start"?: string; "window_end"?: string; "window_timezone"?: string; };
|
|
51
|
+
export type Quorum = { "required": number; "humans": number; "policy": string; };
|
|
52
|
+
export type AccessRequestCreated = { "request_id": string; "state": string; "needed": Quorum; "duration"?: ""; "reviewed"?: boolean; };
|
|
53
|
+
export type AccessApprovalState = { "approval_id": string; "state": "pending" | "granted" | "rejected" | "expired"; "decided_by"?: string; "decided_at"?: string; };
|
|
54
|
+
export type AccessRequest = { "request_id": string; "state": "pending" | "granted" | "denied" | "returned" | "expired" | "revoked"; "needed": Quorum; "tenant_id"?: string; "actor_id"?: string; "capability"?: string; "actions"?: Array<string>; "resource_id"?: string; "data_class"?: string; "tier"?: string; "budget_minor"?: number; "budget_currency"?: string; "ttl_seconds"?: number; "task_id"?: string; "justification"?: string; "surface_resource_id"?: string; "team_id"?: string; "duration"?: "just_in_time" | "standing" | "scheduled_window" | "task_bound" | "break_glass"; "review_ttl_seconds"?: number; "window_start"?: string; "window_end"?: string; "window_timezone"?: string; "review_required"?: boolean; "reviewed_by"?: string; "reviewed_at"?: string; "reviewed"?: boolean; "approval_id"?: string; "approvals"?: Array<AccessApprovalState>; "decided_by"?: Array<string>; "decided_at"?: string; "expires_at"?: string; "created_at"?: string; "reason"?: string; };
|
|
55
|
+
export type RevokeRequest = { "reason"?: string; };
|
|
56
|
+
export type ManagerCard = { "CardID"?: string; "ApprovalID"?: string; "IntentID"?: string; "TaskID"?: string; "Approver"?: string; "PayloadHash"?: string; "PolicyID"?: string; "Action"?: string; "Summary"?: string; "Quorum"?: string; "RaisedAt"?: string; "ExpiresAt"?: string; "Via"?: string; "ForApprover"?: string; };
|
|
57
|
+
export type ManagerCardsResponse = { "tenant_id": string; "actor_id": string; "cards": Array<ManagerCard>; "note"?: string; };
|
|
58
|
+
export type ManagerCardDecision = { "card_id": string; "approval_id": string; "payload_hash": string; "policy_id"?: string; "grant": boolean; "reason"?: string; };
|
|
59
|
+
export type ManagerCardDecisionRecorded = { "tenant_id": string; "actor_id": string; "card_id": string; "approval_id": string; "recorded": boolean; };
|
|
60
|
+
export type HealthResponse = { "status": "ok"; };
|
|
61
|
+
export type ReadinessResponse = { "status": "ready" | "not ready"; "reason"?: string; "bundle_id"?: string; "engine_version"?: string; "full_flush"?: boolean; "callers_verified"?: boolean; "unauthenticated"?: boolean; "task_bound"?: boolean; "taskless_allowed"?: boolean; "approvals_wired"?: boolean; "custody_on_record"?: boolean; "capabilities_registered"?: number; "capabilities_note"?: string; };
|
|
62
|
+
export type CallbackResult = { "recorded": boolean; "code"?: string; "refusal"?: string; "approval_id"?: string; "approver"?: string; "granted"?: boolean; "quorum"?: string; "quorum_satisfied"?: boolean; };
|
|
63
|
+
export type PageInfo = { "limit": number; "returned": number; "has_more": boolean; "next_cursor"?: string; };
|
|
64
|
+
export type Task = { "task_id": string; "tenant_id": string; "parent_id"?: string; "title": string; "state": "draft" | "open" | "claimed" | "blocked" | "completed" | "abandoned" | "expired"; "sponsor"?: string; "assignee"?: string; "budget_minor": number; "committed_minor": number; "remaining_minor": number; "currency"?: string; "human_free_approval"?: boolean; "human_free_approval_sponsor"?: string; "human_free_approval_at"?: string; "deadline"?: string; "depth"?: number; "required_approvals"?: Array<string>; "created_at": string; "updated_at": string; "revision": number; };
|
|
65
|
+
export type TaskPage = { "items": Array<Task>; "page": PageInfo; };
|
|
66
|
+
export type ExternalApproval = { "approval_id": string; "task_id": string; "intent_id": string; "requester": string; "action"?: string; "state": "pending" | "granted" | "rejected" | "expired"; "approver"?: string; "deciders"?: Array<string>; "created_at": string; "expires_at": string; "capability"?: string; "amount_minor"?: number; "amount_currency"?: string; "operate"?: { "company_id": string; "agent_id": string; "run_id"?: string; "issue_id"?: string; "project_id"?: string; }; };
|
|
67
|
+
export type ExternalApprovalList = { "items": Array<ExternalApproval>; };
|
|
68
|
+
export type OperateSettlement = { "company_id": string; "agent_id": string; "run_id": string; "complete": boolean; "settled": boolean; };
|
|
69
|
+
export type ExternalSpend = { "company_id": string; "rows": Array<ExternalSpendRow>; };
|
|
70
|
+
export type ExternalSpendRow = { "operate_agent_id": string; "actor_id": string; "project_id"?: string; "currency": string; "permits": number; "refusals": number; "reserved_minor": number; "settled_minor": number; "model_calls": number; };
|
|
71
|
+
export type ExternalApprovalDecision = { "decision": "grant" | "reject"; "reason"?: string; };
|
|
72
|
+
export type ExternalApprovalDecided = { "approval": ExternalApproval; "outcome": "grant" | "reject" | "recommended"; "operate_notified": boolean; };
|
|
73
|
+
export type Approval = { "approval_id": string; "tenant_id": string; "task_id"?: string; "intent_id"?: string; "state": "not_required" | "pending" | "granted" | "rejected" | "expired"; "approver"?: string; "approver_kind"?: string; "approver_authority"?: string; "approver_sponsor"?: string; "requester"?: string; "sponsor"?: string; "action"?: string; "reason"?: string; "payload_hash"?: string; "bundle_hash"?: string; "engine_version"?: string; "approval_policy_id"?: string; "created_at": string; "expires_at": string; "decided_at"?: string; };
|
|
74
|
+
export type ApprovalPage = { "items": Array<Approval>; "page": PageInfo; };
|
|
75
|
+
export type Entitlement = { "request_id": string; "tenant_id": string; "actor_id": string; "capability": string; "actions"?: Array<string>; "resource_id"?: string; "data_class"?: string; "tier": string; "budget"?: { "minor"?: number; "currency"?: string; }; "state": "usable" | "expired" | "revoked"; "expires_at": string; "granted_by"?: string; "revoked_at"?: string; "revoked_by"?: string; };
|
|
76
|
+
export type EntitlementPage = { "items": Array<Entitlement>; "page": PageInfo; };
|
|
77
|
+
export type ReceiptView = { "execution_state"?: "claimed" | "not_dispatched"; "receipt_id": string; "intent_id": string; "tenant_id": string; "task_id"?: string; "approval_id"?: string; "custody"?: string; "grant_id"?: string; "effect_id"?: string; "effect"?: string; "class": "denied" | "minted_unused" | "authorized" | "executed" | "deferred"; "record_hash": string; "issued_at": string; "rail_confirmed": boolean; "confirmed_at"?: string; "reported_by"?: string; "reported_at"?: string; "observed_at"?: string; "reported_outcome"?: string; "note"?: string; "receipt_hash"?: string; "policy_bundle_hash": string; "input_hash": string; "engine_version": string; "counts_toward_coverage": boolean; "result_mode"?: "digest" | "inline_bounded" | "rendezvous"; "payload_returned"?: true; "result_resource_id"?: string; "model_usage"?: ModelUsage; };
|
|
78
|
+
export type ReceiptPage = { "items": Array<ReceiptView>; "page": PageInfo; };
|