ankka 0.7.1 → 0.9.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/dist/_proto/ankka/protocol/v1/agent_pb.d.ts +95 -0
- package/dist/_proto/ankka/protocol/v1/agent_pb.js +16 -1
- package/dist/_proto/ankka/protocol/v1/discovery_pb.d.ts +235 -1
- package/dist/_proto/ankka/protocol/v1/discovery_pb.js +45 -5
- package/dist/_proto/ankka/protocol/v1/endpoint_pb.d.ts +63 -0
- package/dist/_proto/ankka/protocol/v1/endpoint_pb.js +15 -5
- package/dist/_proto/ankka/protocol/v1/wasm_pb.d.ts +307 -0
- package/dist/_proto/ankka/protocol/v1/wasm_pb.js +72 -0
- package/dist/autonomous.d.ts +154 -0
- package/dist/autonomous.js +199 -0
- package/dist/client.d.ts +13 -0
- package/dist/client.js +49 -0
- package/dist/context.d.ts +15 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.js +2 -1
- package/dist/kinds.d.ts +1 -1
- package/dist/kinds.js +1 -0
- package/dist/routes.d.ts +41 -5
- package/dist/routes.js +24 -1
- package/dist/server/agent.d.ts +8 -2
- package/dist/server/agent.js +59 -2
- package/dist/server/http.js +13 -0
- package/dist/service.d.ts +11 -1
- package/dist/service.js +46 -5
- package/dist/spec.d.ts +6 -3
- package/dist/spec.js +62 -6
- package/dist/testkit/integration.js +5 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
import type { GenFile, GenMessage } from "@bufbuild/protobuf/codegenv2";
|
|
2
|
+
import type { Failure, Payload } from "./payload_pb.ts";
|
|
3
|
+
import type { Kind, Spec } from "./discovery_pb.ts";
|
|
4
|
+
import type { EventSourcedIn_Command, EventSourcedOut_Reply } from "./event_sourced_pb.ts";
|
|
5
|
+
import type { KeyValueIn_Command, KeyValueOut_Reply } from "./key_value_pb.ts";
|
|
6
|
+
import type { WorkflowIn_Command, WorkflowIn_RunStep, WorkflowOut_Reply, WorkflowOut_StepReply } from "./workflow_pb.ts";
|
|
7
|
+
import type { StreamToken } from "./client_pb.ts";
|
|
8
|
+
import type { Message } from "@bufbuild/protobuf";
|
|
9
|
+
/**
|
|
10
|
+
* Describes the file ankka/protocol/v1/wasm.proto.
|
|
11
|
+
*/
|
|
12
|
+
export declare const file_ankka_protocol_v1_wasm: GenFile;
|
|
13
|
+
/**
|
|
14
|
+
* What ankka1_discover answers.
|
|
15
|
+
*
|
|
16
|
+
* @generated from message ankka.protocol.v1.WasmSpec
|
|
17
|
+
*/
|
|
18
|
+
export type WasmSpec = Message<"ankka.protocol.v1.WasmSpec"> & {
|
|
19
|
+
/**
|
|
20
|
+
* @generated from field: ankka.protocol.v1.Spec spec = 1;
|
|
21
|
+
*/
|
|
22
|
+
spec?: Spec | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* component ids that keep their state between calls
|
|
25
|
+
*
|
|
26
|
+
* @generated from field: repeated string stateful = 2;
|
|
27
|
+
*/
|
|
28
|
+
stateful: string[];
|
|
29
|
+
/**
|
|
30
|
+
* "1": must match the exports' prefix
|
|
31
|
+
*
|
|
32
|
+
* @generated from field: string abi_version = 3;
|
|
33
|
+
*/
|
|
34
|
+
abiVersion: string;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Describes the message ankka.protocol.v1.WasmSpec.
|
|
38
|
+
* Use `create(WasmSpecSchema)` to create a new message.
|
|
39
|
+
*/
|
|
40
|
+
export declare const WasmSpecSchema: GenMessage<WasmSpec>;
|
|
41
|
+
/**
|
|
42
|
+
* An entity or workflow command, with the state the runtime holds for it.
|
|
43
|
+
*
|
|
44
|
+
* @generated from message ankka.protocol.v1.HandleRequest
|
|
45
|
+
*/
|
|
46
|
+
export type HandleRequest = Message<"ankka.protocol.v1.HandleRequest"> & {
|
|
47
|
+
/**
|
|
48
|
+
* @generated from field: ankka.protocol.v1.Kind kind = 1;
|
|
49
|
+
*/
|
|
50
|
+
kind: Kind;
|
|
51
|
+
/**
|
|
52
|
+
* @generated from field: string component_id = 2;
|
|
53
|
+
*/
|
|
54
|
+
componentId: string;
|
|
55
|
+
/**
|
|
56
|
+
* @generated from field: string entity_id = 3;
|
|
57
|
+
*/
|
|
58
|
+
entityId: string;
|
|
59
|
+
/**
|
|
60
|
+
* stateless: always, absent when fresh; stateful: first call after open
|
|
61
|
+
*
|
|
62
|
+
* @generated from field: optional ankka.protocol.v1.Payload state = 4;
|
|
63
|
+
*/
|
|
64
|
+
state?: Payload | undefined;
|
|
65
|
+
/**
|
|
66
|
+
* @generated from oneof ankka.protocol.v1.HandleRequest.command
|
|
67
|
+
*/
|
|
68
|
+
command: {
|
|
69
|
+
/**
|
|
70
|
+
* @generated from field: ankka.protocol.v1.EventSourcedIn.Command event_sourced = 10;
|
|
71
|
+
*/
|
|
72
|
+
value: EventSourcedIn_Command;
|
|
73
|
+
case: "eventSourced";
|
|
74
|
+
} | {
|
|
75
|
+
/**
|
|
76
|
+
* @generated from field: ankka.protocol.v1.KeyValueIn.Command key_value = 11;
|
|
77
|
+
*/
|
|
78
|
+
value: KeyValueIn_Command;
|
|
79
|
+
case: "keyValue";
|
|
80
|
+
} | {
|
|
81
|
+
/**
|
|
82
|
+
* @generated from field: ankka.protocol.v1.WorkflowIn.Command workflow = 12;
|
|
83
|
+
*/
|
|
84
|
+
value: WorkflowIn_Command;
|
|
85
|
+
case: "workflow";
|
|
86
|
+
} | {
|
|
87
|
+
case: undefined;
|
|
88
|
+
value?: undefined;
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
/**
|
|
92
|
+
* Describes the message ankka.protocol.v1.HandleRequest.
|
|
93
|
+
* Use `create(HandleRequestSchema)` to create a new message.
|
|
94
|
+
*/
|
|
95
|
+
export declare const HandleRequestSchema: GenMessage<HandleRequest>;
|
|
96
|
+
/**
|
|
97
|
+
* @generated from message ankka.protocol.v1.HandleReply
|
|
98
|
+
*/
|
|
99
|
+
export type HandleReply = Message<"ankka.protocol.v1.HandleReply"> & {
|
|
100
|
+
/**
|
|
101
|
+
* @generated from oneof ankka.protocol.v1.HandleReply.reply
|
|
102
|
+
*/
|
|
103
|
+
reply: {
|
|
104
|
+
/**
|
|
105
|
+
* @generated from field: ankka.protocol.v1.EventSourcedOut.Reply event_sourced = 10;
|
|
106
|
+
*/
|
|
107
|
+
value: EventSourcedOut_Reply;
|
|
108
|
+
case: "eventSourced";
|
|
109
|
+
} | {
|
|
110
|
+
/**
|
|
111
|
+
* @generated from field: ankka.protocol.v1.KeyValueOut.Reply key_value = 11;
|
|
112
|
+
*/
|
|
113
|
+
value: KeyValueOut_Reply;
|
|
114
|
+
case: "keyValue";
|
|
115
|
+
} | {
|
|
116
|
+
/**
|
|
117
|
+
* @generated from field: ankka.protocol.v1.WorkflowOut.Reply workflow = 12;
|
|
118
|
+
*/
|
|
119
|
+
value: WorkflowOut_Reply;
|
|
120
|
+
case: "workflow";
|
|
121
|
+
} | {
|
|
122
|
+
case: undefined;
|
|
123
|
+
value?: undefined;
|
|
124
|
+
};
|
|
125
|
+
/**
|
|
126
|
+
* the state after the command, in both shapes
|
|
127
|
+
*
|
|
128
|
+
* @generated from field: optional ankka.protocol.v1.Payload state = 2;
|
|
129
|
+
*/
|
|
130
|
+
state?: Payload | undefined;
|
|
131
|
+
/**
|
|
132
|
+
* a fault: nothing in the reply applies
|
|
133
|
+
*
|
|
134
|
+
* @generated from field: optional ankka.protocol.v1.Failure failure = 3;
|
|
135
|
+
*/
|
|
136
|
+
failure?: Failure | undefined;
|
|
137
|
+
};
|
|
138
|
+
/**
|
|
139
|
+
* Describes the message ankka.protocol.v1.HandleReply.
|
|
140
|
+
* Use `create(HandleReplySchema)` to create a new message.
|
|
141
|
+
*/
|
|
142
|
+
export declare const HandleReplySchema: GenMessage<HandleReply>;
|
|
143
|
+
/**
|
|
144
|
+
* One journaled event applied to an event sourced entity's state, on replay. (A command's reply
|
|
145
|
+
* already carries the state after its events, so nothing else is folded.)
|
|
146
|
+
*
|
|
147
|
+
* @generated from message ankka.protocol.v1.FoldRequest
|
|
148
|
+
*/
|
|
149
|
+
export type FoldRequest = Message<"ankka.protocol.v1.FoldRequest"> & {
|
|
150
|
+
/**
|
|
151
|
+
* @generated from field: string component_id = 1;
|
|
152
|
+
*/
|
|
153
|
+
componentId: string;
|
|
154
|
+
/**
|
|
155
|
+
* @generated from field: string entity_id = 2;
|
|
156
|
+
*/
|
|
157
|
+
entityId: string;
|
|
158
|
+
/**
|
|
159
|
+
* @generated from field: optional ankka.protocol.v1.Payload state = 3;
|
|
160
|
+
*/
|
|
161
|
+
state?: Payload | undefined;
|
|
162
|
+
/**
|
|
163
|
+
* @generated from field: ankka.protocol.v1.Payload event = 4;
|
|
164
|
+
*/
|
|
165
|
+
event?: Payload | undefined;
|
|
166
|
+
/**
|
|
167
|
+
* @generated from field: int64 sequence = 5;
|
|
168
|
+
*/
|
|
169
|
+
sequence: bigint;
|
|
170
|
+
};
|
|
171
|
+
/**
|
|
172
|
+
* Describes the message ankka.protocol.v1.FoldRequest.
|
|
173
|
+
* Use `create(FoldRequestSchema)` to create a new message.
|
|
174
|
+
*/
|
|
175
|
+
export declare const FoldRequestSchema: GenMessage<FoldRequest>;
|
|
176
|
+
/**
|
|
177
|
+
* @generated from message ankka.protocol.v1.FoldReply
|
|
178
|
+
*/
|
|
179
|
+
export type FoldReply = Message<"ankka.protocol.v1.FoldReply"> & {
|
|
180
|
+
/**
|
|
181
|
+
* @generated from field: ankka.protocol.v1.Payload state = 1;
|
|
182
|
+
*/
|
|
183
|
+
state?: Payload | undefined;
|
|
184
|
+
/**
|
|
185
|
+
* @generated from field: optional ankka.protocol.v1.Failure failure = 2;
|
|
186
|
+
*/
|
|
187
|
+
failure?: Failure | undefined;
|
|
188
|
+
};
|
|
189
|
+
/**
|
|
190
|
+
* Describes the message ankka.protocol.v1.FoldReply.
|
|
191
|
+
* Use `create(FoldReplySchema)` to create a new message.
|
|
192
|
+
*/
|
|
193
|
+
export declare const FoldReplySchema: GenMessage<FoldReply>;
|
|
194
|
+
/**
|
|
195
|
+
* @generated from message ankka.protocol.v1.StepRequest
|
|
196
|
+
*/
|
|
197
|
+
export type StepRequest = Message<"ankka.protocol.v1.StepRequest"> & {
|
|
198
|
+
/**
|
|
199
|
+
* @generated from field: string component_id = 1;
|
|
200
|
+
*/
|
|
201
|
+
componentId: string;
|
|
202
|
+
/**
|
|
203
|
+
* @generated from field: string entity_id = 2;
|
|
204
|
+
*/
|
|
205
|
+
entityId: string;
|
|
206
|
+
/**
|
|
207
|
+
* @generated from field: optional ankka.protocol.v1.Payload state = 3;
|
|
208
|
+
*/
|
|
209
|
+
state?: Payload | undefined;
|
|
210
|
+
/**
|
|
211
|
+
* @generated from field: ankka.protocol.v1.WorkflowIn.RunStep run_step = 4;
|
|
212
|
+
*/
|
|
213
|
+
runStep?: WorkflowIn_RunStep | undefined;
|
|
214
|
+
};
|
|
215
|
+
/**
|
|
216
|
+
* Describes the message ankka.protocol.v1.StepRequest.
|
|
217
|
+
* Use `create(StepRequestSchema)` to create a new message.
|
|
218
|
+
*/
|
|
219
|
+
export declare const StepRequestSchema: GenMessage<StepRequest>;
|
|
220
|
+
/**
|
|
221
|
+
* @generated from message ankka.protocol.v1.StepReply
|
|
222
|
+
*/
|
|
223
|
+
export type StepReply = Message<"ankka.protocol.v1.StepReply"> & {
|
|
224
|
+
/**
|
|
225
|
+
* @generated from field: ankka.protocol.v1.WorkflowOut.StepReply reply = 1;
|
|
226
|
+
*/
|
|
227
|
+
reply?: WorkflowOut_StepReply | undefined;
|
|
228
|
+
/**
|
|
229
|
+
* @generated from field: optional ankka.protocol.v1.Payload state = 2;
|
|
230
|
+
*/
|
|
231
|
+
state?: Payload | undefined;
|
|
232
|
+
/**
|
|
233
|
+
* @generated from field: optional ankka.protocol.v1.Failure failure = 3;
|
|
234
|
+
*/
|
|
235
|
+
failure?: Failure | undefined;
|
|
236
|
+
};
|
|
237
|
+
/**
|
|
238
|
+
* Describes the message ankka.protocol.v1.StepReply.
|
|
239
|
+
* Use `create(StepReplySchema)` to create a new message.
|
|
240
|
+
*/
|
|
241
|
+
export declare const StepReplySchema: GenMessage<StepReply>;
|
|
242
|
+
/**
|
|
243
|
+
* ankka1_close: a stateful guest drops what it holds for the instance.
|
|
244
|
+
*
|
|
245
|
+
* @generated from message ankka.protocol.v1.Passivate
|
|
246
|
+
*/
|
|
247
|
+
export type Passivate = Message<"ankka.protocol.v1.Passivate"> & {
|
|
248
|
+
/**
|
|
249
|
+
* @generated from field: string component_id = 1;
|
|
250
|
+
*/
|
|
251
|
+
componentId: string;
|
|
252
|
+
/**
|
|
253
|
+
* @generated from field: string entity_id = 2;
|
|
254
|
+
*/
|
|
255
|
+
entityId: string;
|
|
256
|
+
};
|
|
257
|
+
/**
|
|
258
|
+
* Describes the message ankka.protocol.v1.Passivate.
|
|
259
|
+
* Use `create(PassivateSchema)` to create a new message.
|
|
260
|
+
*/
|
|
261
|
+
export declare const PassivateSchema: GenMessage<Passivate>;
|
|
262
|
+
/**
|
|
263
|
+
* The config import: one of the descriptor's variables. A reserved name answers absent.
|
|
264
|
+
*
|
|
265
|
+
* @generated from message ankka.protocol.v1.ConfigRequest
|
|
266
|
+
*/
|
|
267
|
+
export type ConfigRequest = Message<"ankka.protocol.v1.ConfigRequest"> & {
|
|
268
|
+
/**
|
|
269
|
+
* @generated from field: string name = 1;
|
|
270
|
+
*/
|
|
271
|
+
name: string;
|
|
272
|
+
};
|
|
273
|
+
/**
|
|
274
|
+
* Describes the message ankka.protocol.v1.ConfigRequest.
|
|
275
|
+
* Use `create(ConfigRequestSchema)` to create a new message.
|
|
276
|
+
*/
|
|
277
|
+
export declare const ConfigRequestSchema: GenMessage<ConfigRequest>;
|
|
278
|
+
/**
|
|
279
|
+
* @generated from message ankka.protocol.v1.ConfigReply
|
|
280
|
+
*/
|
|
281
|
+
export type ConfigReply = Message<"ankka.protocol.v1.ConfigReply"> & {
|
|
282
|
+
/**
|
|
283
|
+
* @generated from field: optional string value = 1;
|
|
284
|
+
*/
|
|
285
|
+
value?: string | undefined;
|
|
286
|
+
};
|
|
287
|
+
/**
|
|
288
|
+
* Describes the message ankka.protocol.v1.ConfigReply.
|
|
289
|
+
* Use `create(ConfigReplySchema)` to create a new message.
|
|
290
|
+
*/
|
|
291
|
+
export declare const ConfigReplySchema: GenMessage<ConfigReply>;
|
|
292
|
+
/**
|
|
293
|
+
* The invoke_stream import: a streaming reply, delivered whole.
|
|
294
|
+
*
|
|
295
|
+
* @generated from message ankka.protocol.v1.StreamTokens
|
|
296
|
+
*/
|
|
297
|
+
export type StreamTokens = Message<"ankka.protocol.v1.StreamTokens"> & {
|
|
298
|
+
/**
|
|
299
|
+
* @generated from field: repeated ankka.protocol.v1.StreamToken tokens = 1;
|
|
300
|
+
*/
|
|
301
|
+
tokens: StreamToken[];
|
|
302
|
+
};
|
|
303
|
+
/**
|
|
304
|
+
* Describes the message ankka.protocol.v1.StreamTokens.
|
|
305
|
+
* Use `create(StreamTokensSchema)` to create a new message.
|
|
306
|
+
*/
|
|
307
|
+
export declare const StreamTokensSchema: GenMessage<StreamTokens>;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
// The module mode's envelope. A WebAssembly module speaks the protocol's own messages across its
|
|
2
|
+
// linear memory rather than over gRPC streams, and these are the few messages that mode needs on
|
|
3
|
+
// top of them: the spec a module declares, and the requests and replies that carry the state the
|
|
4
|
+
// runtime holds for it. WASM-ABI.md says how they cross and which export takes which.
|
|
5
|
+
//
|
|
6
|
+
// Additive: no message in the other files changes for this one, and a process never sees these.
|
|
7
|
+
import { fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv2";
|
|
8
|
+
import { file_ankka_protocol_v1_payload } from "./payload_pb.js";
|
|
9
|
+
import { file_ankka_protocol_v1_discovery } from "./discovery_pb.js";
|
|
10
|
+
import { file_ankka_protocol_v1_event_sourced } from "./event_sourced_pb.js";
|
|
11
|
+
import { file_ankka_protocol_v1_key_value } from "./key_value_pb.js";
|
|
12
|
+
import { file_ankka_protocol_v1_workflow } from "./workflow_pb.js";
|
|
13
|
+
import { file_ankka_protocol_v1_client } from "./client_pb.js";
|
|
14
|
+
/**
|
|
15
|
+
* Describes the file ankka/protocol/v1/wasm.proto.
|
|
16
|
+
*/
|
|
17
|
+
export const file_ankka_protocol_v1_wasm = /*@__PURE__*/ fileDesc("ChxhbmtrYS9wcm90b2NvbC92MS93YXNtLnByb3RvEhFhbmtrYS5wcm90b2NvbC52MSJYCghXYXNtU3BlYxIlCgRzcGVjGAEgASgLMhcuYW5ra2EucHJvdG9jb2wudjEuU3BlYxIQCghzdGF0ZWZ1bBgCIAMoCRITCgthYmlfdmVyc2lvbhgDIAEoCSLfAgoNSGFuZGxlUmVxdWVzdBIlCgRraW5kGAEgASgOMhcuYW5ra2EucHJvdG9jb2wudjEuS2luZBIUCgxjb21wb25lbnRfaWQYAiABKAkSEQoJZW50aXR5X2lkGAMgASgJEi4KBXN0YXRlGAQgASgLMhouYW5ra2EucHJvdG9jb2wudjEuUGF5bG9hZEgBiAEBEkIKDWV2ZW50X3NvdXJjZWQYCiABKAsyKS5hbmtrYS5wcm90b2NvbC52MS5FdmVudFNvdXJjZWRJbi5Db21tYW5kSAASOgoJa2V5X3ZhbHVlGAsgASgLMiUuYW5ra2EucHJvdG9jb2wudjEuS2V5VmFsdWVJbi5Db21tYW5kSAASOQoId29ya2Zsb3cYDCABKAsyJS5hbmtrYS5wcm90b2NvbC52MS5Xb3JrZmxvd0luLkNvbW1hbmRIAEIJCgdjb21tYW5kQggKBl9zdGF0ZSLGAgoLSGFuZGxlUmVwbHkSQQoNZXZlbnRfc291cmNlZBgKIAEoCzIoLmFua2thLnByb3RvY29sLnYxLkV2ZW50U291cmNlZE91dC5SZXBseUgAEjkKCWtleV92YWx1ZRgLIAEoCzIkLmFua2thLnByb3RvY29sLnYxLktleVZhbHVlT3V0LlJlcGx5SAASOAoId29ya2Zsb3cYDCABKAsyJC5hbmtrYS5wcm90b2NvbC52MS5Xb3JrZmxvd091dC5SZXBseUgAEi4KBXN0YXRlGAIgASgLMhouYW5ra2EucHJvdG9jb2wudjEuUGF5bG9hZEgBiAEBEjAKB2ZhaWx1cmUYAyABKAsyGi5hbmtrYS5wcm90b2NvbC52MS5GYWlsdXJlSAKIAQFCBwoFcmVwbHlCCAoGX3N0YXRlQgoKCF9mYWlsdXJlIq0BCgtGb2xkUmVxdWVzdBIUCgxjb21wb25lbnRfaWQYASABKAkSEQoJZW50aXR5X2lkGAIgASgJEi4KBXN0YXRlGAMgASgLMhouYW5ra2EucHJvdG9jb2wudjEuUGF5bG9hZEgAiAEBEikKBWV2ZW50GAQgASgLMhouYW5ra2EucHJvdG9jb2wudjEuUGF5bG9hZBIQCghzZXF1ZW5jZRgFIAEoA0IICgZfc3RhdGUidAoJRm9sZFJlcGx5EikKBXN0YXRlGAEgASgLMhouYW5ra2EucHJvdG9jb2wudjEuUGF5bG9hZBIwCgdmYWlsdXJlGAIgASgLMhouYW5ra2EucHJvdG9jb2wudjEuRmFpbHVyZUgAiAEBQgoKCF9mYWlsdXJlIqkBCgtTdGVwUmVxdWVzdBIUCgxjb21wb25lbnRfaWQYASABKAkSEQoJZW50aXR5X2lkGAIgASgJEi4KBXN0YXRlGAMgASgLMhouYW5ra2EucHJvdG9jb2wudjEuUGF5bG9hZEgAiAEBEjcKCHJ1bl9zdGVwGAQgASgLMiUuYW5ra2EucHJvdG9jb2wudjEuV29ya2Zsb3dJbi5SdW5TdGVwQggKBl9zdGF0ZSK8AQoJU3RlcFJlcGx5EjcKBXJlcGx5GAEgASgLMiguYW5ra2EucHJvdG9jb2wudjEuV29ya2Zsb3dPdXQuU3RlcFJlcGx5Ei4KBXN0YXRlGAIgASgLMhouYW5ra2EucHJvdG9jb2wudjEuUGF5bG9hZEgAiAEBEjAKB2ZhaWx1cmUYAyABKAsyGi5hbmtrYS5wcm90b2NvbC52MS5GYWlsdXJlSAGIAQFCCAoGX3N0YXRlQgoKCF9mYWlsdXJlIjQKCVBhc3NpdmF0ZRIUCgxjb21wb25lbnRfaWQYASABKAkSEQoJZW50aXR5X2lkGAIgASgJIh0KDUNvbmZpZ1JlcXVlc3QSDAoEbmFtZRgBIAEoCSIrCgtDb25maWdSZXBseRISCgV2YWx1ZRgBIAEoCUgAiAEBQggKBl92YWx1ZSI+CgxTdHJlYW1Ub2tlbnMSLgoGdG9rZW5zGAEgAygLMh4uYW5ra2EucHJvdG9jb2wudjEuU3RyZWFtVG9rZW5iBnByb3RvMw", [file_ankka_protocol_v1_payload, file_ankka_protocol_v1_discovery, file_ankka_protocol_v1_event_sourced, file_ankka_protocol_v1_key_value, file_ankka_protocol_v1_workflow, file_ankka_protocol_v1_client]);
|
|
18
|
+
/**
|
|
19
|
+
* Describes the message ankka.protocol.v1.WasmSpec.
|
|
20
|
+
* Use `create(WasmSpecSchema)` to create a new message.
|
|
21
|
+
*/
|
|
22
|
+
export const WasmSpecSchema = /*@__PURE__*/ messageDesc(file_ankka_protocol_v1_wasm, 0);
|
|
23
|
+
/**
|
|
24
|
+
* Describes the message ankka.protocol.v1.HandleRequest.
|
|
25
|
+
* Use `create(HandleRequestSchema)` to create a new message.
|
|
26
|
+
*/
|
|
27
|
+
export const HandleRequestSchema = /*@__PURE__*/ messageDesc(file_ankka_protocol_v1_wasm, 1);
|
|
28
|
+
/**
|
|
29
|
+
* Describes the message ankka.protocol.v1.HandleReply.
|
|
30
|
+
* Use `create(HandleReplySchema)` to create a new message.
|
|
31
|
+
*/
|
|
32
|
+
export const HandleReplySchema = /*@__PURE__*/ messageDesc(file_ankka_protocol_v1_wasm, 2);
|
|
33
|
+
/**
|
|
34
|
+
* Describes the message ankka.protocol.v1.FoldRequest.
|
|
35
|
+
* Use `create(FoldRequestSchema)` to create a new message.
|
|
36
|
+
*/
|
|
37
|
+
export const FoldRequestSchema = /*@__PURE__*/ messageDesc(file_ankka_protocol_v1_wasm, 3);
|
|
38
|
+
/**
|
|
39
|
+
* Describes the message ankka.protocol.v1.FoldReply.
|
|
40
|
+
* Use `create(FoldReplySchema)` to create a new message.
|
|
41
|
+
*/
|
|
42
|
+
export const FoldReplySchema = /*@__PURE__*/ messageDesc(file_ankka_protocol_v1_wasm, 4);
|
|
43
|
+
/**
|
|
44
|
+
* Describes the message ankka.protocol.v1.StepRequest.
|
|
45
|
+
* Use `create(StepRequestSchema)` to create a new message.
|
|
46
|
+
*/
|
|
47
|
+
export const StepRequestSchema = /*@__PURE__*/ messageDesc(file_ankka_protocol_v1_wasm, 5);
|
|
48
|
+
/**
|
|
49
|
+
* Describes the message ankka.protocol.v1.StepReply.
|
|
50
|
+
* Use `create(StepReplySchema)` to create a new message.
|
|
51
|
+
*/
|
|
52
|
+
export const StepReplySchema = /*@__PURE__*/ messageDesc(file_ankka_protocol_v1_wasm, 6);
|
|
53
|
+
/**
|
|
54
|
+
* Describes the message ankka.protocol.v1.Passivate.
|
|
55
|
+
* Use `create(PassivateSchema)` to create a new message.
|
|
56
|
+
*/
|
|
57
|
+
export const PassivateSchema = /*@__PURE__*/ messageDesc(file_ankka_protocol_v1_wasm, 7);
|
|
58
|
+
/**
|
|
59
|
+
* Describes the message ankka.protocol.v1.ConfigRequest.
|
|
60
|
+
* Use `create(ConfigRequestSchema)` to create a new message.
|
|
61
|
+
*/
|
|
62
|
+
export const ConfigRequestSchema = /*@__PURE__*/ messageDesc(file_ankka_protocol_v1_wasm, 8);
|
|
63
|
+
/**
|
|
64
|
+
* Describes the message ankka.protocol.v1.ConfigReply.
|
|
65
|
+
* Use `create(ConfigReplySchema)` to create a new message.
|
|
66
|
+
*/
|
|
67
|
+
export const ConfigReplySchema = /*@__PURE__*/ messageDesc(file_ankka_protocol_v1_wasm, 9);
|
|
68
|
+
/**
|
|
69
|
+
* Describes the message ankka.protocol.v1.StreamTokens.
|
|
70
|
+
* Use `create(StreamTokensSchema)` to create a new message.
|
|
71
|
+
*/
|
|
72
|
+
export const StreamTokensSchema = /*@__PURE__*/ messageDesc(file_ankka_protocol_v1_wasm, 10);
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import type { ComponentClient } from "./client.ts";
|
|
2
|
+
import type { GuardrailRef, ToolRef } from "./handlers.ts";
|
|
3
|
+
import type { Schema } from "./schema.ts";
|
|
4
|
+
type MaybePromise<T> = T | Promise<T>;
|
|
5
|
+
export declare const COMPLETE_TASK = "complete_task";
|
|
6
|
+
export declare const FAIL_TASK = "fail_task";
|
|
7
|
+
export interface Accepted {
|
|
8
|
+
readonly verdict: "accepted";
|
|
9
|
+
}
|
|
10
|
+
export interface Rejected {
|
|
11
|
+
readonly verdict: "rejected";
|
|
12
|
+
readonly reason: string;
|
|
13
|
+
}
|
|
14
|
+
export declare const accepted: () => Accepted;
|
|
15
|
+
export declare const rejected: (reason: string) => Rejected;
|
|
16
|
+
/** A check a result must pass. Rules run in declaration order; the first rejection is reported. */
|
|
17
|
+
export interface TaskRule<R> {
|
|
18
|
+
readonly name: string;
|
|
19
|
+
readonly check: (result: R) => MaybePromise<Accepted | Rejected>;
|
|
20
|
+
}
|
|
21
|
+
export declare function taskRule<R>(name: string, check: (result: R) => MaybePromise<Accepted | Rejected>): TaskRule<R>;
|
|
22
|
+
/** A kind of work. `name` is the wire name, written into every task of this type. */
|
|
23
|
+
export interface TaskType<R> {
|
|
24
|
+
readonly name: string;
|
|
25
|
+
readonly description: string;
|
|
26
|
+
/** The result's shape; absent, the result is text. */
|
|
27
|
+
readonly result: Schema<R> | undefined;
|
|
28
|
+
readonly rules: readonly TaskRule<R>[];
|
|
29
|
+
}
|
|
30
|
+
export declare function taskType<R = string>(name: string, description: string, options?: {
|
|
31
|
+
result?: Schema<R>;
|
|
32
|
+
rules?: readonly TaskRule<R>[];
|
|
33
|
+
}): TaskType<R>;
|
|
34
|
+
/** Decodes a stored result as the task type's. */
|
|
35
|
+
export declare function decodeResult<R>(type: TaskType<R>, stored: string): R;
|
|
36
|
+
export interface TaskAcceptance {
|
|
37
|
+
readonly taskType: TaskType<any>;
|
|
38
|
+
readonly maxIterations: number;
|
|
39
|
+
}
|
|
40
|
+
export declare function taskAcceptance(type: TaskType<any>, options?: {
|
|
41
|
+
maxIterations?: number;
|
|
42
|
+
}): TaskAcceptance;
|
|
43
|
+
export interface AutonomousSettings {
|
|
44
|
+
readonly approachingBudgetAt?: number;
|
|
45
|
+
readonly repeatedFailureAt?: number;
|
|
46
|
+
readonly maxConsecutiveFailures?: number;
|
|
47
|
+
readonly dependencyStuckAfterMillis?: number;
|
|
48
|
+
}
|
|
49
|
+
export declare abstract class AutonomousAgent {
|
|
50
|
+
#private;
|
|
51
|
+
/** The task a tool, a guardrail or a rule is running for. */
|
|
52
|
+
get taskId(): string;
|
|
53
|
+
get client(): ComponentClient;
|
|
54
|
+
/** @internal */
|
|
55
|
+
get _kind(): "autonomous-agent";
|
|
56
|
+
/** @internal */
|
|
57
|
+
_bind(sessionId: string, client: ComponentClient): void;
|
|
58
|
+
}
|
|
59
|
+
export interface AutonomousAgentClass<C extends AutonomousAgent = AutonomousAgent> {
|
|
60
|
+
new (): C;
|
|
61
|
+
readonly componentId: string;
|
|
62
|
+
readonly description: string;
|
|
63
|
+
readonly instructions?: string;
|
|
64
|
+
/** A model named in the sidecar's configuration; absent, its default. */
|
|
65
|
+
readonly model?: string;
|
|
66
|
+
readonly tools?: Readonly<Record<string, ToolRef<C, any>>>;
|
|
67
|
+
readonly guardrails?: Readonly<Record<string, GuardrailRef>>;
|
|
68
|
+
readonly accepts: readonly TaskAcceptance[];
|
|
69
|
+
readonly settings?: AutonomousSettings;
|
|
70
|
+
}
|
|
71
|
+
/** The discovery form of a result schema. */
|
|
72
|
+
export declare function resultSchemaJson(type: TaskType<any>): string | undefined;
|
|
73
|
+
export interface Attachment {
|
|
74
|
+
readonly name: string;
|
|
75
|
+
readonly contentType: string;
|
|
76
|
+
readonly content?: string;
|
|
77
|
+
readonly uri?: string;
|
|
78
|
+
}
|
|
79
|
+
export interface TaskSnapshot<R> {
|
|
80
|
+
readonly id: string;
|
|
81
|
+
readonly typeName: string;
|
|
82
|
+
readonly status: "pending" | "assigned" | "in-progress" | "result-rejected" | "completed" | "failed" | "cancelled";
|
|
83
|
+
readonly result: R | undefined;
|
|
84
|
+
readonly reason: string | undefined;
|
|
85
|
+
readonly iterations: number;
|
|
86
|
+
readonly assignee: {
|
|
87
|
+
readonly componentId: string;
|
|
88
|
+
readonly instanceId: string;
|
|
89
|
+
} | undefined;
|
|
90
|
+
readonly record: Record<string, unknown>;
|
|
91
|
+
}
|
|
92
|
+
export interface AgentState {
|
|
93
|
+
readonly phase: "idle" | "working" | "waiting" | "suspended" | "terminated";
|
|
94
|
+
readonly currentTask: string | undefined;
|
|
95
|
+
readonly iteration: number;
|
|
96
|
+
readonly queued: readonly string[];
|
|
97
|
+
}
|
|
98
|
+
/** One thing an instance did: `type` names it, and the rest of its fields are as sent. */
|
|
99
|
+
export interface Notification {
|
|
100
|
+
readonly type: string;
|
|
101
|
+
readonly componentId: string;
|
|
102
|
+
readonly instanceId: string;
|
|
103
|
+
readonly taskId?: string;
|
|
104
|
+
readonly at: number;
|
|
105
|
+
readonly [field: string]: unknown;
|
|
106
|
+
}
|
|
107
|
+
/** Creates tasks: `await client.tasks.create(ANSWER, "How many?")` answers the new task's id. */
|
|
108
|
+
export declare class Tasks {
|
|
109
|
+
#private;
|
|
110
|
+
constructor(client: ComponentClient);
|
|
111
|
+
/** A dependency that does not exist is refused before anything is written; one that has already ended cancels the new task. */
|
|
112
|
+
create(type: TaskType<any>, instructions: string, options?: {
|
|
113
|
+
id?: string;
|
|
114
|
+
attachments?: readonly Attachment[];
|
|
115
|
+
dependsOn?: readonly string[];
|
|
116
|
+
}): Promise<string>;
|
|
117
|
+
}
|
|
118
|
+
/** Calls about one task. */
|
|
119
|
+
export declare class TaskCalls {
|
|
120
|
+
#private;
|
|
121
|
+
readonly taskId: string;
|
|
122
|
+
constructor(client: ComponentClient, taskId: string);
|
|
123
|
+
get<R = unknown>(type?: TaskType<R>): Promise<TaskSnapshot<R>>;
|
|
124
|
+
/** Waits until the task has completed, failed or been cancelled. */
|
|
125
|
+
wait<R = unknown>(type?: TaskType<R>, options?: {
|
|
126
|
+
timeoutMs?: number;
|
|
127
|
+
}): Promise<TaskSnapshot<R>>;
|
|
128
|
+
/** Cancels the task: at once when waiting, at the end of the current iteration when being worked. */
|
|
129
|
+
cancel(reason?: string): Promise<void>;
|
|
130
|
+
}
|
|
131
|
+
/** Calls to one instance of an autonomous agent, by the id the caller chose; with no id, only `runSingleTask`. */
|
|
132
|
+
export declare class AutonomousAgentCalls {
|
|
133
|
+
#private;
|
|
134
|
+
readonly componentId: string;
|
|
135
|
+
readonly instanceId: string | undefined;
|
|
136
|
+
constructor(client: ComponentClient, componentId: string, instanceId: string | undefined);
|
|
137
|
+
/** Creates the task, starts an instance on it, and answers the task's id at once. */
|
|
138
|
+
runSingleTask(type: TaskType<any>, instructions: string, options?: Parameters<Tasks["create"]>[2]): Promise<string>;
|
|
139
|
+
assign(...taskIds: string[]): Promise<{
|
|
140
|
+
accepted: string[];
|
|
141
|
+
refused: Record<string, {
|
|
142
|
+
message: string;
|
|
143
|
+
code: string;
|
|
144
|
+
}>;
|
|
145
|
+
}>;
|
|
146
|
+
suspend(): Promise<void>;
|
|
147
|
+
resume(): Promise<void>;
|
|
148
|
+
/** Stops the instance for good; its tasks go back to pending for another to take. */
|
|
149
|
+
terminate(): Promise<void>;
|
|
150
|
+
state(): Promise<AgentState>;
|
|
151
|
+
/** What the instance does from now on, as it happens. Nothing is replayed. */
|
|
152
|
+
notifications(): AsyncIterable<Notification>;
|
|
153
|
+
}
|
|
154
|
+
export {};
|