@realtimex/sdk 1.3.5-rc.1 → 1.3.6

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.d.mts CHANGED
@@ -1177,6 +1177,598 @@ declare class ContractModule {
1177
1177
  clearCache(): void;
1178
1178
  }
1179
1179
 
1180
+ type ProviderKind = 'gemini' | 'claude' | 'codex';
1181
+ type ContractStrictness = 'compatible' | 'strict';
1182
+ interface ContractCallbackRules {
1183
+ event_id_header?: string;
1184
+ signature_header?: string;
1185
+ signature_algorithm?: string;
1186
+ signature_message?: string;
1187
+ attempt_id_format?: string;
1188
+ idempotency?: string;
1189
+ }
1190
+ interface ContractCapabilityTrigger {
1191
+ event: 'task.trigger';
1192
+ route?: string;
1193
+ payload_template?: Record<string, unknown>;
1194
+ }
1195
+ interface ContractCapability {
1196
+ capability_id: string;
1197
+ name: string;
1198
+ description: string;
1199
+ input_schema: Record<string, unknown>;
1200
+ output_schema?: Record<string, unknown>;
1201
+ permission: string;
1202
+ trigger: ContractCapabilityTrigger;
1203
+ }
1204
+ interface LocalAppContractV1 {
1205
+ contract_version: 'local-app-contract/v1';
1206
+ strictness: ContractStrictness;
1207
+ supported_contract_events: string[];
1208
+ supported_legacy_events?: string[];
1209
+ aliases?: Record<string, string>;
1210
+ status_map?: Record<string, string>;
1211
+ legacy_action_map?: Record<string, string>;
1212
+ callback?: ContractCallbackRules;
1213
+ capabilities?: ContractCapability[];
1214
+ }
1215
+ interface LegacyLocalAppContractShape {
1216
+ id?: string;
1217
+ version?: string;
1218
+ strictness?: ContractStrictness;
1219
+ supported_events?: string[];
1220
+ supported_contract_events?: string[];
1221
+ supported_legacy_events?: string[];
1222
+ aliases?: Record<string, string>;
1223
+ status_map?: Record<string, string>;
1224
+ legacy_action_map?: Record<string, string>;
1225
+ callback?: ContractCallbackRules;
1226
+ capabilities?: ContractCapability[];
1227
+ }
1228
+ interface ContractDiscoveryResponse {
1229
+ success: boolean;
1230
+ contract: LocalAppContractV1 | LegacyLocalAppContractShape;
1231
+ }
1232
+
1233
+ interface ProjectToolsInput {
1234
+ contract: LocalAppContractV1;
1235
+ provider: ProviderKind;
1236
+ appId: string;
1237
+ namespace?: string;
1238
+ }
1239
+ interface CanonicalToolDefinition {
1240
+ tool_name: string;
1241
+ title: string;
1242
+ description: string;
1243
+ input_schema: Record<string, unknown>;
1244
+ output_schema?: Record<string, unknown>;
1245
+ permission: string;
1246
+ capability_id: string;
1247
+ trigger: ContractCapability['trigger'];
1248
+ }
1249
+ interface HostToolAdapter<TProviderTool, TProviderToolCall, TProviderResult> {
1250
+ toProviderTools(tools: CanonicalToolDefinition[]): TProviderTool[];
1251
+ fromProviderToolCall(call: TProviderToolCall): {
1252
+ tool_call_id: string;
1253
+ tool_name: string;
1254
+ args: Record<string, unknown>;
1255
+ };
1256
+ toProviderResult(result: {
1257
+ status: 'completed' | 'failed' | 'queued';
1258
+ tool_call_id?: string;
1259
+ task_id?: string;
1260
+ attempt_id?: string;
1261
+ output?: Record<string, unknown>;
1262
+ error?: {
1263
+ code: string;
1264
+ message: string;
1265
+ retryable: boolean;
1266
+ };
1267
+ }): TProviderResult;
1268
+ }
1269
+
1270
+ interface ToolCall {
1271
+ tool_call_id: string;
1272
+ tool_name: string;
1273
+ args: Record<string, unknown>;
1274
+ }
1275
+ interface ExecutionContext {
1276
+ appId: string;
1277
+ userId: string;
1278
+ workspaceId?: string;
1279
+ requestId?: string;
1280
+ idempotencyKey?: string;
1281
+ provider?: ProviderKind;
1282
+ namespace?: string;
1283
+ metadata?: Record<string, unknown>;
1284
+ }
1285
+ interface ExecutionResult {
1286
+ status: 'completed' | 'failed' | 'queued';
1287
+ tool_call_id?: string;
1288
+ task_id?: string;
1289
+ attempt_id?: string;
1290
+ output?: Record<string, unknown>;
1291
+ error?: {
1292
+ code: string;
1293
+ message: string;
1294
+ retryable: boolean;
1295
+ };
1296
+ }
1297
+ type LifecycleEventType = 'task.claimed' | 'task.started' | 'task.progress' | 'task.completed' | 'task.failed' | 'task.canceled';
1298
+ interface RuntimeExecutionEvent {
1299
+ tool_call_id: string;
1300
+ task_id: string;
1301
+ attempt_id?: string;
1302
+ event_type: LifecycleEventType;
1303
+ event_id: string;
1304
+ timestamp: string;
1305
+ payload?: Record<string, unknown>;
1306
+ }
1307
+ interface GetToolsInput {
1308
+ appId: string;
1309
+ provider: ProviderKind;
1310
+ namespace?: string;
1311
+ }
1312
+ interface IngestExecutionEventInput {
1313
+ event?: string;
1314
+ event_type?: string;
1315
+ event_id?: string;
1316
+ task_id?: string;
1317
+ task_uuid?: string;
1318
+ attempt_id?: string | number | null;
1319
+ tool_call_id?: string;
1320
+ timestamp?: string;
1321
+ payload?: Record<string, unknown>;
1322
+ data?: Record<string, unknown>;
1323
+ [key: string]: unknown;
1324
+ }
1325
+ interface ContractRuntimeInterface {
1326
+ getContract(appId: string): Promise<LocalAppContractV1>;
1327
+ getTools(input: GetToolsInput): Promise<CanonicalToolDefinition[]>;
1328
+ executeToolCall(call: ToolCall, context: ExecutionContext): Promise<ExecutionResult>;
1329
+ onExecutionEvent(handler: (event: RuntimeExecutionEvent) => void): () => void;
1330
+ }
1331
+
1332
+ interface RetryPolicyOptions {
1333
+ maxAttempts?: number;
1334
+ baseDelayMs?: number;
1335
+ maxDelayMs?: number;
1336
+ shouldRetry?: (error: unknown, attempt: number) => boolean;
1337
+ }
1338
+ declare class RetryPolicy {
1339
+ private readonly maxAttempts;
1340
+ private readonly baseDelayMs;
1341
+ private readonly maxDelayMs;
1342
+ private readonly shouldRetry;
1343
+ constructor(options?: RetryPolicyOptions);
1344
+ execute<T>(operation: (attempt: number) => Promise<T>): Promise<T>;
1345
+ }
1346
+
1347
+ interface ContractRuntimeOptions {
1348
+ baseUrl: string;
1349
+ appId?: string;
1350
+ appName?: string;
1351
+ apiKey?: string;
1352
+ permissions?: string[];
1353
+ namespace?: string;
1354
+ fetchImpl?: typeof fetch;
1355
+ cacheTtlMs?: number;
1356
+ retry?: RetryPolicyOptions;
1357
+ }
1358
+ declare class ContractRuntime implements ContractRuntimeInterface {
1359
+ private readonly appId?;
1360
+ private readonly appName?;
1361
+ private readonly defaultNamespace?;
1362
+ private readonly contractClient;
1363
+ private readonly toolProjector;
1364
+ private readonly executionStore;
1365
+ private readonly lifecycleReporter;
1366
+ private readonly scopeGuard;
1367
+ private readonly retryPolicy;
1368
+ private readonly httpClient;
1369
+ constructor(options: ContractRuntimeOptions);
1370
+ getContract(appId: string): Promise<LocalAppContractV1>;
1371
+ getTools(input: GetToolsInput): Promise<CanonicalToolDefinition[]>;
1372
+ executeToolCall(call: ToolCall, context: ExecutionContext): Promise<ExecutionResult>;
1373
+ onExecutionEvent(handler: (event: RuntimeExecutionEvent) => void): () => void;
1374
+ ingestExecutionEvent(input: IngestExecutionEventInput): RuntimeExecutionEvent | null;
1375
+ clearCache(): void;
1376
+ private assertAppContext;
1377
+ private buildRegistryKey;
1378
+ private resolveTaskId;
1379
+ private buildTriggerRequestBody;
1380
+ private validateToolArgs;
1381
+ private matchesType;
1382
+ private tryEmitLifecycleEvent;
1383
+ private toFailedResult;
1384
+ }
1385
+
1386
+ /**
1387
+ * Database Module - Retrieve Supabase config from RealtimeX Main App
1388
+ *
1389
+ * Allows Local Apps to fetch their database configuration (URL, anonKey, mode)
1390
+ * without hardcoding them.
1391
+ */
1392
+ interface DatabaseConfig {
1393
+ url: string;
1394
+ anonKey: string;
1395
+ mode: 'compatible' | 'custom';
1396
+ tables: string[];
1397
+ max_concurrent_tasks: number;
1398
+ }
1399
+ declare class DatabaseModule {
1400
+ private baseUrl;
1401
+ private appId;
1402
+ private apiKey?;
1403
+ constructor(realtimexUrl: string, appId: string, apiKey?: string);
1404
+ private getHeaders;
1405
+ /**
1406
+ * Get the Supabase database configuration for this app.
1407
+ * Returns URL, anonKey, mode, and tables.
1408
+ *
1409
+ * @example
1410
+ * ```ts
1411
+ * const config = await sdk.database.getConfig();
1412
+ * const supabase = createClient(config.url, config.anonKey);
1413
+ * ```
1414
+ */
1415
+ getConfig(): Promise<DatabaseConfig>;
1416
+ }
1417
+
1418
+ /**
1419
+ * Auth Module - Authentication helpers for RealtimeX SDK
1420
+ *
1421
+ * Provides:
1422
+ * - syncSupabaseToken(): Push Supabase JWT to Main App for RLS-aware operations
1423
+ * - getAccessToken(): Retrieve the Keycloak access token from Main App (existing endpoint)
1424
+ */
1425
+ interface AuthTokenResponse {
1426
+ token: string;
1427
+ hasToken: boolean;
1428
+ syncedAt: string | null;
1429
+ source: string | null;
1430
+ }
1431
+ interface SyncTokenResponse {
1432
+ success: boolean;
1433
+ message: string;
1434
+ hasToken: boolean;
1435
+ syncedAt: string | null;
1436
+ source: string | null;
1437
+ }
1438
+ declare class AuthModule {
1439
+ private baseUrl;
1440
+ private appId;
1441
+ private apiKey?;
1442
+ constructor(realtimexUrl: string, appId: string, apiKey?: string);
1443
+ private getHeaders;
1444
+ /**
1445
+ * Push a Supabase access token to the Main App.
1446
+ * This enables Main App to use the token for:
1447
+ * - Realtime subscriptions (bypass RLS)
1448
+ * - CRUD operations on rtx_activities (bypass RLS)
1449
+ *
1450
+ * @param token - Supabase JWT from supabase.auth.signIn()
1451
+ *
1452
+ * @example
1453
+ * ```ts
1454
+ * const { data } = await supabase.auth.signInWithPassword({ email, password });
1455
+ * await sdk.auth.syncSupabaseToken(data.session.access_token);
1456
+ * ```
1457
+ */
1458
+ syncSupabaseToken(token: string): Promise<SyncTokenResponse>;
1459
+ /**
1460
+ * Retrieve the current Keycloak access token from Main App.
1461
+ * This is the existing Token Vending Machine endpoint.
1462
+ *
1463
+ * @returns The access token info, or null if no token is available.
1464
+ */
1465
+ getAccessToken(): Promise<AuthTokenResponse | null>;
1466
+ }
1467
+
1468
+ interface ContractHttpClientConfig {
1469
+ baseUrl: string;
1470
+ appId?: string;
1471
+ appName?: string;
1472
+ apiKey?: string;
1473
+ fetchImpl?: typeof fetch;
1474
+ }
1475
+ declare class ContractHttpClient {
1476
+ private readonly baseUrl;
1477
+ private readonly appId?;
1478
+ private readonly appName?;
1479
+ private readonly apiKey?;
1480
+ private readonly fetchImpl;
1481
+ constructor(config: ContractHttpClientConfig);
1482
+ get<T>(path: string, headers?: HeadersInit): Promise<T>;
1483
+ post<T>(path: string, body: unknown, headers?: HeadersInit): Promise<T>;
1484
+ request<T>(path: string, options?: RequestInit): Promise<T>;
1485
+ private buildHeaders;
1486
+ private parseResponse;
1487
+ }
1488
+
1489
+ declare class ContractCache {
1490
+ private readonly ttlMs;
1491
+ private readonly entries;
1492
+ constructor(ttlMs?: number);
1493
+ get(key: string): LocalAppContractV1 | null;
1494
+ set(key: string, value: LocalAppContractV1): void;
1495
+ clear(key?: string): void;
1496
+ }
1497
+
1498
+ interface ContractClientOptions {
1499
+ cache?: ContractCache;
1500
+ cacheKey?: string;
1501
+ }
1502
+ declare class ContractClient {
1503
+ private readonly httpClient;
1504
+ private readonly cache;
1505
+ private readonly cacheKey;
1506
+ constructor(httpClient: ContractHttpClient, options?: ContractClientOptions);
1507
+ getLocalAppV1(forceRefresh?: boolean): Promise<LocalAppContractV1>;
1508
+ clearCache(): void;
1509
+ }
1510
+
1511
+ declare function normalizeLocalAppContractV1(payload: unknown): LocalAppContractV1;
1512
+
1513
+ declare class ToolProjector {
1514
+ project(input: ProjectToolsInput): CanonicalToolDefinition[];
1515
+ private ensureUniqueToolName;
1516
+ }
1517
+
1518
+ declare function normalizeSchema(schema?: Record<string, unknown>): Record<string, unknown>;
1519
+
1520
+ declare function toStableToolName(capabilityId: string, namespace?: string): string;
1521
+
1522
+ declare class ScopeGuard {
1523
+ private readonly scopes;
1524
+ constructor(scopes?: string[]);
1525
+ can(permission?: string): boolean;
1526
+ assert(permission?: string): void;
1527
+ }
1528
+
1529
+ interface AuthProvider {
1530
+ buildHeaders(baseHeaders?: Record<string, string>): Record<string, string>;
1531
+ }
1532
+ interface StaticAuthProviderOptions {
1533
+ appId?: string;
1534
+ appName?: string;
1535
+ apiKey?: string;
1536
+ }
1537
+ declare class StaticAuthProvider implements AuthProvider {
1538
+ private readonly appId?;
1539
+ private readonly appName?;
1540
+ private readonly apiKey?;
1541
+ constructor(options?: StaticAuthProviderOptions);
1542
+ buildHeaders(baseHeaders?: Record<string, string>): Record<string, string>;
1543
+ }
1544
+
1545
+ declare class ContractError extends Error {
1546
+ readonly code: string;
1547
+ readonly details?: unknown;
1548
+ constructor(code: string, message: string, details?: unknown);
1549
+ }
1550
+ declare class ContractValidationError extends ContractError {
1551
+ constructor(message: string, details?: unknown);
1552
+ }
1553
+ declare class ToolValidationError extends ContractError {
1554
+ constructor(message: string, details?: unknown);
1555
+ }
1556
+ declare class ToolNotFoundError extends ContractError {
1557
+ constructor(toolName: string, details?: unknown);
1558
+ }
1559
+ declare class ScopeDeniedError extends ContractError {
1560
+ constructor(permission: string, details?: unknown);
1561
+ }
1562
+ declare class RuntimeTransportError extends ContractError {
1563
+ readonly statusCode?: number;
1564
+ constructor(message: string, statusCode?: number, details?: unknown);
1565
+ }
1566
+
1567
+ interface GeminiFunctionDeclaration {
1568
+ name: string;
1569
+ description?: string;
1570
+ parameters?: Record<string, unknown>;
1571
+ }
1572
+ interface GeminiToolCall {
1573
+ id: string;
1574
+ name: string;
1575
+ args?: Record<string, unknown> | string;
1576
+ }
1577
+ interface GeminiToolResult {
1578
+ tool_call_id: string;
1579
+ status: ExecutionResult['status'];
1580
+ payload: Record<string, unknown>;
1581
+ }
1582
+ declare class GeminiToolAdapter implements HostToolAdapter<GeminiFunctionDeclaration, GeminiToolCall, GeminiToolResult> {
1583
+ toProviderTools(tools: CanonicalToolDefinition[]): GeminiFunctionDeclaration[];
1584
+ fromProviderToolCall(call: GeminiToolCall): ToolCall;
1585
+ toProviderResult(result: ExecutionResult): GeminiToolResult;
1586
+ }
1587
+
1588
+ interface ClaudeToolDefinition {
1589
+ name: string;
1590
+ description: string;
1591
+ input_schema: Record<string, unknown>;
1592
+ }
1593
+ interface ClaudeToolCall {
1594
+ id: string;
1595
+ name: string;
1596
+ input?: Record<string, unknown>;
1597
+ }
1598
+ interface ClaudeToolResult {
1599
+ type: 'tool_result';
1600
+ tool_use_id: string;
1601
+ content: string;
1602
+ is_error?: boolean;
1603
+ }
1604
+ declare class ClaudeToolAdapter implements HostToolAdapter<ClaudeToolDefinition, ClaudeToolCall, ClaudeToolResult> {
1605
+ toProviderTools(tools: CanonicalToolDefinition[]): ClaudeToolDefinition[];
1606
+ fromProviderToolCall(call: ClaudeToolCall): ToolCall;
1607
+ toProviderResult(result: ExecutionResult): ClaudeToolResult;
1608
+ }
1609
+
1610
+ interface CodexToolDefinition {
1611
+ type: 'function';
1612
+ function: {
1613
+ name: string;
1614
+ description: string;
1615
+ parameters: Record<string, unknown>;
1616
+ };
1617
+ }
1618
+ interface CodexToolCall {
1619
+ id: string;
1620
+ function: {
1621
+ name: string;
1622
+ arguments?: string | Record<string, unknown>;
1623
+ };
1624
+ }
1625
+ interface CodexToolResult {
1626
+ tool_call_id: string;
1627
+ output: string;
1628
+ is_error?: boolean;
1629
+ }
1630
+ declare class CodexToolAdapter implements HostToolAdapter<CodexToolDefinition, CodexToolCall, CodexToolResult> {
1631
+ toProviderTools(tools: CanonicalToolDefinition[]): CodexToolDefinition[];
1632
+ fromProviderToolCall(call: CodexToolCall): ToolCall;
1633
+ toProviderResult(result: ExecutionResult): CodexToolResult;
1634
+ }
1635
+
1636
+ type ACPToolKind = 'read' | 'edit' | 'delete' | 'move' | 'search' | 'execute' | 'think' | 'fetch' | 'other';
1637
+ type ACPToolStatus = 'pending' | 'in_progress' | 'completed' | 'failed';
1638
+ interface ACPTextContent {
1639
+ type: 'text';
1640
+ text: string;
1641
+ }
1642
+ interface ACPSessionToolUpdate {
1643
+ type: 'tool_call' | 'tool_call_update';
1644
+ toolCallId: string;
1645
+ title?: string;
1646
+ kind?: ACPToolKind;
1647
+ status: ACPToolStatus;
1648
+ content?: ACPTextContent[];
1649
+ rawInput?: Record<string, unknown>;
1650
+ rawOutput?: Record<string, unknown>;
1651
+ _meta?: Record<string, unknown>;
1652
+ }
1653
+ interface ACPSessionUpdateParams {
1654
+ sessionId: string;
1655
+ update: ACPSessionToolUpdate;
1656
+ }
1657
+ interface ACPNotifier {
1658
+ notify(method: 'session/update', params: ACPSessionUpdateParams): Promise<void>;
1659
+ request?<T = unknown>(method: string, params: Record<string, unknown>): Promise<T>;
1660
+ }
1661
+ interface ACPAdapterContext {
1662
+ sessionId: string;
1663
+ appId: string;
1664
+ userId: string;
1665
+ workspaceId?: string;
1666
+ provider?: 'gemini' | 'claude' | 'codex';
1667
+ namespace?: string;
1668
+ }
1669
+ interface ACPToolInvocation {
1670
+ toolCallId: string;
1671
+ toolName: string;
1672
+ args: Record<string, unknown>;
1673
+ title?: string;
1674
+ kind?: ACPToolKind;
1675
+ }
1676
+ interface ACPExecutionReference {
1677
+ sessionId: string;
1678
+ toolCallId: string;
1679
+ appId: string;
1680
+ userId: string;
1681
+ workspaceId?: string;
1682
+ provider?: 'gemini' | 'claude' | 'codex';
1683
+ namespace?: string;
1684
+ title?: string;
1685
+ kind?: ACPToolKind;
1686
+ }
1687
+ interface PermissionOption {
1688
+ id: string;
1689
+ label: string;
1690
+ kind?: 'allow_once' | 'allow_always' | 'deny_once' | 'deny_always';
1691
+ }
1692
+ interface ACPContractRuntime {
1693
+ executeToolCall(call: ToolCall, context: ExecutionContext): Promise<ExecutionResult>;
1694
+ onExecutionEvent(handler: (event: RuntimeExecutionEvent) => void): () => void;
1695
+ ingestExecutionEvent(input: IngestExecutionEventInput): RuntimeExecutionEvent | null;
1696
+ }
1697
+ interface ACPContractAdapterOptions {
1698
+ runtime: ACPContractRuntime;
1699
+ notifier: ACPNotifier;
1700
+ requestPermission?: boolean;
1701
+ buildPermissionOptions?: (input: ACPToolInvocation) => PermissionOption[];
1702
+ telemetry?: ACPAdapterTelemetrySink;
1703
+ }
1704
+ interface ACPAdapterTelemetryEvent {
1705
+ phase: 'execute' | 'notify' | 'permission' | 'runtime_event' | 'ingest';
1706
+ result: 'ok' | 'failed' | 'skipped';
1707
+ sessionId?: string;
1708
+ toolCallId?: string;
1709
+ toolName?: string;
1710
+ taskId?: string;
1711
+ attemptId?: string;
1712
+ eventId?: string;
1713
+ eventType?: string;
1714
+ status?: ACPToolStatus;
1715
+ error?: string;
1716
+ metadata?: Record<string, unknown>;
1717
+ }
1718
+ interface ACPAdapterTelemetrySink {
1719
+ emit(event: ACPAdapterTelemetryEvent): void | Promise<void>;
1720
+ }
1721
+
1722
+ declare class ACPContractAdapter {
1723
+ private readonly runtime;
1724
+ private readonly notifier;
1725
+ private readonly mapper;
1726
+ private readonly permissionBridge;
1727
+ private readonly telemetry;
1728
+ private readonly taskReferences;
1729
+ private readonly toolCallReferences;
1730
+ private readonly runtimeUnsubscribe;
1731
+ constructor(options: ACPContractAdapterOptions);
1732
+ dispose(): void;
1733
+ executeTool(invocation: ACPToolInvocation, context: ACPAdapterContext): Promise<ExecutionResult>;
1734
+ ingestContractCallback(payload: Record<string, unknown>, context: Pick<ACPAdapterContext, 'sessionId'>): RuntimeExecutionEvent | null;
1735
+ private handleRuntimeEvent;
1736
+ private resolveReferenceForEvent;
1737
+ private rememberReference;
1738
+ private cleanupReference;
1739
+ private notify;
1740
+ }
1741
+
1742
+ declare class ACPEventMapper {
1743
+ createReference(invocation: ACPToolInvocation, context: ACPAdapterContext): ACPExecutionReference;
1744
+ buildPendingUpdate(invocation: ACPToolInvocation, reference: ACPExecutionReference): ACPSessionUpdateParams;
1745
+ buildResultUpdate(result: ExecutionResult, reference: ACPExecutionReference): ACPSessionUpdateParams;
1746
+ buildLifecycleUpdate(event: RuntimeExecutionEvent, reference: ACPExecutionReference): ACPSessionUpdateParams | null;
1747
+ buildNotifyFailureUpdate(reference: ACPExecutionReference, error: unknown): ACPSessionUpdateParams;
1748
+ mapContractEventStatus(eventType: string): ACPToolStatus | null;
1749
+ private mapExecutionResultStatus;
1750
+ private resolveEventText;
1751
+ }
1752
+
1753
+ interface ACPPermissionBridgeOptions {
1754
+ notifier: ACPNotifier;
1755
+ enabled: boolean;
1756
+ buildPermissionOptions?: (input: ACPToolInvocation) => PermissionOption[];
1757
+ }
1758
+ declare class ACPPermissionBridge {
1759
+ private readonly notifier;
1760
+ private readonly enabled;
1761
+ private readonly buildPermissionOptions?;
1762
+ constructor(options: ACPPermissionBridgeOptions);
1763
+ requestToolPermission(invocation: ACPToolInvocation, context: ACPAdapterContext): Promise<boolean>;
1764
+ }
1765
+
1766
+ declare class ACPTelemetry {
1767
+ private readonly sink?;
1768
+ constructor(sink?: ACPAdapterTelemetrySink);
1769
+ emit(event: ACPAdapterTelemetryEvent): void;
1770
+ }
1771
+
1180
1772
  /**
1181
1773
  * RealtimeX Local App SDK
1182
1774
  *
@@ -1196,6 +1788,9 @@ declare class RealtimeXSDK {
1196
1788
  agent: AgentModule;
1197
1789
  mcp: MCPModule;
1198
1790
  contract: ContractModule;
1791
+ contractRuntime: ContractRuntime;
1792
+ database: DatabaseModule;
1793
+ auth: AuthModule;
1199
1794
  readonly appId: string;
1200
1795
  readonly appName: string | undefined;
1201
1796
  readonly apiKey: string | undefined;
@@ -1230,4 +1825,4 @@ declare class RealtimeXSDK {
1230
1825
  getAppDataDir(): Promise<string>;
1231
1826
  }
1232
1827
 
1233
- export { ActivitiesModule, type Activity, type Agent, type AgentChatOptions, type AgentChatResponse, AgentModule, type AgentSession, type AgentSessionInfo, type AgentSessionOptions, ApiModule, CONTRACT_ATTEMPT_PREFIX, CONTRACT_EVENT_ID_HEADER, CONTRACT_SIGNATURE_ALGORITHM, CONTRACT_SIGNATURE_HEADER, type ChatContentBlock, type ChatCustomBlock, type ChatFileBlock, type ChatImageUrlBlock, type ChatMessage, type ChatMessageContent, type ChatOptions, type ChatResponse, type ChatTextBlock, type ContractCallbackMetadata, type ContractEventType, ContractModule, type ContractSignInput, type EmbedOptions, type EmbedResponse, LLMModule, LLMPermissionError, LLMProviderError, LOCAL_APP_CONTRACT_VERSION, type LocalAppContractDefinition, type LocalAppContractResponse, MCPModule, type MCPServer, type MCPTool, type MCPToolResult, PermissionDeniedError, PermissionRequiredError, PortModule, type Provider, type ProvidersResponse, RealtimeXSDK, type SDKConfig, type STTListenOptions, type STTModel, type STTModelsResponse, STTModule, type STTProvider, type STTProvidersResponse, type STTResponse, type StreamChunk, type StreamChunkEvent, type TTSChunk, type TTSChunkEvent, TTSModule, type TTSOptions, type TTSProvider, type TTSProviderConfig, type TTSProvidersResponse, type Task, TaskModule, type TaskRun, type Thread, type TriggerAgentPayload, type TriggerAgentResponse, type VectorDeleteOptions, type VectorDeleteResponse, type VectorQueryOptions, type VectorQueryResponse, type VectorQueryResult, type VectorRecord, VectorStore, type VectorUpsertOptions, type VectorUpsertResponse, WebhookModule, type Workspace, buildContractIdempotencyKey, buildContractSignatureMessage, canonicalEventToLegacyAction, createContractEventId, hashContractPayload, normalizeAttemptId, normalizeContractEvent, parseAttemptRunId, signContractEvent };
1828
+ export { type ACPAdapterContext, type ACPAdapterTelemetryEvent, type ACPAdapterTelemetrySink, ACPContractAdapter, type ACPContractAdapterOptions, type ACPContractRuntime, ACPEventMapper, type ACPExecutionReference, type ACPNotifier, ACPPermissionBridge, type ACPSessionToolUpdate, type ACPSessionUpdateParams, ACPTelemetry, type ACPTextContent, type ACPToolInvocation, type ACPToolKind, type ACPToolStatus, ActivitiesModule, type Activity, type Agent, type AgentChatOptions, type AgentChatResponse, AgentModule, type AgentSession, type AgentSessionInfo, type AgentSessionOptions, ApiModule, AuthModule, type AuthProvider, type AuthTokenResponse, CONTRACT_ATTEMPT_PREFIX, CONTRACT_EVENT_ID_HEADER, CONTRACT_SIGNATURE_ALGORITHM, CONTRACT_SIGNATURE_HEADER, type CanonicalToolDefinition, type ChatContentBlock, type ChatCustomBlock, type ChatFileBlock, type ChatImageUrlBlock, type ChatMessage, type ChatMessageContent, type ChatOptions, type ChatResponse, type ChatTextBlock, ClaudeToolAdapter, type ClaudeToolCall, type ClaudeToolDefinition, type ClaudeToolResult, CodexToolAdapter, type CodexToolCall, type CodexToolDefinition, type CodexToolResult, ContractCache, type ContractCallbackMetadata, type ContractCallbackRules, type ContractCapability, type ContractCapabilityTrigger, ContractClient, type ContractClientOptions, type ContractDiscoveryResponse, ContractError, type ContractEventType, ContractHttpClient, type ContractHttpClientConfig, ContractModule, ContractRuntime, type ContractRuntimeInterface, type ContractRuntimeOptions, type ContractSignInput, type ContractStrictness, ContractValidationError, type DatabaseConfig, DatabaseModule, type EmbedOptions, type EmbedResponse, type ExecutionContext, type ExecutionResult, type GeminiFunctionDeclaration, GeminiToolAdapter, type GeminiToolCall, type GeminiToolResult, type GetToolsInput, type HostToolAdapter, type IngestExecutionEventInput, LLMModule, LLMPermissionError, LLMProviderError, LOCAL_APP_CONTRACT_VERSION, type LegacyLocalAppContractShape, type LifecycleEventType, type LocalAppContractDefinition, type LocalAppContractResponse, type LocalAppContractV1, MCPModule, type MCPServer, type MCPTool, type MCPToolResult, PermissionDeniedError, type PermissionOption, PermissionRequiredError, PortModule, type ProjectToolsInput, type Provider, type ProviderKind, type ProvidersResponse, RealtimeXSDK, RetryPolicy, type RetryPolicyOptions, type RuntimeExecutionEvent, RuntimeTransportError, type SDKConfig, type STTListenOptions, type STTModel, type STTModelsResponse, STTModule, type STTProvider, type STTProvidersResponse, type STTResponse, ScopeDeniedError, ScopeGuard, StaticAuthProvider, type StaticAuthProviderOptions, type StreamChunk, type StreamChunkEvent, type SyncTokenResponse, type TTSChunk, type TTSChunkEvent, TTSModule, type TTSOptions, type TTSProvider, type TTSProviderConfig, type TTSProvidersResponse, type Task, TaskModule, type TaskRun, type Thread, type ToolCall, ToolNotFoundError, ToolProjector, ToolValidationError, type TriggerAgentPayload, type TriggerAgentResponse, type VectorDeleteOptions, type VectorDeleteResponse, type VectorQueryOptions, type VectorQueryResponse, type VectorQueryResult, type VectorRecord, VectorStore, type VectorUpsertOptions, type VectorUpsertResponse, WebhookModule, type Workspace, buildContractIdempotencyKey, buildContractSignatureMessage, canonicalEventToLegacyAction, createContractEventId, hashContractPayload, normalizeAttemptId, normalizeContractEvent, normalizeLocalAppContractV1, normalizeSchema, parseAttemptRunId, signContractEvent, toStableToolName };