@abloatai/ablo 0.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/CHANGELOG.md +208 -0
- package/LICENSE +201 -0
- package/NOTICE +12 -0
- package/README.md +230 -0
- package/dist/BaseSyncedStore.d.ts +709 -0
- package/dist/BaseSyncedStore.js +1843 -0
- package/dist/Database.d.ts +344 -0
- package/dist/Database.js +1259 -0
- package/dist/LazyReferenceCollection.d.ts +181 -0
- package/dist/LazyReferenceCollection.js +460 -0
- package/dist/Model.d.ts +339 -0
- package/dist/Model.js +715 -0
- package/dist/ModelRegistry.d.ts +200 -0
- package/dist/ModelRegistry.js +535 -0
- package/dist/NetworkMonitor.d.ts +27 -0
- package/dist/NetworkMonitor.js +73 -0
- package/dist/ObjectPool.d.ts +202 -0
- package/dist/ObjectPool.js +1106 -0
- package/dist/SyncClient.d.ts +489 -0
- package/dist/SyncClient.js +1555 -0
- package/dist/SyncEngineContext.d.ts +46 -0
- package/dist/SyncEngineContext.js +74 -0
- package/dist/adapters/alwaysOnline.d.ts +16 -0
- package/dist/adapters/alwaysOnline.js +19 -0
- package/dist/adapters/inMemoryStorage.d.ts +30 -0
- package/dist/adapters/inMemoryStorage.js +94 -0
- package/dist/agent/Agent.d.ts +358 -0
- package/dist/agent/Agent.js +500 -0
- package/dist/agent/index.d.ts +115 -0
- package/dist/agent/index.js +128 -0
- package/dist/agent/session.d.ts +90 -0
- package/dist/agent/session.js +156 -0
- package/dist/agent/types.d.ts +73 -0
- package/dist/agent/types.js +10 -0
- package/dist/ai-sdk/coordination-context.d.ts +51 -0
- package/dist/ai-sdk/coordination-context.js +107 -0
- package/dist/ai-sdk/index.d.ts +68 -0
- package/dist/ai-sdk/index.js +68 -0
- package/dist/ai-sdk/intent-broadcast.d.ts +77 -0
- package/dist/ai-sdk/intent-broadcast.js +72 -0
- package/dist/ai-sdk/wrap.d.ts +67 -0
- package/dist/ai-sdk/wrap.js +45 -0
- package/dist/api/index.d.ts +10 -0
- package/dist/api/index.js +9 -0
- package/dist/auth/index.d.ts +137 -0
- package/dist/auth/index.js +246 -0
- package/dist/client/Ablo.d.ts +835 -0
- package/dist/client/Ablo.js +1440 -0
- package/dist/client/ApiClient.d.ts +200 -0
- package/dist/client/ApiClient.js +659 -0
- package/dist/client/auth.d.ts +79 -0
- package/dist/client/auth.js +81 -0
- package/dist/client/createInternalComponents.d.ts +44 -0
- package/dist/client/createInternalComponents.js +88 -0
- package/dist/client/createModelProxy.d.ts +152 -0
- package/dist/client/createModelProxy.js +199 -0
- package/dist/client/identity.d.ts +63 -0
- package/dist/client/identity.js +156 -0
- package/dist/client/index.d.ts +36 -0
- package/dist/client/index.js +33 -0
- package/dist/client/persistence.d.ts +7 -0
- package/dist/client/persistence.js +11 -0
- package/dist/client/validateAbloOptions.d.ts +42 -0
- package/dist/client/validateAbloOptions.js +43 -0
- package/dist/config/index.d.ts +10 -0
- package/dist/config/index.js +12 -0
- package/dist/context.d.ts +27 -0
- package/dist/context.js +58 -0
- package/dist/core/DatabaseManager.d.ts +108 -0
- package/dist/core/DatabaseManager.js +361 -0
- package/dist/core/QueryProcessor.d.ts +77 -0
- package/dist/core/QueryProcessor.js +262 -0
- package/dist/core/QueryView.d.ts +64 -0
- package/dist/core/QueryView.js +219 -0
- package/dist/core/StoreManager.d.ts +131 -0
- package/dist/core/StoreManager.js +334 -0
- package/dist/core/ViewRegistry.d.ts +20 -0
- package/dist/core/ViewRegistry.js +55 -0
- package/dist/core/index.d.ts +34 -0
- package/dist/core/index.js +59 -0
- package/dist/core/openIDBWithTimeout.d.ts +27 -0
- package/dist/core/openIDBWithTimeout.js +63 -0
- package/dist/core/query-utils.d.ts +37 -0
- package/dist/core/query-utils.js +60 -0
- package/dist/errors.d.ts +235 -0
- package/dist/errors.js +243 -0
- package/dist/index.d.ts +41 -0
- package/dist/index.js +82 -0
- package/dist/interfaces/headless.d.ts +95 -0
- package/dist/interfaces/headless.js +41 -0
- package/dist/interfaces/index.d.ts +321 -0
- package/dist/interfaces/index.js +8 -0
- package/dist/mutators/RecordingTransaction.d.ts +36 -0
- package/dist/mutators/RecordingTransaction.js +216 -0
- package/dist/mutators/Transaction.d.ts +48 -0
- package/dist/mutators/Transaction.js +64 -0
- package/dist/mutators/UndoManager.d.ts +114 -0
- package/dist/mutators/UndoManager.js +143 -0
- package/dist/mutators/defineMutators.d.ts +55 -0
- package/dist/mutators/defineMutators.js +28 -0
- package/dist/policy/index.d.ts +19 -0
- package/dist/policy/index.js +18 -0
- package/dist/policy/types.d.ts +74 -0
- package/dist/policy/types.js +17 -0
- package/dist/principal.d.ts +44 -0
- package/dist/principal.js +49 -0
- package/dist/query/client.d.ts +43 -0
- package/dist/query/client.js +84 -0
- package/dist/query/index.d.ts +6 -0
- package/dist/query/index.js +5 -0
- package/dist/query/types.d.ts +143 -0
- package/dist/query/types.js +36 -0
- package/dist/react/AbloProvider.d.ts +205 -0
- package/dist/react/AbloProvider.js +398 -0
- package/dist/react/ClientSideSuspense.d.ts +36 -0
- package/dist/react/ClientSideSuspense.js +17 -0
- package/dist/react/DefaultFallback.d.ts +24 -0
- package/dist/react/DefaultFallback.js +43 -0
- package/dist/react/SyncGroupProvider.d.ts +19 -0
- package/dist/react/SyncGroupProvider.js +44 -0
- package/dist/react/context.d.ts +161 -0
- package/dist/react/context.js +35 -0
- package/dist/react/index.d.ts +64 -0
- package/dist/react/index.js +73 -0
- package/dist/react/internalContext.d.ts +35 -0
- package/dist/react/internalContext.js +3 -0
- package/dist/react/useAblo.d.ts +72 -0
- package/dist/react/useAblo.js +63 -0
- package/dist/react/useCurrentUserId.d.ts +21 -0
- package/dist/react/useCurrentUserId.js +33 -0
- package/dist/react/useErrorListener.d.ts +20 -0
- package/dist/react/useErrorListener.js +39 -0
- package/dist/react/useIntent.d.ts +29 -0
- package/dist/react/useIntent.js +42 -0
- package/dist/react/useMutate.d.ts +83 -0
- package/dist/react/useMutate.js +122 -0
- package/dist/react/useMutationFailureListener.d.ts +26 -0
- package/dist/react/useMutationFailureListener.js +38 -0
- package/dist/react/useMutators.d.ts +56 -0
- package/dist/react/useMutators.js +66 -0
- package/dist/react/usePresence.d.ts +32 -0
- package/dist/react/usePresence.js +41 -0
- package/dist/react/useQuery.d.ts +123 -0
- package/dist/react/useQuery.js +145 -0
- package/dist/react/useReactive.d.ts +35 -0
- package/dist/react/useReactive.js +111 -0
- package/dist/react/useReader.d.ts +69 -0
- package/dist/react/useReader.js +73 -0
- package/dist/react/useSyncStatus.d.ts +61 -0
- package/dist/react/useSyncStatus.js +76 -0
- package/dist/react/useUndoScope.d.ts +36 -0
- package/dist/react/useUndoScope.js +73 -0
- package/dist/realtime/index.d.ts +10 -0
- package/dist/realtime/index.js +9 -0
- package/dist/schema/field.d.ts +134 -0
- package/dist/schema/field.js +264 -0
- package/dist/schema/index.d.ts +29 -0
- package/dist/schema/index.js +38 -0
- package/dist/schema/model.d.ts +326 -0
- package/dist/schema/model.js +89 -0
- package/dist/schema/queries.d.ts +203 -0
- package/dist/schema/queries.js +145 -0
- package/dist/schema/relation.d.ts +172 -0
- package/dist/schema/relation.js +104 -0
- package/dist/schema/schema.d.ts +259 -0
- package/dist/schema/schema.js +188 -0
- package/dist/schema/sugar.d.ts +129 -0
- package/dist/schema/sugar.js +94 -0
- package/dist/source/index.d.ts +423 -0
- package/dist/source/index.js +320 -0
- package/dist/source/pushQueue.d.ts +112 -0
- package/dist/source/pushQueue.js +249 -0
- package/dist/stores/ObjectStore.d.ts +103 -0
- package/dist/stores/ObjectStore.js +371 -0
- package/dist/stores/ObjectStoreContract.d.ts +39 -0
- package/dist/stores/ObjectStoreContract.js +1 -0
- package/dist/stores/SyncActionStore.d.ts +101 -0
- package/dist/stores/SyncActionStore.js +481 -0
- package/dist/sync/BootstrapHelper.d.ts +127 -0
- package/dist/sync/BootstrapHelper.js +434 -0
- package/dist/sync/ConnectionManager.d.ts +136 -0
- package/dist/sync/ConnectionManager.js +465 -0
- package/dist/sync/HydrationCoordinator.d.ts +137 -0
- package/dist/sync/HydrationCoordinator.js +468 -0
- package/dist/sync/NetworkProbe.d.ts +43 -0
- package/dist/sync/NetworkProbe.js +113 -0
- package/dist/sync/OfflineFlush.d.ts +9 -0
- package/dist/sync/OfflineFlush.js +22 -0
- package/dist/sync/OfflineTransactionStore.d.ts +37 -0
- package/dist/sync/OfflineTransactionStore.js +263 -0
- package/dist/sync/SyncWebSocket.d.ts +663 -0
- package/dist/sync/SyncWebSocket.js +1336 -0
- package/dist/sync/createIntentStream.d.ts +33 -0
- package/dist/sync/createIntentStream.js +243 -0
- package/dist/sync/createPresenceStream.d.ts +46 -0
- package/dist/sync/createPresenceStream.js +192 -0
- package/dist/sync/createSnapshot.d.ts +33 -0
- package/dist/sync/createSnapshot.js +124 -0
- package/dist/sync/participants.d.ts +114 -0
- package/dist/sync/participants.js +336 -0
- package/dist/sync/schemas.d.ts +79 -0
- package/dist/sync/schemas.js +78 -0
- package/dist/testing/fixtures/bootstrap.d.ts +45 -0
- package/dist/testing/fixtures/bootstrap.js +53 -0
- package/dist/testing/fixtures/deltas.d.ts +86 -0
- package/dist/testing/fixtures/deltas.js +139 -0
- package/dist/testing/fixtures/models.d.ts +82 -0
- package/dist/testing/fixtures/models.js +270 -0
- package/dist/testing/helpers/react-wrapper.d.ts +66 -0
- package/dist/testing/helpers/react-wrapper.js +64 -0
- package/dist/testing/helpers/sync-engine-harness.d.ts +55 -0
- package/dist/testing/helpers/sync-engine-harness.js +70 -0
- package/dist/testing/helpers/wait.d.ts +25 -0
- package/dist/testing/helpers/wait.js +44 -0
- package/dist/testing/index.d.ts +21 -0
- package/dist/testing/index.js +32 -0
- package/dist/testing/mocks/MockMutationExecutor.d.ts +65 -0
- package/dist/testing/mocks/MockMutationExecutor.js +139 -0
- package/dist/testing/mocks/MockNetworkMonitor.d.ts +20 -0
- package/dist/testing/mocks/MockNetworkMonitor.js +46 -0
- package/dist/testing/mocks/MockSyncContext.d.ts +64 -0
- package/dist/testing/mocks/MockSyncContext.js +100 -0
- package/dist/testing/mocks/MockSyncStore.d.ts +88 -0
- package/dist/testing/mocks/MockSyncStore.js +171 -0
- package/dist/testing/mocks/MockWebSocket.d.ts +66 -0
- package/dist/testing/mocks/MockWebSocket.js +117 -0
- package/dist/transactions/OptimisticEchoTracker.d.ts +82 -0
- package/dist/transactions/OptimisticEchoTracker.js +104 -0
- package/dist/transactions/TransactionQueue.d.ts +499 -0
- package/dist/transactions/TransactionQueue.js +1895 -0
- package/dist/transactions/index.d.ts +16 -0
- package/dist/transactions/index.js +7 -0
- package/dist/transactions/mutation-error-handler.d.ts +5 -0
- package/dist/transactions/mutation-error-handler.js +39 -0
- package/dist/types/global.d.ts +107 -0
- package/dist/types/global.js +38 -0
- package/dist/types/index.d.ts +241 -0
- package/dist/types/index.js +70 -0
- package/dist/types/streams.d.ts +495 -0
- package/dist/types/streams.js +11 -0
- package/dist/utils/asyncIterator.d.ts +41 -0
- package/dist/utils/asyncIterator.js +142 -0
- package/dist/utils/duration.d.ts +28 -0
- package/dist/utils/duration.js +47 -0
- package/dist/utils/mobx-setup.d.ts +42 -0
- package/dist/utils/mobx-setup.js +381 -0
- package/docs/api-keys.md +24 -0
- package/docs/api.md +230 -0
- package/docs/audit.md +81 -0
- package/docs/capabilities.md +163 -0
- package/docs/client-behavior.md +202 -0
- package/docs/data-sources.md +214 -0
- package/docs/examples/agent-human.md +84 -0
- package/docs/examples/ai-sdk-tool.md +92 -0
- package/docs/examples/existing-python-backend.md +249 -0
- package/docs/examples/nextjs.md +88 -0
- package/docs/examples/server-agent.md +86 -0
- package/docs/guarantees.md +148 -0
- package/docs/index.md +97 -0
- package/docs/integration-guide.md +493 -0
- package/docs/interaction-model.md +140 -0
- package/docs/mcp/claude-code.md +43 -0
- package/docs/mcp/cursor.md +53 -0
- package/docs/mcp/windsurf.md +46 -0
- package/docs/mcp.md +59 -0
- package/docs/quickstart.md +152 -0
- package/docs/react.md +115 -0
- package/docs/roadmap.md +45 -0
- package/examples/README.md +54 -0
- package/examples/data-source/README.md +102 -0
- package/examples/data-source/ablo-driver.ts +89 -0
- package/examples/data-source/customer-server.ts +208 -0
- package/examples/data-source/run.ts +101 -0
- package/examples/data-source/schema.ts +25 -0
- package/examples/quickstart.ts +54 -0
- package/examples/tsconfig.json +16 -0
- package/llms.txt +143 -0
- package/package.json +147 -0
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stateless API client for `Ablo({ apiKey })`.
|
|
3
|
+
*
|
|
4
|
+
* This is the hosted-API product surface: no schema, no object pool, no
|
|
5
|
+
* IndexedDB, no WebSocket. It maps the public Resource / Intent / Commit
|
|
6
|
+
* nouns directly to HTTP routes on sync-server.
|
|
7
|
+
*/
|
|
8
|
+
import type { AbloOptions, CommitReceipt, CommitResource, IntentCreateOptions, IntentHandle, IntentWaitOptions, ResourceClient, ResourceIntent, ResourceMutationOptions, ResourceReadOptions, ResourceRead, ResourceTarget, Turn } from './Ablo.js';
|
|
9
|
+
import type { Duration } from '../utils/duration.js';
|
|
10
|
+
export type AbloApiClientOptions = Omit<AbloOptions, 'schema'> & {
|
|
11
|
+
readonly schema?: null | undefined;
|
|
12
|
+
readonly bootstrapBaseUrl?: string | undefined;
|
|
13
|
+
};
|
|
14
|
+
export interface AbloApiIntents {
|
|
15
|
+
create(options: IntentCreateOptions): Promise<IntentHandle>;
|
|
16
|
+
list(target?: Partial<ResourceTarget>): Promise<readonly ResourceIntent[]>;
|
|
17
|
+
waitFor(target: Partial<ResourceTarget>, options?: IntentWaitOptions): Promise<void>;
|
|
18
|
+
}
|
|
19
|
+
export type CapabilityParticipantKind = 'agent' | 'system';
|
|
20
|
+
export interface CapabilityCreateBaseOptions {
|
|
21
|
+
readonly participantKind?: CapabilityParticipantKind;
|
|
22
|
+
readonly participantId?: string;
|
|
23
|
+
readonly syncGroups: readonly string[];
|
|
24
|
+
readonly operations: readonly string[];
|
|
25
|
+
readonly label?: string;
|
|
26
|
+
readonly wideScope?: boolean;
|
|
27
|
+
readonly userMeta?: Record<string, unknown>;
|
|
28
|
+
}
|
|
29
|
+
export interface CapabilityCreateOptions extends CapabilityCreateBaseOptions {
|
|
30
|
+
/**
|
|
31
|
+
* Preferred public name. A capability is a lease; the SDK and server
|
|
32
|
+
* clean it up when the run finishes or when the lease expires.
|
|
33
|
+
*/
|
|
34
|
+
readonly lease?: Duration;
|
|
35
|
+
readonly leaseSeconds?: number;
|
|
36
|
+
/** @deprecated Use `lease`. */
|
|
37
|
+
readonly ttl?: Duration;
|
|
38
|
+
/** @deprecated Use `leaseSeconds`. */
|
|
39
|
+
readonly ttlSeconds?: number;
|
|
40
|
+
}
|
|
41
|
+
export interface CapabilityScope {
|
|
42
|
+
readonly organizationId: string;
|
|
43
|
+
readonly syncGroups: readonly string[];
|
|
44
|
+
readonly operations: readonly string[];
|
|
45
|
+
readonly participantKind: CapabilityParticipantKind;
|
|
46
|
+
readonly participantId: string;
|
|
47
|
+
}
|
|
48
|
+
export interface Capability {
|
|
49
|
+
readonly id: string;
|
|
50
|
+
readonly token: string;
|
|
51
|
+
readonly expiresAt: string;
|
|
52
|
+
readonly organizationId: string;
|
|
53
|
+
readonly scope: CapabilityScope;
|
|
54
|
+
readonly userMeta?: Record<string, unknown>;
|
|
55
|
+
client(): AbloApi;
|
|
56
|
+
}
|
|
57
|
+
export interface CapabilityRecord {
|
|
58
|
+
readonly id: string;
|
|
59
|
+
readonly organizationId: string;
|
|
60
|
+
readonly participantKind: CapabilityParticipantKind;
|
|
61
|
+
readonly participantId: string;
|
|
62
|
+
readonly label: string | null;
|
|
63
|
+
readonly status: 'active' | 'expired' | 'revoked';
|
|
64
|
+
readonly issuedAt: string;
|
|
65
|
+
readonly expiresAt: string;
|
|
66
|
+
readonly revokedAt: string | null;
|
|
67
|
+
readonly lastUsedAt: string | null;
|
|
68
|
+
readonly operations: readonly string[];
|
|
69
|
+
readonly syncGroups: readonly string[];
|
|
70
|
+
}
|
|
71
|
+
export interface CapabilityRevocation {
|
|
72
|
+
readonly id: string;
|
|
73
|
+
readonly deleted: boolean;
|
|
74
|
+
readonly activeSessionsClosed?: number;
|
|
75
|
+
}
|
|
76
|
+
export interface CapabilityResource {
|
|
77
|
+
create(options: CapabilityCreateOptions): Promise<Capability>;
|
|
78
|
+
retrieve(id: string): Promise<CapabilityRecord>;
|
|
79
|
+
revoke(id: string): Promise<CapabilityRevocation>;
|
|
80
|
+
/**
|
|
81
|
+
* Alias for `create`. Kept because "mint" is common capability-token
|
|
82
|
+
* language, but `create` is the canonical SDK verb.
|
|
83
|
+
*/
|
|
84
|
+
mint(options: CapabilityCreateOptions): Promise<Capability>;
|
|
85
|
+
}
|
|
86
|
+
export interface TaskCreateOptions {
|
|
87
|
+
readonly prompt: string;
|
|
88
|
+
readonly parentTaskId?: string;
|
|
89
|
+
readonly surface?: string;
|
|
90
|
+
readonly metadata?: Record<string, unknown>;
|
|
91
|
+
}
|
|
92
|
+
export interface TaskCloseOptions {
|
|
93
|
+
readonly costInputTokens?: number;
|
|
94
|
+
readonly costOutputTokens?: number;
|
|
95
|
+
readonly costComputeMs?: number;
|
|
96
|
+
}
|
|
97
|
+
export interface Task {
|
|
98
|
+
readonly id: string;
|
|
99
|
+
readonly turnId: string;
|
|
100
|
+
readonly promptHash?: string;
|
|
101
|
+
readonly openedAt?: string;
|
|
102
|
+
close(stats?: TaskCloseOptions): Promise<TaskCloseResult>;
|
|
103
|
+
}
|
|
104
|
+
export interface TaskCloseResult {
|
|
105
|
+
readonly id: string;
|
|
106
|
+
readonly turnId: string;
|
|
107
|
+
readonly closed: boolean;
|
|
108
|
+
readonly alreadyClosed?: boolean;
|
|
109
|
+
readonly endedAt?: string;
|
|
110
|
+
}
|
|
111
|
+
export interface TaskResource {
|
|
112
|
+
create(options: TaskCreateOptions): Promise<Task>;
|
|
113
|
+
close(id: string, stats?: TaskCloseOptions): Promise<TaskCloseResult>;
|
|
114
|
+
/**
|
|
115
|
+
* Alias for `create`. Kept for the agent-run vocabulary; `create` is
|
|
116
|
+
* the canonical SDK verb.
|
|
117
|
+
*/
|
|
118
|
+
open(options: TaskCreateOptions): Promise<Task>;
|
|
119
|
+
}
|
|
120
|
+
export interface AgentOptions {
|
|
121
|
+
readonly can: readonly string[];
|
|
122
|
+
readonly syncGroups?: readonly string[];
|
|
123
|
+
readonly label?: string;
|
|
124
|
+
readonly userMeta?: Record<string, unknown>;
|
|
125
|
+
/**
|
|
126
|
+
* Internal lease for the run capability. Most callers should omit it.
|
|
127
|
+
* The SDK revokes the capability when `run` finishes; the lease exists
|
|
128
|
+
* to clean up crashed or abandoned runs.
|
|
129
|
+
*/
|
|
130
|
+
readonly lease?: Duration;
|
|
131
|
+
readonly leaseSeconds?: number;
|
|
132
|
+
}
|
|
133
|
+
export interface AgentRunOptions extends TaskCreateOptions {
|
|
134
|
+
readonly signal?: AbortSignal;
|
|
135
|
+
readonly costInputTokens?: number;
|
|
136
|
+
readonly costOutputTokens?: number;
|
|
137
|
+
readonly costComputeMs?: number;
|
|
138
|
+
}
|
|
139
|
+
export type AgentRunStatus = 'done' | 'failed' | 'cancelled';
|
|
140
|
+
export interface AgentRunDone<T> {
|
|
141
|
+
readonly status: 'done';
|
|
142
|
+
readonly task: Task;
|
|
143
|
+
readonly value: T;
|
|
144
|
+
}
|
|
145
|
+
export interface AgentRunFailed {
|
|
146
|
+
readonly status: 'failed';
|
|
147
|
+
readonly task?: Task;
|
|
148
|
+
readonly error: unknown;
|
|
149
|
+
}
|
|
150
|
+
export interface AgentRunCancelled {
|
|
151
|
+
readonly status: 'cancelled';
|
|
152
|
+
readonly task?: Task;
|
|
153
|
+
readonly error?: unknown;
|
|
154
|
+
}
|
|
155
|
+
export type AgentRunResult<T> = AgentRunDone<T> | AgentRunFailed | AgentRunCancelled;
|
|
156
|
+
export interface AgentIntentOptions {
|
|
157
|
+
readonly action: string;
|
|
158
|
+
readonly field?: string;
|
|
159
|
+
readonly ttl?: Duration;
|
|
160
|
+
readonly target?: Partial<ResourceTarget>;
|
|
161
|
+
}
|
|
162
|
+
export type AgentIntentInput = string | AgentIntentOptions;
|
|
163
|
+
export interface AgentResourceReadOptions extends ResourceReadOptions {
|
|
164
|
+
}
|
|
165
|
+
export interface AgentResourceMutationOptions extends Omit<ResourceMutationOptions, 'intent'> {
|
|
166
|
+
readonly intent?: AgentIntentInput | {
|
|
167
|
+
readonly id: string;
|
|
168
|
+
} | null;
|
|
169
|
+
}
|
|
170
|
+
export interface AgentResourceClient<T = Record<string, unknown>> {
|
|
171
|
+
retrieve(id: string, options?: AgentResourceReadOptions): Promise<ResourceRead<T>>;
|
|
172
|
+
create(data: Record<string, unknown>, options?: AgentResourceMutationOptions & {
|
|
173
|
+
readonly id?: string | null;
|
|
174
|
+
}): Promise<CommitReceipt>;
|
|
175
|
+
update(id: string, data: Record<string, unknown>, options?: AgentResourceMutationOptions): Promise<CommitReceipt>;
|
|
176
|
+
delete(id: string, options?: AgentResourceMutationOptions): Promise<CommitReceipt>;
|
|
177
|
+
}
|
|
178
|
+
export interface AgentRunContext {
|
|
179
|
+
readonly task: Task;
|
|
180
|
+
readonly ablo: AbloApi;
|
|
181
|
+
resource<T = Record<string, unknown>>(name: string): AgentResourceClient<T>;
|
|
182
|
+
}
|
|
183
|
+
export interface Agent {
|
|
184
|
+
readonly id: string;
|
|
185
|
+
run<T>(options: AgentRunOptions, handler: (context: AgentRunContext) => Promise<T> | T): Promise<AgentRunResult<T>>;
|
|
186
|
+
}
|
|
187
|
+
export interface AbloApi {
|
|
188
|
+
ready(): Promise<void>;
|
|
189
|
+
waitForFlush(): Promise<void>;
|
|
190
|
+
dispose(): Promise<void>;
|
|
191
|
+
purge(): Promise<void>;
|
|
192
|
+
readonly capabilities: CapabilityResource;
|
|
193
|
+
readonly tasks: TaskResource;
|
|
194
|
+
readonly intents: AbloApiIntents;
|
|
195
|
+
readonly commits: CommitResource;
|
|
196
|
+
agent(id: string, options: AgentOptions): Agent;
|
|
197
|
+
resource<T = Record<string, unknown>>(name: string): ResourceClient<T>;
|
|
198
|
+
beginTurn(options: TaskCreateOptions): Promise<Turn>;
|
|
199
|
+
}
|
|
200
|
+
export declare function createProtocolClient(options: AbloApiClientOptions): AbloApi;
|