ankka 0.6.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/README.md +30 -0
- package/dist/_proto/ankka/protocol/v1/agent_pb.d.ts +350 -0
- package/dist/_proto/ankka/protocol/v1/agent_pb.js +90 -0
- package/dist/_proto/ankka/protocol/v1/client_pb.d.ts +254 -0
- package/dist/_proto/ankka/protocol/v1/client_pb.js +47 -0
- package/dist/_proto/ankka/protocol/v1/consumer_pb.d.ts +105 -0
- package/dist/_proto/ankka/protocol/v1/consumer_pb.js +28 -0
- package/dist/_proto/ankka/protocol/v1/discovery_pb.d.ts +598 -0
- package/dist/_proto/ankka/protocol/v1/discovery_pb.js +175 -0
- package/dist/_proto/ankka/protocol/v1/endpoint_pb.d.ts +224 -0
- package/dist/_proto/ankka/protocol/v1/endpoint_pb.js +44 -0
- package/dist/_proto/ankka/protocol/v1/event_sourced_pb.d.ts +212 -0
- package/dist/_proto/ankka/protocol/v1/event_sourced_pb.js +47 -0
- package/dist/_proto/ankka/protocol/v1/key_value_pb.d.ts +154 -0
- package/dist/_proto/ankka/protocol/v1/key_value_pb.js +36 -0
- package/dist/_proto/ankka/protocol/v1/payload_pb.d.ts +276 -0
- package/dist/_proto/ankka/protocol/v1/payload_pb.js +110 -0
- package/dist/_proto/ankka/protocol/v1/timed_action_pb.d.ts +75 -0
- package/dist/_proto/ankka/protocol/v1/timed_action_pb.js +23 -0
- package/dist/_proto/ankka/protocol/v1/view_pb.d.ts +93 -0
- package/dist/_proto/ankka/protocol/v1/view_pb.js +23 -0
- package/dist/_proto/ankka/protocol/v1/workflow_pb.d.ts +298 -0
- package/dist/_proto/ankka/protocol/v1/workflow_pb.js +67 -0
- package/dist/agent.d.ts +27 -0
- package/dist/agent.js +36 -0
- package/dist/client.d.ts +92 -0
- package/dist/client.js +239 -0
- package/dist/codec.d.ts +44 -0
- package/dist/codec.js +215 -0
- package/dist/consumer.d.ts +31 -0
- package/dist/consumer.js +32 -0
- package/dist/context.d.ts +61 -0
- package/dist/context.js +75 -0
- package/dist/effects/agent.d.ts +37 -0
- package/dist/effects/agent.js +48 -0
- package/dist/effects/common.d.ts +68 -0
- package/dist/effects/common.js +55 -0
- package/dist/effects/eventSourced.d.ts +50 -0
- package/dist/effects/eventSourced.js +66 -0
- package/dist/effects/keyValue.d.ts +36 -0
- package/dist/effects/keyValue.js +47 -0
- package/dist/effects/stateless.d.ts +40 -0
- package/dist/effects/stateless.js +35 -0
- package/dist/effects/workflow.d.ts +99 -0
- package/dist/effects/workflow.js +83 -0
- package/dist/endpoint.d.ts +21 -0
- package/dist/endpoint.js +29 -0
- package/dist/eventSourcedEntity.d.ts +40 -0
- package/dist/eventSourcedEntity.js +66 -0
- package/dist/handlers.d.ts +55 -0
- package/dist/handlers.js +64 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.js +39 -0
- package/dist/json.d.ts +21 -0
- package/dist/json.js +362 -0
- package/dist/keyValueEntity.d.ts +29 -0
- package/dist/keyValueEntity.js +52 -0
- package/dist/kinds.d.ts +8 -0
- package/dist/kinds.js +41 -0
- package/dist/materialise.d.ts +33 -0
- package/dist/materialise.js +55 -0
- package/dist/routes.d.ts +71 -0
- package/dist/routes.js +79 -0
- package/dist/schema.d.ts +112 -0
- package/dist/schema.js +200 -0
- package/dist/server/agent.d.ts +14 -0
- package/dist/server/agent.js +113 -0
- package/dist/server/discovery.d.ts +5 -0
- package/dist/server/discovery.js +21 -0
- package/dist/server/eventSourced.d.ts +12 -0
- package/dist/server/eventSourced.js +168 -0
- package/dist/server/http.d.ts +10 -0
- package/dist/server/http.js +153 -0
- package/dist/server/keyValue.d.ts +5 -0
- package/dist/server/keyValue.js +122 -0
- package/dist/server/payloads.d.ts +6 -0
- package/dist/server/payloads.js +11 -0
- package/dist/server/queue.d.ts +10 -0
- package/dist/server/queue.js +67 -0
- package/dist/server/server.d.ts +34 -0
- package/dist/server/server.js +101 -0
- package/dist/server/stateless.d.ts +9 -0
- package/dist/server/stateless.js +108 -0
- package/dist/server/workflow.d.ts +5 -0
- package/dist/server/workflow.js +244 -0
- package/dist/service.d.ts +147 -0
- package/dist/service.js +384 -0
- package/dist/spec.d.ts +7 -0
- package/dist/spec.js +106 -0
- package/dist/testkit/index.d.ts +3 -0
- package/dist/testkit/index.js +6 -0
- package/dist/testkit/integration.d.ts +60 -0
- package/dist/testkit/integration.js +284 -0
- package/dist/testkit/kinds.d.ts +133 -0
- package/dist/testkit/kinds.js +398 -0
- package/dist/testkit/unit.d.ts +54 -0
- package/dist/testkit/unit.js +224 -0
- package/dist/time.d.ts +73 -0
- package/dist/time.js +275 -0
- package/dist/timedAction.d.ts +20 -0
- package/dist/timedAction.js +28 -0
- package/dist/version.d.ts +1 -0
- package/dist/version.js +2 -0
- package/dist/view.d.ts +37 -0
- package/dist/view.js +52 -0
- package/dist/workflow.d.ts +33 -0
- package/dist/workflow.js +61 -0
- package/package.json +75 -0
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv2";
|
|
2
|
+
import type { Empty, Error, Metadata, Payload } from "./payload_pb.ts";
|
|
3
|
+
import type { Message } from "@bufbuild/protobuf";
|
|
4
|
+
/**
|
|
5
|
+
* Describes the file ankka/protocol/v1/timed_action.proto.
|
|
6
|
+
*/
|
|
7
|
+
export declare const file_ankka_protocol_v1_timed_action: GenFile;
|
|
8
|
+
/**
|
|
9
|
+
* @generated from message ankka.protocol.v1.TimedActionRequest
|
|
10
|
+
*/
|
|
11
|
+
export type TimedActionRequest = Message<"ankka.protocol.v1.TimedActionRequest"> & {
|
|
12
|
+
/**
|
|
13
|
+
* @generated from field: string component_id = 1;
|
|
14
|
+
*/
|
|
15
|
+
componentId: string;
|
|
16
|
+
/**
|
|
17
|
+
* @generated from field: string name = 2;
|
|
18
|
+
*/
|
|
19
|
+
name: string;
|
|
20
|
+
/**
|
|
21
|
+
* @generated from field: ankka.protocol.v1.Payload payload = 3;
|
|
22
|
+
*/
|
|
23
|
+
payload?: Payload | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* @generated from field: ankka.protocol.v1.Metadata metadata = 4;
|
|
26
|
+
*/
|
|
27
|
+
metadata?: Metadata | undefined;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Describes the message ankka.protocol.v1.TimedActionRequest.
|
|
31
|
+
* Use `create(TimedActionRequestSchema)` to create a new message.
|
|
32
|
+
*/
|
|
33
|
+
export declare const TimedActionRequestSchema: GenMessage<TimedActionRequest>;
|
|
34
|
+
/**
|
|
35
|
+
* @generated from message ankka.protocol.v1.TimedActionEffect
|
|
36
|
+
*/
|
|
37
|
+
export type TimedActionEffect = Message<"ankka.protocol.v1.TimedActionEffect"> & {
|
|
38
|
+
/**
|
|
39
|
+
* @generated from oneof ankka.protocol.v1.TimedActionEffect.effect
|
|
40
|
+
*/
|
|
41
|
+
effect: {
|
|
42
|
+
/**
|
|
43
|
+
* @generated from field: ankka.protocol.v1.Empty done = 1;
|
|
44
|
+
*/
|
|
45
|
+
value: Empty;
|
|
46
|
+
case: "done";
|
|
47
|
+
} | {
|
|
48
|
+
/**
|
|
49
|
+
* @generated from field: ankka.protocol.v1.Error fail = 2;
|
|
50
|
+
*/
|
|
51
|
+
value: Error;
|
|
52
|
+
case: "fail";
|
|
53
|
+
} | {
|
|
54
|
+
case: undefined;
|
|
55
|
+
value?: undefined;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* Describes the message ankka.protocol.v1.TimedActionEffect.
|
|
60
|
+
* Use `create(TimedActionEffectSchema)` to create a new message.
|
|
61
|
+
*/
|
|
62
|
+
export declare const TimedActionEffectSchema: GenMessage<TimedActionEffect>;
|
|
63
|
+
/**
|
|
64
|
+
* @generated from service ankka.protocol.v1.TimedAction
|
|
65
|
+
*/
|
|
66
|
+
export declare const TimedAction: GenService<{
|
|
67
|
+
/**
|
|
68
|
+
* @generated from rpc ankka.protocol.v1.TimedAction.Invoke
|
|
69
|
+
*/
|
|
70
|
+
invoke: {
|
|
71
|
+
methodKind: "unary";
|
|
72
|
+
input: typeof TimedActionRequestSchema;
|
|
73
|
+
output: typeof TimedActionEffectSchema;
|
|
74
|
+
};
|
|
75
|
+
}>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// @generated by protoc-gen-es v2.15.0 with parameter "target=ts,import_extension=ts,erasable_syntax=true"
|
|
2
|
+
// @generated from file ankka/protocol/v1/timed_action.proto (package ankka.protocol.v1, syntax proto3)
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
import { fileDesc, messageDesc, serviceDesc } from "@bufbuild/protobuf/codegenv2";
|
|
5
|
+
import { file_ankka_protocol_v1_payload } from "./payload_pb.js";
|
|
6
|
+
/**
|
|
7
|
+
* Describes the file ankka/protocol/v1/timed_action.proto.
|
|
8
|
+
*/
|
|
9
|
+
export const file_ankka_protocol_v1_timed_action = /*@__PURE__*/ fileDesc("CiRhbmtrYS9wcm90b2NvbC92MS90aW1lZF9hY3Rpb24ucHJvdG8SEWFua2thLnByb3RvY29sLnYxIpQBChJUaW1lZEFjdGlvblJlcXVlc3QSFAoMY29tcG9uZW50X2lkGAEgASgJEgwKBG5hbWUYAiABKAkSKwoHcGF5bG9hZBgDIAEoCzIaLmFua2thLnByb3RvY29sLnYxLlBheWxvYWQSLQoIbWV0YWRhdGEYBCABKAsyGy5hbmtrYS5wcm90b2NvbC52MS5NZXRhZGF0YSJxChFUaW1lZEFjdGlvbkVmZmVjdBIoCgRkb25lGAEgASgLMhguYW5ra2EucHJvdG9jb2wudjEuRW1wdHlIABIoCgRmYWlsGAIgASgLMhguYW5ra2EucHJvdG9jb2wudjEuRXJyb3JIAEIICgZlZmZlY3QyZAoLVGltZWRBY3Rpb24SVQoGSW52b2tlEiUuYW5ra2EucHJvdG9jb2wudjEuVGltZWRBY3Rpb25SZXF1ZXN0GiQuYW5ra2EucHJvdG9jb2wudjEuVGltZWRBY3Rpb25FZmZlY3RiBnByb3RvMw", [file_ankka_protocol_v1_payload]);
|
|
10
|
+
/**
|
|
11
|
+
* Describes the message ankka.protocol.v1.TimedActionRequest.
|
|
12
|
+
* Use `create(TimedActionRequestSchema)` to create a new message.
|
|
13
|
+
*/
|
|
14
|
+
export const TimedActionRequestSchema = /*@__PURE__*/ messageDesc(file_ankka_protocol_v1_timed_action, 0);
|
|
15
|
+
/**
|
|
16
|
+
* Describes the message ankka.protocol.v1.TimedActionEffect.
|
|
17
|
+
* Use `create(TimedActionEffectSchema)` to create a new message.
|
|
18
|
+
*/
|
|
19
|
+
export const TimedActionEffectSchema = /*@__PURE__*/ messageDesc(file_ankka_protocol_v1_timed_action, 1);
|
|
20
|
+
/**
|
|
21
|
+
* @generated from service ankka.protocol.v1.TimedAction
|
|
22
|
+
*/
|
|
23
|
+
export const TimedAction = /*@__PURE__*/ serviceDesc(file_ankka_protocol_v1_timed_action, 0);
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import type { GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv2";
|
|
2
|
+
import type { Empty, Metadata, Payload } from "./payload_pb.ts";
|
|
3
|
+
import type { Message } from "@bufbuild/protobuf";
|
|
4
|
+
/**
|
|
5
|
+
* Describes the file ankka/protocol/v1/view.proto.
|
|
6
|
+
*/
|
|
7
|
+
export declare const file_ankka_protocol_v1_view: GenFile;
|
|
8
|
+
/**
|
|
9
|
+
* @generated from message ankka.protocol.v1.ViewRequest
|
|
10
|
+
*/
|
|
11
|
+
export type ViewRequest = Message<"ankka.protocol.v1.ViewRequest"> & {
|
|
12
|
+
/**
|
|
13
|
+
* @generated from field: string component_id = 1;
|
|
14
|
+
*/
|
|
15
|
+
componentId: string;
|
|
16
|
+
/**
|
|
17
|
+
* absent when deleted
|
|
18
|
+
*
|
|
19
|
+
* @generated from field: ankka.protocol.v1.Payload event = 2;
|
|
20
|
+
*/
|
|
21
|
+
event?: Payload | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* ce-subject: the source's id; ankka.sequence
|
|
24
|
+
*
|
|
25
|
+
* @generated from field: ankka.protocol.v1.Metadata metadata = 3;
|
|
26
|
+
*/
|
|
27
|
+
metadata?: Metadata | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* the current row, if any
|
|
30
|
+
*
|
|
31
|
+
* @generated from field: optional ankka.protocol.v1.Payload row = 4;
|
|
32
|
+
*/
|
|
33
|
+
row?: Payload | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* the source was deleted: no event, the row is the process's to keep or drop
|
|
36
|
+
*
|
|
37
|
+
* @generated from field: bool deleted = 5;
|
|
38
|
+
*/
|
|
39
|
+
deleted: boolean;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Describes the message ankka.protocol.v1.ViewRequest.
|
|
43
|
+
* Use `create(ViewRequestSchema)` to create a new message.
|
|
44
|
+
*/
|
|
45
|
+
export declare const ViewRequestSchema: GenMessage<ViewRequest>;
|
|
46
|
+
/**
|
|
47
|
+
* @generated from message ankka.protocol.v1.ViewEffect
|
|
48
|
+
*/
|
|
49
|
+
export type ViewEffect = Message<"ankka.protocol.v1.ViewEffect"> & {
|
|
50
|
+
/**
|
|
51
|
+
* @generated from oneof ankka.protocol.v1.ViewEffect.effect
|
|
52
|
+
*/
|
|
53
|
+
effect: {
|
|
54
|
+
/**
|
|
55
|
+
* @generated from field: ankka.protocol.v1.Payload update_row = 1;
|
|
56
|
+
*/
|
|
57
|
+
value: Payload;
|
|
58
|
+
case: "updateRow";
|
|
59
|
+
} | {
|
|
60
|
+
/**
|
|
61
|
+
* @generated from field: ankka.protocol.v1.Empty delete_row = 2;
|
|
62
|
+
*/
|
|
63
|
+
value: Empty;
|
|
64
|
+
case: "deleteRow";
|
|
65
|
+
} | {
|
|
66
|
+
/**
|
|
67
|
+
* @generated from field: ankka.protocol.v1.Empty ignore = 3;
|
|
68
|
+
*/
|
|
69
|
+
value: Empty;
|
|
70
|
+
case: "ignore";
|
|
71
|
+
} | {
|
|
72
|
+
case: undefined;
|
|
73
|
+
value?: undefined;
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* Describes the message ankka.protocol.v1.ViewEffect.
|
|
78
|
+
* Use `create(ViewEffectSchema)` to create a new message.
|
|
79
|
+
*/
|
|
80
|
+
export declare const ViewEffectSchema: GenMessage<ViewEffect>;
|
|
81
|
+
/**
|
|
82
|
+
* @generated from service ankka.protocol.v1.View
|
|
83
|
+
*/
|
|
84
|
+
export declare const View: GenService<{
|
|
85
|
+
/**
|
|
86
|
+
* @generated from rpc ankka.protocol.v1.View.Handle
|
|
87
|
+
*/
|
|
88
|
+
handle: {
|
|
89
|
+
methodKind: "unary";
|
|
90
|
+
input: typeof ViewRequestSchema;
|
|
91
|
+
output: typeof ViewEffectSchema;
|
|
92
|
+
};
|
|
93
|
+
}>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// @generated by protoc-gen-es v2.15.0 with parameter "target=ts,import_extension=ts,erasable_syntax=true"
|
|
2
|
+
// @generated from file ankka/protocol/v1/view.proto (package ankka.protocol.v1, syntax proto3)
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
import { fileDesc, messageDesc, serviceDesc } from "@bufbuild/protobuf/codegenv2";
|
|
5
|
+
import { file_ankka_protocol_v1_payload } from "./payload_pb.js";
|
|
6
|
+
/**
|
|
7
|
+
* Describes the file ankka/protocol/v1/view.proto.
|
|
8
|
+
*/
|
|
9
|
+
export const file_ankka_protocol_v1_view = /*@__PURE__*/ fileDesc("ChxhbmtrYS9wcm90b2NvbC92MS92aWV3LnByb3RvEhFhbmtrYS5wcm90b2NvbC52MSLEAQoLVmlld1JlcXVlc3QSFAoMY29tcG9uZW50X2lkGAEgASgJEikKBWV2ZW50GAIgASgLMhouYW5ra2EucHJvdG9jb2wudjEuUGF5bG9hZBItCghtZXRhZGF0YRgDIAEoCzIbLmFua2thLnByb3RvY29sLnYxLk1ldGFkYXRhEiwKA3JvdxgEIAEoCzIaLmFua2thLnByb3RvY29sLnYxLlBheWxvYWRIAIgBARIPCgdkZWxldGVkGAUgASgIQgYKBF9yb3cipAEKClZpZXdFZmZlY3QSMAoKdXBkYXRlX3JvdxgBIAEoCzIaLmFua2thLnByb3RvY29sLnYxLlBheWxvYWRIABIuCgpkZWxldGVfcm93GAIgASgLMhguYW5ra2EucHJvdG9jb2wudjEuRW1wdHlIABIqCgZpZ25vcmUYAyABKAsyGC5hbmtrYS5wcm90b2NvbC52MS5FbXB0eUgAQggKBmVmZmVjdDJPCgRWaWV3EkcKBkhhbmRsZRIeLmFua2thLnByb3RvY29sLnYxLlZpZXdSZXF1ZXN0Gh0uYW5ra2EucHJvdG9jb2wudjEuVmlld0VmZmVjdGIGcHJvdG8z", [file_ankka_protocol_v1_payload]);
|
|
10
|
+
/**
|
|
11
|
+
* Describes the message ankka.protocol.v1.ViewRequest.
|
|
12
|
+
* Use `create(ViewRequestSchema)` to create a new message.
|
|
13
|
+
*/
|
|
14
|
+
export const ViewRequestSchema = /*@__PURE__*/ messageDesc(file_ankka_protocol_v1_view, 0);
|
|
15
|
+
/**
|
|
16
|
+
* Describes the message ankka.protocol.v1.ViewEffect.
|
|
17
|
+
* Use `create(ViewEffectSchema)` to create a new message.
|
|
18
|
+
*/
|
|
19
|
+
export const ViewEffectSchema = /*@__PURE__*/ messageDesc(file_ankka_protocol_v1_view, 1);
|
|
20
|
+
/**
|
|
21
|
+
* @generated from service ankka.protocol.v1.View
|
|
22
|
+
*/
|
|
23
|
+
export const View = /*@__PURE__*/ serviceDesc(file_ankka_protocol_v1_view, 0);
|
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
import type { GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv2";
|
|
2
|
+
import type { Error, Failure, Metadata, Outcome, Payload } from "./payload_pb.ts";
|
|
3
|
+
import type { Message } from "@bufbuild/protobuf";
|
|
4
|
+
/**
|
|
5
|
+
* Describes the file ankka/protocol/v1/workflow.proto.
|
|
6
|
+
*/
|
|
7
|
+
export declare const file_ankka_protocol_v1_workflow: GenFile;
|
|
8
|
+
/**
|
|
9
|
+
* @generated from message ankka.protocol.v1.WorkflowIn
|
|
10
|
+
*/
|
|
11
|
+
export type WorkflowIn = Message<"ankka.protocol.v1.WorkflowIn"> & {
|
|
12
|
+
/**
|
|
13
|
+
* @generated from oneof ankka.protocol.v1.WorkflowIn.message
|
|
14
|
+
*/
|
|
15
|
+
message: {
|
|
16
|
+
/**
|
|
17
|
+
* @generated from field: ankka.protocol.v1.WorkflowIn.Init init = 1;
|
|
18
|
+
*/
|
|
19
|
+
value: WorkflowIn_Init;
|
|
20
|
+
case: "init";
|
|
21
|
+
} | {
|
|
22
|
+
/**
|
|
23
|
+
* @generated from field: ankka.protocol.v1.WorkflowIn.Command command = 2;
|
|
24
|
+
*/
|
|
25
|
+
value: WorkflowIn_Command;
|
|
26
|
+
case: "command";
|
|
27
|
+
} | {
|
|
28
|
+
/**
|
|
29
|
+
* @generated from field: ankka.protocol.v1.WorkflowIn.RunStep run_step = 3;
|
|
30
|
+
*/
|
|
31
|
+
value: WorkflowIn_RunStep;
|
|
32
|
+
case: "runStep";
|
|
33
|
+
} | {
|
|
34
|
+
case: undefined;
|
|
35
|
+
value?: undefined;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Describes the message ankka.protocol.v1.WorkflowIn.
|
|
40
|
+
* Use `create(WorkflowInSchema)` to create a new message.
|
|
41
|
+
*/
|
|
42
|
+
export declare const WorkflowInSchema: GenMessage<WorkflowIn>;
|
|
43
|
+
/**
|
|
44
|
+
* @generated from message ankka.protocol.v1.WorkflowIn.Init
|
|
45
|
+
*/
|
|
46
|
+
export type WorkflowIn_Init = Message<"ankka.protocol.v1.WorkflowIn.Init"> & {
|
|
47
|
+
/**
|
|
48
|
+
* @generated from field: string component_id = 1;
|
|
49
|
+
*/
|
|
50
|
+
componentId: string;
|
|
51
|
+
/**
|
|
52
|
+
* @generated from field: string entity_id = 2;
|
|
53
|
+
*/
|
|
54
|
+
entityId: string;
|
|
55
|
+
/**
|
|
56
|
+
* @generated from field: optional ankka.protocol.v1.Payload state = 3;
|
|
57
|
+
*/
|
|
58
|
+
state?: Payload | undefined;
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* Describes the message ankka.protocol.v1.WorkflowIn.Init.
|
|
62
|
+
* Use `create(WorkflowIn_InitSchema)` to create a new message.
|
|
63
|
+
*/
|
|
64
|
+
export declare const WorkflowIn_InitSchema: GenMessage<WorkflowIn_Init>;
|
|
65
|
+
/**
|
|
66
|
+
* @generated from message ankka.protocol.v1.WorkflowIn.Command
|
|
67
|
+
*/
|
|
68
|
+
export type WorkflowIn_Command = Message<"ankka.protocol.v1.WorkflowIn.Command"> & {
|
|
69
|
+
/**
|
|
70
|
+
* @generated from field: int64 id = 1;
|
|
71
|
+
*/
|
|
72
|
+
id: bigint;
|
|
73
|
+
/**
|
|
74
|
+
* @generated from field: string name = 2;
|
|
75
|
+
*/
|
|
76
|
+
name: string;
|
|
77
|
+
/**
|
|
78
|
+
* @generated from field: ankka.protocol.v1.Payload payload = 3;
|
|
79
|
+
*/
|
|
80
|
+
payload?: Payload | undefined;
|
|
81
|
+
/**
|
|
82
|
+
* @generated from field: ankka.protocol.v1.Metadata metadata = 4;
|
|
83
|
+
*/
|
|
84
|
+
metadata?: Metadata | undefined;
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
* Describes the message ankka.protocol.v1.WorkflowIn.Command.
|
|
88
|
+
* Use `create(WorkflowIn_CommandSchema)` to create a new message.
|
|
89
|
+
*/
|
|
90
|
+
export declare const WorkflowIn_CommandSchema: GenMessage<WorkflowIn_Command>;
|
|
91
|
+
/**
|
|
92
|
+
* @generated from message ankka.protocol.v1.WorkflowIn.RunStep
|
|
93
|
+
*/
|
|
94
|
+
export type WorkflowIn_RunStep = Message<"ankka.protocol.v1.WorkflowIn.RunStep"> & {
|
|
95
|
+
/**
|
|
96
|
+
* @generated from field: int64 id = 1;
|
|
97
|
+
*/
|
|
98
|
+
id: bigint;
|
|
99
|
+
/**
|
|
100
|
+
* @generated from field: string step = 2;
|
|
101
|
+
*/
|
|
102
|
+
step: string;
|
|
103
|
+
/**
|
|
104
|
+
* @generated from field: optional ankka.protocol.v1.Payload input = 3;
|
|
105
|
+
*/
|
|
106
|
+
input?: Payload | undefined;
|
|
107
|
+
};
|
|
108
|
+
/**
|
|
109
|
+
* Describes the message ankka.protocol.v1.WorkflowIn.RunStep.
|
|
110
|
+
* Use `create(WorkflowIn_RunStepSchema)` to create a new message.
|
|
111
|
+
*/
|
|
112
|
+
export declare const WorkflowIn_RunStepSchema: GenMessage<WorkflowIn_RunStep>;
|
|
113
|
+
/**
|
|
114
|
+
* @generated from message ankka.protocol.v1.WorkflowOut
|
|
115
|
+
*/
|
|
116
|
+
export type WorkflowOut = Message<"ankka.protocol.v1.WorkflowOut"> & {
|
|
117
|
+
/**
|
|
118
|
+
* @generated from oneof ankka.protocol.v1.WorkflowOut.message
|
|
119
|
+
*/
|
|
120
|
+
message: {
|
|
121
|
+
/**
|
|
122
|
+
* @generated from field: ankka.protocol.v1.WorkflowOut.Reply reply = 1;
|
|
123
|
+
*/
|
|
124
|
+
value: WorkflowOut_Reply;
|
|
125
|
+
case: "reply";
|
|
126
|
+
} | {
|
|
127
|
+
/**
|
|
128
|
+
* @generated from field: ankka.protocol.v1.WorkflowOut.StepReply step_reply = 2;
|
|
129
|
+
*/
|
|
130
|
+
value: WorkflowOut_StepReply;
|
|
131
|
+
case: "stepReply";
|
|
132
|
+
} | {
|
|
133
|
+
/**
|
|
134
|
+
* @generated from field: ankka.protocol.v1.Failure failure = 3;
|
|
135
|
+
*/
|
|
136
|
+
value: Failure;
|
|
137
|
+
case: "failure";
|
|
138
|
+
} | {
|
|
139
|
+
case: undefined;
|
|
140
|
+
value?: undefined;
|
|
141
|
+
};
|
|
142
|
+
};
|
|
143
|
+
/**
|
|
144
|
+
* Describes the message ankka.protocol.v1.WorkflowOut.
|
|
145
|
+
* Use `create(WorkflowOutSchema)` to create a new message.
|
|
146
|
+
*/
|
|
147
|
+
export declare const WorkflowOutSchema: GenMessage<WorkflowOut>;
|
|
148
|
+
/**
|
|
149
|
+
* a command handler's WorkflowEffect
|
|
150
|
+
*
|
|
151
|
+
* @generated from message ankka.protocol.v1.WorkflowOut.Reply
|
|
152
|
+
*/
|
|
153
|
+
export type WorkflowOut_Reply = Message<"ankka.protocol.v1.WorkflowOut.Reply"> & {
|
|
154
|
+
/**
|
|
155
|
+
* @generated from field: int64 command_id = 1;
|
|
156
|
+
*/
|
|
157
|
+
commandId: bigint;
|
|
158
|
+
/**
|
|
159
|
+
* @generated from field: optional ankka.protocol.v1.Payload new_state = 2;
|
|
160
|
+
*/
|
|
161
|
+
newState?: Payload | undefined;
|
|
162
|
+
/**
|
|
163
|
+
* @generated from field: optional ankka.protocol.v1.StepRef transition = 3;
|
|
164
|
+
*/
|
|
165
|
+
transition?: StepRef | undefined;
|
|
166
|
+
/**
|
|
167
|
+
* @generated from field: ankka.protocol.v1.Outcome outcome = 4;
|
|
168
|
+
*/
|
|
169
|
+
outcome?: Outcome | undefined;
|
|
170
|
+
};
|
|
171
|
+
/**
|
|
172
|
+
* Describes the message ankka.protocol.v1.WorkflowOut.Reply.
|
|
173
|
+
* Use `create(WorkflowOut_ReplySchema)` to create a new message.
|
|
174
|
+
*/
|
|
175
|
+
export declare const WorkflowOut_ReplySchema: GenMessage<WorkflowOut_Reply>;
|
|
176
|
+
/**
|
|
177
|
+
* a step's WorkflowStepEffect
|
|
178
|
+
*
|
|
179
|
+
* @generated from message ankka.protocol.v1.WorkflowOut.StepReply
|
|
180
|
+
*/
|
|
181
|
+
export type WorkflowOut_StepReply = Message<"ankka.protocol.v1.WorkflowOut.StepReply"> & {
|
|
182
|
+
/**
|
|
183
|
+
* @generated from field: int64 command_id = 1;
|
|
184
|
+
*/
|
|
185
|
+
commandId: bigint;
|
|
186
|
+
/**
|
|
187
|
+
* @generated from field: optional ankka.protocol.v1.Payload new_state = 2;
|
|
188
|
+
*/
|
|
189
|
+
newState?: Payload | undefined;
|
|
190
|
+
/**
|
|
191
|
+
* @generated from field: ankka.protocol.v1.StepOutcome next = 3;
|
|
192
|
+
*/
|
|
193
|
+
next?: StepOutcome | undefined;
|
|
194
|
+
};
|
|
195
|
+
/**
|
|
196
|
+
* Describes the message ankka.protocol.v1.WorkflowOut.StepReply.
|
|
197
|
+
* Use `create(WorkflowOut_StepReplySchema)` to create a new message.
|
|
198
|
+
*/
|
|
199
|
+
export declare const WorkflowOut_StepReplySchema: GenMessage<WorkflowOut_StepReply>;
|
|
200
|
+
/**
|
|
201
|
+
* @generated from message ankka.protocol.v1.StepRef
|
|
202
|
+
*/
|
|
203
|
+
export type StepRef = Message<"ankka.protocol.v1.StepRef"> & {
|
|
204
|
+
/**
|
|
205
|
+
* @generated from field: string step = 1;
|
|
206
|
+
*/
|
|
207
|
+
step: string;
|
|
208
|
+
/**
|
|
209
|
+
* @generated from field: optional ankka.protocol.v1.Payload input = 2;
|
|
210
|
+
*/
|
|
211
|
+
input?: Payload | undefined;
|
|
212
|
+
};
|
|
213
|
+
/**
|
|
214
|
+
* Describes the message ankka.protocol.v1.StepRef.
|
|
215
|
+
* Use `create(StepRefSchema)` to create a new message.
|
|
216
|
+
*/
|
|
217
|
+
export declare const StepRefSchema: GenMessage<StepRef>;
|
|
218
|
+
/**
|
|
219
|
+
* @generated from message ankka.protocol.v1.StepOutcome
|
|
220
|
+
*/
|
|
221
|
+
export type StepOutcome = Message<"ankka.protocol.v1.StepOutcome"> & {
|
|
222
|
+
/**
|
|
223
|
+
* @generated from oneof ankka.protocol.v1.StepOutcome.outcome
|
|
224
|
+
*/
|
|
225
|
+
outcome: {
|
|
226
|
+
/**
|
|
227
|
+
* @generated from field: ankka.protocol.v1.StepRef transition_to = 1;
|
|
228
|
+
*/
|
|
229
|
+
value: StepRef;
|
|
230
|
+
case: "transitionTo";
|
|
231
|
+
} | {
|
|
232
|
+
/**
|
|
233
|
+
* @generated from field: ankka.protocol.v1.StepOutcome.Pause pause = 2;
|
|
234
|
+
*/
|
|
235
|
+
value: StepOutcome_Pause;
|
|
236
|
+
case: "pause";
|
|
237
|
+
} | {
|
|
238
|
+
/**
|
|
239
|
+
* @generated from field: ankka.protocol.v1.StepOutcome.End end = 3;
|
|
240
|
+
*/
|
|
241
|
+
value: StepOutcome_End;
|
|
242
|
+
case: "end";
|
|
243
|
+
} | {
|
|
244
|
+
/**
|
|
245
|
+
* @generated from field: ankka.protocol.v1.Error fail = 4;
|
|
246
|
+
*/
|
|
247
|
+
value: Error;
|
|
248
|
+
case: "fail";
|
|
249
|
+
} | {
|
|
250
|
+
case: undefined;
|
|
251
|
+
value?: undefined;
|
|
252
|
+
};
|
|
253
|
+
};
|
|
254
|
+
/**
|
|
255
|
+
* Describes the message ankka.protocol.v1.StepOutcome.
|
|
256
|
+
* Use `create(StepOutcomeSchema)` to create a new message.
|
|
257
|
+
*/
|
|
258
|
+
export declare const StepOutcomeSchema: GenMessage<StepOutcome>;
|
|
259
|
+
/**
|
|
260
|
+
* @generated from message ankka.protocol.v1.StepOutcome.Pause
|
|
261
|
+
*/
|
|
262
|
+
export type StepOutcome_Pause = Message<"ankka.protocol.v1.StepOutcome.Pause"> & {
|
|
263
|
+
/**
|
|
264
|
+
* @generated from field: optional int64 after_millis = 1;
|
|
265
|
+
*/
|
|
266
|
+
afterMillis?: bigint | undefined;
|
|
267
|
+
/**
|
|
268
|
+
* @generated from field: optional ankka.protocol.v1.StepRef on_timeout = 2;
|
|
269
|
+
*/
|
|
270
|
+
onTimeout?: StepRef | undefined;
|
|
271
|
+
};
|
|
272
|
+
/**
|
|
273
|
+
* Describes the message ankka.protocol.v1.StepOutcome.Pause.
|
|
274
|
+
* Use `create(StepOutcome_PauseSchema)` to create a new message.
|
|
275
|
+
*/
|
|
276
|
+
export declare const StepOutcome_PauseSchema: GenMessage<StepOutcome_Pause>;
|
|
277
|
+
/**
|
|
278
|
+
* @generated from message ankka.protocol.v1.StepOutcome.End
|
|
279
|
+
*/
|
|
280
|
+
export type StepOutcome_End = Message<"ankka.protocol.v1.StepOutcome.End"> & {};
|
|
281
|
+
/**
|
|
282
|
+
* Describes the message ankka.protocol.v1.StepOutcome.End.
|
|
283
|
+
* Use `create(StepOutcome_EndSchema)` to create a new message.
|
|
284
|
+
*/
|
|
285
|
+
export declare const StepOutcome_EndSchema: GenMessage<StepOutcome_End>;
|
|
286
|
+
/**
|
|
287
|
+
* @generated from service ankka.protocol.v1.Workflow
|
|
288
|
+
*/
|
|
289
|
+
export declare const Workflow: GenService<{
|
|
290
|
+
/**
|
|
291
|
+
* @generated from rpc ankka.protocol.v1.Workflow.Handle
|
|
292
|
+
*/
|
|
293
|
+
handle: {
|
|
294
|
+
methodKind: "bidi_streaming";
|
|
295
|
+
input: typeof WorkflowInSchema;
|
|
296
|
+
output: typeof WorkflowOutSchema;
|
|
297
|
+
};
|
|
298
|
+
}>;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
// One bidirectional stream per loaded workflow instance. Commands and steps share it; the sidecar's
|
|
2
|
+
// engine journals every transition and runs a step only after its transition is journaled.
|
|
3
|
+
import { fileDesc, messageDesc, serviceDesc } from "@bufbuild/protobuf/codegenv2";
|
|
4
|
+
import { file_ankka_protocol_v1_payload } from "./payload_pb.js";
|
|
5
|
+
/**
|
|
6
|
+
* Describes the file ankka/protocol/v1/workflow.proto.
|
|
7
|
+
*/
|
|
8
|
+
export const file_ankka_protocol_v1_workflow = /*@__PURE__*/ fileDesc("CiBhbmtrYS9wcm90b2NvbC92MS93b3JrZmxvdy5wcm90bxIRYW5ra2EucHJvdG9jb2wudjEiiwQKCldvcmtmbG93SW4SMgoEaW5pdBgBIAEoCzIiLmFua2thLnByb3RvY29sLnYxLldvcmtmbG93SW4uSW5pdEgAEjgKB2NvbW1hbmQYAiABKAsyJS5hbmtrYS5wcm90b2NvbC52MS5Xb3JrZmxvd0luLkNvbW1hbmRIABI5CghydW5fc3RlcBgDIAEoCzIlLmFua2thLnByb3RvY29sLnYxLldvcmtmbG93SW4uUnVuU3RlcEgAGmkKBEluaXQSFAoMY29tcG9uZW50X2lkGAEgASgJEhEKCWVudGl0eV9pZBgCIAEoCRIuCgVzdGF0ZRgDIAEoCzIaLmFua2thLnByb3RvY29sLnYxLlBheWxvYWRIAIgBAUIICgZfc3RhdGUafwoHQ29tbWFuZBIKCgJpZBgBIAEoAxIMCgRuYW1lGAIgASgJEisKB3BheWxvYWQYAyABKAsyGi5hbmtrYS5wcm90b2NvbC52MS5QYXlsb2FkEi0KCG1ldGFkYXRhGAQgASgLMhsuYW5ra2EucHJvdG9jb2wudjEuTWV0YWRhdGEaXQoHUnVuU3RlcBIKCgJpZBgBIAEoAxIMCgRzdGVwGAIgASgJEi4KBWlucHV0GAMgASgLMhouYW5ra2EucHJvdG9jb2wudjEuUGF5bG9hZEgAiAEBQggKBl9pbnB1dEIJCgdtZXNzYWdlIqEECgtXb3JrZmxvd091dBI1CgVyZXBseRgBIAEoCzIkLmFua2thLnByb3RvY29sLnYxLldvcmtmbG93T3V0LlJlcGx5SAASPgoKc3RlcF9yZXBseRgCIAEoCzIoLmFua2thLnByb3RvY29sLnYxLldvcmtmbG93T3V0LlN0ZXBSZXBseUgAEi0KB2ZhaWx1cmUYAyABKAsyGi5hbmtrYS5wcm90b2NvbC52MS5GYWlsdXJlSAAazgEKBVJlcGx5EhIKCmNvbW1hbmRfaWQYASABKAMSMgoJbmV3X3N0YXRlGAIgASgLMhouYW5ra2EucHJvdG9jb2wudjEuUGF5bG9hZEgAiAEBEjMKCnRyYW5zaXRpb24YAyABKAsyGi5hbmtrYS5wcm90b2NvbC52MS5TdGVwUmVmSAGIAQESKwoHb3V0Y29tZRgEIAEoCzIaLmFua2thLnByb3RvY29sLnYxLk91dGNvbWVCDAoKX25ld19zdGF0ZUINCgtfdHJhbnNpdGlvbhqPAQoJU3RlcFJlcGx5EhIKCmNvbW1hbmRfaWQYASABKAMSMgoJbmV3X3N0YXRlGAIgASgLMhouYW5ra2EucHJvdG9jb2wudjEuUGF5bG9hZEgAiAEBEiwKBG5leHQYAyABKAsyHi5hbmtrYS5wcm90b2NvbC52MS5TdGVwT3V0Y29tZUIMCgpfbmV3X3N0YXRlQgkKB21lc3NhZ2UiUQoHU3RlcFJlZhIMCgRzdGVwGAEgASgJEi4KBWlucHV0GAIgASgLMhouYW5ra2EucHJvdG9jb2wudjEuUGF5bG9hZEgAiAEBQggKBl9pbnB1dCLhAgoLU3RlcE91dGNvbWUSMwoNdHJhbnNpdGlvbl90bxgBIAEoCzIaLmFua2thLnByb3RvY29sLnYxLlN0ZXBSZWZIABI1CgVwYXVzZRgCIAEoCzIkLmFua2thLnByb3RvY29sLnYxLlN0ZXBPdXRjb21lLlBhdXNlSAASMQoDZW5kGAMgASgLMiIuYW5ra2EucHJvdG9jb2wudjEuU3RlcE91dGNvbWUuRW5kSAASKAoEZmFpbBgEIAEoCzIYLmFua2thLnByb3RvY29sLnYxLkVycm9ySAAadwoFUGF1c2USGQoMYWZ0ZXJfbWlsbGlzGAEgASgDSACIAQESMwoKb25fdGltZW91dBgCIAEoCzIaLmFua2thLnByb3RvY29sLnYxLlN0ZXBSZWZIAYgBAUIPCg1fYWZ0ZXJfbWlsbGlzQg0KC19vbl90aW1lb3V0GgUKA0VuZEIJCgdvdXRjb21lMlcKCFdvcmtmbG93EksKBkhhbmRsZRIdLmFua2thLnByb3RvY29sLnYxLldvcmtmbG93SW4aHi5hbmtrYS5wcm90b2NvbC52MS5Xb3JrZmxvd091dCgBMAFiBnByb3RvMw", [file_ankka_protocol_v1_payload]);
|
|
9
|
+
/**
|
|
10
|
+
* Describes the message ankka.protocol.v1.WorkflowIn.
|
|
11
|
+
* Use `create(WorkflowInSchema)` to create a new message.
|
|
12
|
+
*/
|
|
13
|
+
export const WorkflowInSchema = /*@__PURE__*/ messageDesc(file_ankka_protocol_v1_workflow, 0);
|
|
14
|
+
/**
|
|
15
|
+
* Describes the message ankka.protocol.v1.WorkflowIn.Init.
|
|
16
|
+
* Use `create(WorkflowIn_InitSchema)` to create a new message.
|
|
17
|
+
*/
|
|
18
|
+
export const WorkflowIn_InitSchema = /*@__PURE__*/ messageDesc(file_ankka_protocol_v1_workflow, 0, 0);
|
|
19
|
+
/**
|
|
20
|
+
* Describes the message ankka.protocol.v1.WorkflowIn.Command.
|
|
21
|
+
* Use `create(WorkflowIn_CommandSchema)` to create a new message.
|
|
22
|
+
*/
|
|
23
|
+
export const WorkflowIn_CommandSchema = /*@__PURE__*/ messageDesc(file_ankka_protocol_v1_workflow, 0, 1);
|
|
24
|
+
/**
|
|
25
|
+
* Describes the message ankka.protocol.v1.WorkflowIn.RunStep.
|
|
26
|
+
* Use `create(WorkflowIn_RunStepSchema)` to create a new message.
|
|
27
|
+
*/
|
|
28
|
+
export const WorkflowIn_RunStepSchema = /*@__PURE__*/ messageDesc(file_ankka_protocol_v1_workflow, 0, 2);
|
|
29
|
+
/**
|
|
30
|
+
* Describes the message ankka.protocol.v1.WorkflowOut.
|
|
31
|
+
* Use `create(WorkflowOutSchema)` to create a new message.
|
|
32
|
+
*/
|
|
33
|
+
export const WorkflowOutSchema = /*@__PURE__*/ messageDesc(file_ankka_protocol_v1_workflow, 1);
|
|
34
|
+
/**
|
|
35
|
+
* Describes the message ankka.protocol.v1.WorkflowOut.Reply.
|
|
36
|
+
* Use `create(WorkflowOut_ReplySchema)` to create a new message.
|
|
37
|
+
*/
|
|
38
|
+
export const WorkflowOut_ReplySchema = /*@__PURE__*/ messageDesc(file_ankka_protocol_v1_workflow, 1, 0);
|
|
39
|
+
/**
|
|
40
|
+
* Describes the message ankka.protocol.v1.WorkflowOut.StepReply.
|
|
41
|
+
* Use `create(WorkflowOut_StepReplySchema)` to create a new message.
|
|
42
|
+
*/
|
|
43
|
+
export const WorkflowOut_StepReplySchema = /*@__PURE__*/ messageDesc(file_ankka_protocol_v1_workflow, 1, 1);
|
|
44
|
+
/**
|
|
45
|
+
* Describes the message ankka.protocol.v1.StepRef.
|
|
46
|
+
* Use `create(StepRefSchema)` to create a new message.
|
|
47
|
+
*/
|
|
48
|
+
export const StepRefSchema = /*@__PURE__*/ messageDesc(file_ankka_protocol_v1_workflow, 2);
|
|
49
|
+
/**
|
|
50
|
+
* Describes the message ankka.protocol.v1.StepOutcome.
|
|
51
|
+
* Use `create(StepOutcomeSchema)` to create a new message.
|
|
52
|
+
*/
|
|
53
|
+
export const StepOutcomeSchema = /*@__PURE__*/ messageDesc(file_ankka_protocol_v1_workflow, 3);
|
|
54
|
+
/**
|
|
55
|
+
* Describes the message ankka.protocol.v1.StepOutcome.Pause.
|
|
56
|
+
* Use `create(StepOutcome_PauseSchema)` to create a new message.
|
|
57
|
+
*/
|
|
58
|
+
export const StepOutcome_PauseSchema = /*@__PURE__*/ messageDesc(file_ankka_protocol_v1_workflow, 3, 0);
|
|
59
|
+
/**
|
|
60
|
+
* Describes the message ankka.protocol.v1.StepOutcome.End.
|
|
61
|
+
* Use `create(StepOutcome_EndSchema)` to create a new message.
|
|
62
|
+
*/
|
|
63
|
+
export const StepOutcome_EndSchema = /*@__PURE__*/ messageDesc(file_ankka_protocol_v1_workflow, 3, 1);
|
|
64
|
+
/**
|
|
65
|
+
* @generated from service ankka.protocol.v1.Workflow
|
|
66
|
+
*/
|
|
67
|
+
export const Workflow = /*@__PURE__*/ serviceDesc(file_ankka_protocol_v1_workflow, 0);
|
package/dist/agent.d.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Metadata } from "./effects/common.ts";
|
|
2
|
+
import type { ComponentClient } from "./client.ts";
|
|
3
|
+
import type { GuardrailRef, HandlerTable, ToolRef } from "./handlers.ts";
|
|
4
|
+
import { AgentEffects } from "./effects/agent.ts";
|
|
5
|
+
export declare abstract class Agent {
|
|
6
|
+
#private;
|
|
7
|
+
readonly effects: AgentEffects;
|
|
8
|
+
/** The session this request belongs to. Captured when the plan is made; tools run after the handler has returned. */
|
|
9
|
+
get sessionId(): string;
|
|
10
|
+
get metadata(): Metadata;
|
|
11
|
+
get client(): ComponentClient;
|
|
12
|
+
/** @internal */
|
|
13
|
+
get _kind(): "agent";
|
|
14
|
+
/** @internal */
|
|
15
|
+
_bind(sessionId: string, metadata: Metadata, client: ComponentClient): void;
|
|
16
|
+
}
|
|
17
|
+
export interface AgentClass<C extends Agent = Agent> {
|
|
18
|
+
new (): C;
|
|
19
|
+
readonly componentId: string;
|
|
20
|
+
/** A description of the agent, for the console and the model's system context. */
|
|
21
|
+
readonly role?: string;
|
|
22
|
+
/** How many tool calls one turn may make; 100 by default. */
|
|
23
|
+
readonly maxToolCallSteps?: number;
|
|
24
|
+
readonly tools?: Readonly<Record<string, ToolRef<C, any>>>;
|
|
25
|
+
readonly guardrails?: Readonly<Record<string, GuardrailRef>>;
|
|
26
|
+
readonly handlers: HandlerTable<C>;
|
|
27
|
+
}
|
package/dist/agent.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// An agent: this process declares the instructions, the tools and the guardrails; the sidecar runs the
|
|
2
|
+
// loop — the model call, tool dispatch, session memory, compaction and token accounting. The process
|
|
3
|
+
// is asked to plan an interaction, to run a tool and to check a guardrail, and nothing else.
|
|
4
|
+
//
|
|
5
|
+
// static readonly tools = { lookup: tool("lookup", "Looks up a cart by id.", CartLookup, (a: Assistant, input) => a.lookup(input.cartId)) }
|
|
6
|
+
// static readonly guardrails = { noSecrets: guardrail("no-secrets", (stage, text) => text.includes("sk-") ? "a key leaked" : null) }
|
|
7
|
+
// static readonly handlers = { ask: command("ask", s.string, s.string, (a: Assistant, q) => a.ask(q)), chat: stream("chat", s.string, (a: Assistant, q) => a.ask(q)) }
|
|
8
|
+
import { AgentEffects } from "./effects/agent.js";
|
|
9
|
+
export class Agent {
|
|
10
|
+
effects = new AgentEffects();
|
|
11
|
+
#sessionId = "";
|
|
12
|
+
#metadata = {};
|
|
13
|
+
#client;
|
|
14
|
+
/** The session this request belongs to. Captured when the plan is made; tools run after the handler has returned. */
|
|
15
|
+
get sessionId() {
|
|
16
|
+
return this.#sessionId;
|
|
17
|
+
}
|
|
18
|
+
get metadata() {
|
|
19
|
+
return this.#metadata;
|
|
20
|
+
}
|
|
21
|
+
get client() {
|
|
22
|
+
if (!this.#client)
|
|
23
|
+
throw new Error("client is only available inside a handler, a tool or a guardrail");
|
|
24
|
+
return this.#client;
|
|
25
|
+
}
|
|
26
|
+
/** @internal */
|
|
27
|
+
get _kind() {
|
|
28
|
+
return "agent";
|
|
29
|
+
}
|
|
30
|
+
/** @internal */
|
|
31
|
+
_bind(sessionId, metadata, client) {
|
|
32
|
+
this.#sessionId = sessionId;
|
|
33
|
+
this.#metadata = metadata;
|
|
34
|
+
this.#client = client;
|
|
35
|
+
}
|
|
36
|
+
}
|