Skip to main content

TypeScript Types

The SDK re-exports commonly used types from @agenthifive/contracts so you can import everything from a single package. These types are used throughout the SDK's method signatures and return values.

Importing Types

import type {
Connection,
ConnectionStatus,
OAuthProvider,
Agent,
Policy,
ExecutionModel,
DefaultMode,
StepUpApproval,
AllowlistEntry,
RateLimit,
TimeWindow,
AuditEvent,
AuditDecision,
ExecuteRequest,
ExecuteRequestModelA,
ExecuteRequestModelB,
ExecuteResponse,
ExecuteResponseModelA,
ExecuteResponseModelB,
ExecuteResponseApproval,
} from "@agenthifive/sdk";

Core Entity Types

TypeDescription
ConnectionA connected OAuth provider account with token storage metadata.
ConnectionStatusUnion of connection lifecycle states (e.g., "healthy", "needs_reauth", "revoked").
OAuthProviderSupported OAuth provider identifiers: "google", "microsoft", "telegram", "github", "slack", "anthropic", "openai", "gemini", "openrouter", "notion", "trello", "jira".
AgentA registered AI agent or application within a workspace.
AgentStatusAgent lifecycle state: "created", "active", or "disabled".
PolicyAn access policy binding an agent to a connection with rules.

Policy Rule Types

TypeDescription
ExecutionModelExecution model identifier: "A" (token vending) or "B" (brokered proxy).
DefaultModeDefault policy behavior: "read_only", "read_write", or "custom".
StepUpApprovalStep-up approval configuration: "always", "risk_based", or "never".
AllowlistEntryURL pattern (baseUrl, pathPatterns) and HTTP methods permitted by a policy.
RateLimitRate limiting: maxRequestsPerHour, optional maxPayloadSizeBytes and maxResponseSizeBytes.
TimeWindowTime-based access restrictions (e.g., business hours only).

RequestRuleAction

Union of actions a request rule can take: "allow", "deny", "require_approval", "redact".

RequestRule

A request rule evaluated by the policy engine (first-match wins).

PropertyTypeDescription
labelstring?Optional human-readable label for the rule.
match.methodsHttpMethod[]?HTTP methods to match (e.g., ["GET", "POST"]).
match.urlPatternstring?URL pattern to match against the request URL.
match.queryPatternstring?Query string pattern to match.
match.bodyBodyCondition[]?JSON body conditions (path + operator + value).
match.piiPiiMatchConfig?PII detection config -- scans request body fields for PII without mutating the payload.
actionRequestRuleActionAction to take when the rule matches.
redactConfigRedactConfig?PII redaction config -- only used when action is "redact". Specifies which PII types to detect and which body fields to walk.

RedactPattern

Specifies a PII pattern type for redaction. Has a type field (see below), an optional pattern (for "custom" type), and an optional replacement string.

Groups (expand to multiple recognizers): "all_pii", "financial", "identity", "contact"

Generic patterns: "email", "phone", "credit_card", "iban", "ip_address", "url", "crypto_wallet", "date_of_birth", "mac_address", "secret_code"

US-specific: "us_ssn", "us_itin", "us_passport", "us_driver_license", "us_bank_routing", "us_npi"

UK-specific: "uk_nhs", "uk_nino"

Italy-specific: "it_fiscal_code", "it_vat", "it_passport", "it_identity_card", "it_driver_license"

India-specific: "in_aadhaar", "in_pan"

Spain-specific: "es_nif", "es_nie"

Australia-specific: "au_tfn", "au_abn"

Other countries: "pl_pesel", "fi_pic", "th_tnin", "kr_rrn", "sg_fin"

Legacy alias: "ssn"

Custom: "custom" -- requires a pattern (regex) field.

Execution Types

TypeDescription
ExecuteRequestUnion of Model A and Model B execution requests.
ExecuteRequestModelARequest shape for token vending (Model A).
ExecuteRequestModelBRequest shape for brokered proxy (Model B) -- includes method, url, query, headers, body.
ExecuteResponseDiscriminated union of all execution response types.
ExecuteResponseModelAResponse from Model A: contains accessToken, tokenType, expiresIn.
ExecuteResponseModelBResponse from Model B: contains status, headers, body.
ExecuteResponseApprovalResponse when step-up approval is required: contains approvalRequestId.

Audit Types

TypeDescription
AuditEventA single audit log entry with timestamp, action, decision, and metadata.
AuditDecisionThe outcome of a policy evaluation (e.g., "allowed", "denied", "error").

SDK-Specific Types

These types are defined in the SDK itself (not re-exported from contracts):

import type {
AgentHiFiveClientConfig,
ConnectionSummary,
ConnectStartResult,
ExecuteModelAResult,
ExecuteModelBResult,
ExecuteApprovalResult,
ExecuteResult,
ExecuteModelBOptions,
ApprovalRequest,
AgentSummary,
CreateAgentOptions,
CreateAgentResult,
BootstrapResult,
TokenResult,
PolicySummary,
CreatePolicyOptions,
AuditListOptions,
AuditListResult,
} from "@agenthifive/sdk";
TypeDescription
AgentHiFiveClientConfigConstructor options for AgentHiFiveClient (baseUrl, privateKey+agentId or bearerToken).
ConnectionSummarySimplified connection object returned by listConnections().
ConnectStartResultResult of connect() containing the authorizationUrl.
ExecuteResultDiscriminated union of ExecuteModelAResult, ExecuteModelBResult, and ExecuteApprovalResult.
ExecuteModelBOptionsOptions for Model B execution: connectionId, method, url, query, headers, body.
ApprovalRequestEnriched approval request with agent and connection metadata.
AgentSummaryAgent with status (AgentStatus) and enrolledAt (nullable).
CreateAgentResultCreated agent with bootstrapSecret (shown once).
BootstrapResultResult of AgentHiFiveClient.bootstrap(): agentId, name, status, workspaceId.
TokenResultToken exchange result: access_token, token_type, expires_in.
PolicySummaryPolicy object with resolved allowlists, rate limits, and time windows.
AuditListOptionsFilter and pagination options for listAuditEvents().
AuditListResultPaginated audit event response with events array and nextCursor.
ServiceInfoService descriptor returned by listServices(): id, name, provider, icon, and actions array.
ServiceActionInfoAction within a service: id, label, description, requiresApproval.
MyCapabilitiesAgent capability status returned by getMyCapabilities(): activeConnections, pendingRequests, availableActions.
ActiveConnectionAn active connection with connectionId, service, label, and actionTemplateId (nullable).
PendingCapabilityRequestA pending capability request: id, actionTemplateId, reason, requestedAt.
AvailableActionA discoverable action: id, serviceId, label, description, requiresApproval.
CapabilityRequestResult of requestCapability(): id, actionTemplateId, reason, createdAt.