ankka 0.11.0 → 0.13.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.
Files changed (92) hide show
  1. package/README.md +1 -0
  2. package/dist/_proto/ankka/protocol/v1/client_pb.d.ts +910 -0
  3. package/dist/_proto/ankka/protocol/v1/client_pb.js +239 -23
  4. package/dist/_proto/ankka/protocol/v1/consumer_pb.d.ts +10 -1
  5. package/dist/_proto/ankka/protocol/v1/consumer_pb.js +1 -1
  6. package/dist/_proto/ankka/protocol/v1/discovery_pb.d.ts +177 -0
  7. package/dist/_proto/ankka/protocol/v1/discovery_pb.js +51 -36
  8. package/dist/_proto/ankka/protocol/v1/endpoint_pb.d.ts +26 -0
  9. package/dist/_proto/ankka/protocol/v1/endpoint_pb.js +15 -10
  10. package/dist/_proto/ankka/protocol/v1/event_sourced_pb.d.ts +86 -0
  11. package/dist/_proto/ankka/protocol/v1/event_sourced_pb.js +11 -1
  12. package/dist/_proto/ankka/protocol/v1/mcp_pb.d.ts +120 -0
  13. package/dist/_proto/ankka/protocol/v1/mcp_pb.js +29 -0
  14. package/dist/_proto/ankka/protocol/v1/payload_pb.d.ts +61 -0
  15. package/dist/_proto/ankka/protocol/v1/payload_pb.js +18 -1
  16. package/dist/_proto/ankka/protocol/v1/view_pb.d.ts +7 -1
  17. package/dist/_proto/ankka/protocol/v1/view_pb.js +1 -1
  18. package/dist/_proto/ankka/protocol/v1/wasm_pb.d.ts +12 -0
  19. package/dist/_proto/ankka/protocol/v1/wasm_pb.js +1 -1
  20. package/dist/agent.d.ts +10 -0
  21. package/dist/agent.js +20 -0
  22. package/dist/autonomous.d.ts +5 -0
  23. package/dist/autonomous.js +10 -0
  24. package/dist/client-keys.d.ts +89 -0
  25. package/dist/client-keys.js +182 -0
  26. package/dist/client.d.ts +96 -3
  27. package/dist/client.js +228 -6
  28. package/dist/consumer.d.ts +23 -1
  29. package/dist/consumer.js +25 -1
  30. package/dist/context.d.ts +25 -1
  31. package/dist/context.js +5 -2
  32. package/dist/contract.d.ts +4 -0
  33. package/dist/contract.js +2 -0
  34. package/dist/effects/common.d.ts +7 -0
  35. package/dist/effects/common.js +9 -1
  36. package/dist/effects/eventSourced.d.ts +26 -1
  37. package/dist/effects/eventSourced.js +58 -5
  38. package/dist/endpoint.d.ts +10 -0
  39. package/dist/endpoint.js +20 -0
  40. package/dist/eventSourcedEntity.d.ts +8 -3
  41. package/dist/graph.d.ts +14 -1
  42. package/dist/graph.js +17 -1
  43. package/dist/index.d.ts +10 -4
  44. package/dist/index.js +8 -2
  45. package/dist/keyedView.d.ts +4 -1
  46. package/dist/keyedView.js +7 -1
  47. package/dist/kinds.js +2 -0
  48. package/dist/mcp-endpoint.d.ts +144 -0
  49. package/dist/mcp-endpoint.js +256 -0
  50. package/dist/routes.d.ts +46 -3
  51. package/dist/routes.js +56 -3
  52. package/dist/server/discovery.d.ts +12 -0
  53. package/dist/server/discovery.js +115 -4
  54. package/dist/server/eventSourced.d.ts +4 -1
  55. package/dist/server/eventSourced.js +24 -6
  56. package/dist/server/http.d.ts +8 -0
  57. package/dist/server/http.js +12 -4
  58. package/dist/server/mcp.d.ts +17 -0
  59. package/dist/server/mcp.js +157 -0
  60. package/dist/server/server.d.ts +11 -1
  61. package/dist/server/server.js +19 -0
  62. package/dist/server/stateless.js +5 -4
  63. package/dist/server/storageEndpoint.d.ts +14 -0
  64. package/dist/server/storageEndpoint.js +82 -0
  65. package/dist/service.d.ts +12 -1
  66. package/dist/service.js +73 -5
  67. package/dist/sigv4.d.ts +47 -0
  68. package/dist/sigv4.js +149 -0
  69. package/dist/spec.d.ts +8 -2
  70. package/dist/spec.js +62 -6
  71. package/dist/standing.d.ts +18 -0
  72. package/dist/standing.js +26 -0
  73. package/dist/startFrom.d.ts +4 -0
  74. package/dist/startFrom.js +8 -1
  75. package/dist/storage.d.ts +288 -0
  76. package/dist/storage.js +1081 -0
  77. package/dist/testkit/index.d.ts +1 -1
  78. package/dist/testkit/integration.d.ts +9 -0
  79. package/dist/testkit/integration.js +5 -1
  80. package/dist/testkit/kinds.d.ts +25 -9
  81. package/dist/testkit/kinds.js +53 -28
  82. package/dist/testkit/unit.d.ts +31 -3
  83. package/dist/testkit/unit.js +55 -11
  84. package/dist/timedAction.d.ts +10 -0
  85. package/dist/timedAction.js +20 -0
  86. package/dist/version.d.ts +1 -1
  87. package/dist/version.js +1 -1
  88. package/dist/view.d.ts +18 -3
  89. package/dist/view.js +13 -4
  90. package/dist/workflow.d.ts +8 -0
  91. package/dist/workflow.js +15 -0
  92. package/package.json +1 -1
@@ -0,0 +1,120 @@
1
+ import type { GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv2";
2
+ import type { Failure, Metadata } from "./payload_pb.ts";
3
+ import type { Caller, Principal } from "./endpoint_pb.ts";
4
+ import type { Message } from "@bufbuild/protobuf";
5
+ /**
6
+ * Describes the file ankka/protocol/v1/mcp.proto.
7
+ */
8
+ export declare const file_ankka_protocol_v1_mcp: GenFile;
9
+ /**
10
+ * @generated from message ankka.protocol.v1.McpToolRequest
11
+ */
12
+ export type McpToolRequest = Message<"ankka.protocol.v1.McpToolRequest"> & {
13
+ /**
14
+ * @generated from field: string endpoint_id = 1;
15
+ */
16
+ endpointId: string;
17
+ /**
18
+ * @generated from field: string tool = 2;
19
+ */
20
+ tool: string;
21
+ /**
22
+ * a JSON object, already checked against the tool's schema's types
23
+ *
24
+ * @generated from field: string arguments_json = 3;
25
+ */
26
+ argumentsJson: string;
27
+ /**
28
+ * when the ACL authenticated: a token's or a client key's, never the credential
29
+ *
30
+ * @generated from field: optional ankka.protocol.v1.Principal principal = 4;
31
+ */
32
+ principal?: Principal | undefined;
33
+ /**
34
+ * @generated from field: optional ankka.protocol.v1.Caller caller = 5;
35
+ */
36
+ caller?: Caller | undefined;
37
+ /**
38
+ * the trace, and the tool as the caller of what it calls
39
+ *
40
+ * @generated from field: ankka.protocol.v1.Metadata metadata = 6;
41
+ */
42
+ metadata?: Metadata | undefined;
43
+ };
44
+ /**
45
+ * Describes the message ankka.protocol.v1.McpToolRequest.
46
+ * Use `create(McpToolRequestSchema)` to create a new message.
47
+ */
48
+ export declare const McpToolRequestSchema: GenMessage<McpToolRequest>;
49
+ /**
50
+ * @generated from message ankka.protocol.v1.McpToolReply
51
+ */
52
+ export type McpToolReply = Message<"ankka.protocol.v1.McpToolReply"> & {
53
+ /**
54
+ * @generated from oneof ankka.protocol.v1.McpToolReply.reply
55
+ */
56
+ reply: {
57
+ /**
58
+ * @generated from field: ankka.protocol.v1.McpToolAnswer ok = 1;
59
+ */
60
+ value: McpToolAnswer;
61
+ case: "ok";
62
+ } | {
63
+ /**
64
+ * a tool error: the message the model reads
65
+ *
66
+ * @generated from field: string error = 2;
67
+ */
68
+ value: string;
69
+ case: "error";
70
+ } | {
71
+ /**
72
+ * the process could not run it
73
+ *
74
+ * @generated from field: ankka.protocol.v1.Failure failure = 3;
75
+ */
76
+ value: Failure;
77
+ case: "failure";
78
+ } | {
79
+ case: undefined;
80
+ value?: undefined;
81
+ };
82
+ };
83
+ /**
84
+ * Describes the message ankka.protocol.v1.McpToolReply.
85
+ * Use `create(McpToolReplySchema)` to create a new message.
86
+ */
87
+ export declare const McpToolReplySchema: GenMessage<McpToolReply>;
88
+ /**
89
+ * @generated from message ankka.protocol.v1.McpToolAnswer
90
+ */
91
+ export type McpToolAnswer = Message<"ankka.protocol.v1.McpToolAnswer"> & {
92
+ /**
93
+ * @generated from field: string text = 1;
94
+ */
95
+ text: string;
96
+ /**
97
+ * when the result is a record or a map
98
+ *
99
+ * @generated from field: optional string structured_json = 2;
100
+ */
101
+ structuredJson?: string | undefined;
102
+ };
103
+ /**
104
+ * Describes the message ankka.protocol.v1.McpToolAnswer.
105
+ * Use `create(McpToolAnswerSchema)` to create a new message.
106
+ */
107
+ export declare const McpToolAnswerSchema: GenMessage<McpToolAnswer>;
108
+ /**
109
+ * @generated from service ankka.protocol.v1.Mcp
110
+ */
111
+ export declare const Mcp: GenService<{
112
+ /**
113
+ * @generated from rpc ankka.protocol.v1.Mcp.InvokeTool
114
+ */
115
+ invokeTool: {
116
+ methodKind: "unary";
117
+ input: typeof McpToolRequestSchema;
118
+ output: typeof McpToolReplySchema;
119
+ };
120
+ }>;
@@ -0,0 +1,29 @@
1
+ // A tool of an MCP endpoint the process declared in discovery (protocol 1.20). The sidecar serves
2
+ // the endpoint: it answers the MCP protocol, applies the ACL and checks the arguments against the
3
+ // tool's schema, then asks the process to run the tool. The process never sees the credential.
4
+ import { fileDesc, messageDesc, serviceDesc } from "@bufbuild/protobuf/codegenv2";
5
+ import { file_ankka_protocol_v1_payload } from "./payload_pb.js";
6
+ import { file_ankka_protocol_v1_endpoint } from "./endpoint_pb.js";
7
+ /**
8
+ * Describes the file ankka/protocol/v1/mcp.proto.
9
+ */
10
+ export const file_ankka_protocol_v1_mcp = /*@__PURE__*/ fileDesc("ChthbmtrYS9wcm90b2NvbC92MS9tY3AucHJvdG8SEWFua2thLnByb3RvY29sLnYxIvkBCg5NY3BUb29sUmVxdWVzdBITCgtlbmRwb2ludF9pZBgBIAEoCRIMCgR0b29sGAIgASgJEhYKDmFyZ3VtZW50c19qc29uGAMgASgJEjQKCXByaW5jaXBhbBgEIAEoCzIcLmFua2thLnByb3RvY29sLnYxLlByaW5jaXBhbEgAiAEBEi4KBmNhbGxlchgFIAEoCzIZLmFua2thLnByb3RvY29sLnYxLkNhbGxlckgBiAEBEi0KCG1ldGFkYXRhGAYgASgLMhsuYW5ra2EucHJvdG9jb2wudjEuTWV0YWRhdGFCDAoKX3ByaW5jaXBhbEIJCgdfY2FsbGVyIocBCgxNY3BUb29sUmVwbHkSLgoCb2sYASABKAsyIC5hbmtrYS5wcm90b2NvbC52MS5NY3BUb29sQW5zd2VySAASDwoFZXJyb3IYAiABKAlIABItCgdmYWlsdXJlGAMgASgLMhouYW5ra2EucHJvdG9jb2wudjEuRmFpbHVyZUgAQgcKBXJlcGx5Ik8KDU1jcFRvb2xBbnN3ZXISDAoEdGV4dBgBIAEoCRIcCg9zdHJ1Y3R1cmVkX2pzb24YAiABKAlIAIgBAUISChBfc3RydWN0dXJlZF9qc29uMlcKA01jcBJQCgpJbnZva2VUb29sEiEuYW5ra2EucHJvdG9jb2wudjEuTWNwVG9vbFJlcXVlc3QaHy5hbmtrYS5wcm90b2NvbC52MS5NY3BUb29sUmVwbHliBnByb3RvMw", [file_ankka_protocol_v1_payload, file_ankka_protocol_v1_endpoint]);
11
+ /**
12
+ * Describes the message ankka.protocol.v1.McpToolRequest.
13
+ * Use `create(McpToolRequestSchema)` to create a new message.
14
+ */
15
+ export const McpToolRequestSchema = /*@__PURE__*/ messageDesc(file_ankka_protocol_v1_mcp, 0);
16
+ /**
17
+ * Describes the message ankka.protocol.v1.McpToolReply.
18
+ * Use `create(McpToolReplySchema)` to create a new message.
19
+ */
20
+ export const McpToolReplySchema = /*@__PURE__*/ messageDesc(file_ankka_protocol_v1_mcp, 1);
21
+ /**
22
+ * Describes the message ankka.protocol.v1.McpToolAnswer.
23
+ * Use `create(McpToolAnswerSchema)` to create a new message.
24
+ */
25
+ export const McpToolAnswerSchema = /*@__PURE__*/ messageDesc(file_ankka_protocol_v1_mcp, 2);
26
+ /**
27
+ * @generated from service ankka.protocol.v1.Mcp
28
+ */
29
+ export const Mcp = /*@__PURE__*/ serviceDesc(file_ankka_protocol_v1_mcp, 0);
@@ -76,6 +76,16 @@ export type Error = Message<"ankka.protocol.v1.Error"> & {
76
76
  * @generated from field: ankka.protocol.v1.ErrorCode code = 2;
77
77
  */
78
78
  code: ErrorCode;
79
+ /**
80
+ * 1.18: what a caller reads without parsing the message. A WORKFLOW_FAILED carries `step` (when
81
+ * one failed), `reason`, and `deleted` = "true" for a deleted workflow. Set only by the 1.18
82
+ * rpcs; a reader from before ignores it.
83
+ *
84
+ * @generated from field: map<string, string> details = 3;
85
+ */
86
+ details: {
87
+ [key: string]: string;
88
+ };
79
89
  };
80
90
  /**
81
91
  * Describes the message ankka.protocol.v1.Error.
@@ -229,6 +239,45 @@ export type Empty = Message<"ankka.protocol.v1.Empty"> & {};
229
239
  * Use `create(EmptySchema)` to create a new message.
230
240
  */
231
241
  export declare const EmptySchema: GenMessage<Empty>;
242
+ /**
243
+ * 1.16: where a workflow stood once the effect that recorded a state was applied. Carried on a
244
+ * view's or a consumer's request for a change from a workflow source, and on nothing else.
245
+ *
246
+ * @generated from message ankka.protocol.v1.WorkflowStanding
247
+ */
248
+ export type WorkflowStanding = Message<"ankka.protocol.v1.WorkflowStanding"> & {
249
+ /**
250
+ * NotStarted, Running, Paused, Completed, Failed, or Unknown for a state recorded before 1.16
251
+ *
252
+ * @generated from field: string status = 1;
253
+ */
254
+ status: string;
255
+ /**
256
+ * the step the workflow is on, or the step a pause names or follows
257
+ *
258
+ * @generated from field: optional string step = 2;
259
+ */
260
+ step?: string | undefined;
261
+ /**
262
+ * retries so far, per step
263
+ *
264
+ * @generated from field: map<string, int32> retries = 3;
265
+ */
266
+ retries: {
267
+ [key: string]: number;
268
+ };
269
+ /**
270
+ * why it failed, when it did
271
+ *
272
+ * @generated from field: optional string failure = 4;
273
+ */
274
+ failure?: string | undefined;
275
+ };
276
+ /**
277
+ * Describes the message ankka.protocol.v1.WorkflowStanding.
278
+ * Use `create(WorkflowStandingSchema)` to create a new message.
279
+ */
280
+ export declare const WorkflowStandingSchema: GenMessage<WorkflowStanding>;
232
281
  /**
233
282
  * @generated from enum ankka.protocol.v1.ErrorCode
234
283
  */
@@ -265,6 +314,18 @@ export declare const ErrorCode: {
265
314
  * @generated from enum value: UNAVAILABLE = 7;
266
315
  */
267
316
  readonly UNAVAILABLE: 7;
317
+ /**
318
+ * 1.18: a workflow a caller waited for failed or was deleted
319
+ *
320
+ * @generated from enum value: WORKFLOW_FAILED = 8;
321
+ */
322
+ readonly WORKFLOW_FAILED: 8;
323
+ /**
324
+ * 1.19: a replicated entity's copy here cannot answer; the message names its home
325
+ *
326
+ * @generated from enum value: NOT_HOME = 9;
327
+ */
328
+ readonly NOT_HOME: 9;
268
329
  };
269
330
  /**
270
331
  * @generated from enum ankka.protocol.v1.ErrorCode
@@ -6,7 +6,7 @@ import { enumDesc, fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv2";
6
6
  /**
7
7
  * Describes the file ankka/protocol/v1/payload.proto.
8
8
  */
9
- export const file_ankka_protocol_v1_payload = /*@__PURE__*/ fileDesc("Ch9hbmtrYS9wcm90b2NvbC92MS9wYXlsb2FkLnByb3RvEhFhbmtrYS5wcm90b2NvbC52MSI/CgdQYXlsb2FkEhQKDGNvbnRlbnRfdHlwZRgBIAEoCRIQCghtYW5pZmVzdBgCIAEoCRIMCgRkYXRhGAMgASgMImMKCE1ldGFkYXRhEjIKB2VudHJpZXMYASADKAsyIS5hbmtrYS5wcm90b2NvbC52MS5NZXRhZGF0YS5FbnRyeRojCgVFbnRyeRILCgNrZXkYASABKAkSDQoFdmFsdWUYAiABKAkiRAoFRXJyb3ISDwoHbWVzc2FnZRgBIAEoCRIqCgRjb2RlGAIgASgOMhwuYW5ra2EucHJvdG9jb2wudjEuRXJyb3JDb2RlIkYKB0ZhaWx1cmUSEgoKY29tbWFuZF9pZBgBIAEoAxInCgVlcnJvchgCIAEoCzIYLmFua2thLnByb3RvY29sLnYxLkVycm9yIpoCCgdPdXRjb21lEjEKBXJlcGx5GAEgASgLMiAuYW5ra2EucHJvdG9jb2wudjEuT3V0Y29tZS5SZXBseUgAEjYKCG5vX3JlcGx5GAIgASgLMiIuYW5ra2EucHJvdG9jb2wudjEuT3V0Y29tZS5Ob1JlcGx5SAASKQoFZXJyb3IYAyABKAsyGC5hbmtrYS5wcm90b2NvbC52MS5FcnJvckgAGmMKBVJlcGx5EisKB3BheWxvYWQYASABKAsyGi5hbmtrYS5wcm90b2NvbC52MS5QYXlsb2FkEi0KCG1ldGFkYXRhGAIgASgLMhsuYW5ra2EucHJvdG9jb2wudjEuTWV0YWRhdGEaCQoHTm9SZXBseUIJCgdvdXRjb21lIsQBCglSZXRlbnRpb24SPAoKZGVsZXRlX25vdxgBIAEoCzImLmFua2thLnByb3RvY29sLnYxLlJldGVudGlvbi5EZWxldGVOb3dIABJACgxleHBpcmVfYWZ0ZXIYAiABKAsyKC5hbmtrYS5wcm90b2NvbC52MS5SZXRlbnRpb24uRXhwaXJlQWZ0ZXJIABoLCglEZWxldGVOb3caHQoLRXhwaXJlQWZ0ZXISDgoGbWlsbGlzGAEgASgDQgsKCXJldGVudGlvbiIHCgVFbXB0eSqGAQoJRXJyb3JDb2RlEgwKCElOVEVSTkFMEAASDwoLQkFEX1JFUVVFU1QQARIQCgxVTkFVVEhPUklaRUQQAhINCglGT1JCSURERU4QAxINCglOT1RfRk9VTkQQBBIMCghDT05GTElDVBAFEgsKB1RJTUVPVVQQBhIPCgtVTkFWQUlMQUJMRRAHYgZwcm90bzM");
9
+ export const file_ankka_protocol_v1_payload = /*@__PURE__*/ fileDesc("Ch9hbmtrYS9wcm90b2NvbC92MS9wYXlsb2FkLnByb3RvEhFhbmtrYS5wcm90b2NvbC52MSI/CgdQYXlsb2FkEhQKDGNvbnRlbnRfdHlwZRgBIAEoCRIQCghtYW5pZmVzdBgCIAEoCRIMCgRkYXRhGAMgASgMImMKCE1ldGFkYXRhEjIKB2VudHJpZXMYASADKAsyIS5hbmtrYS5wcm90b2NvbC52MS5NZXRhZGF0YS5FbnRyeRojCgVFbnRyeRILCgNrZXkYASABKAkSDQoFdmFsdWUYAiABKAkirAEKBUVycm9yEg8KB21lc3NhZ2UYASABKAkSKgoEY29kZRgCIAEoDjIcLmFua2thLnByb3RvY29sLnYxLkVycm9yQ29kZRI2CgdkZXRhaWxzGAMgAygLMiUuYW5ra2EucHJvdG9jb2wudjEuRXJyb3IuRGV0YWlsc0VudHJ5Gi4KDERldGFpbHNFbnRyeRILCgNrZXkYASABKAkSDQoFdmFsdWUYAiABKAk6AjgBIkYKB0ZhaWx1cmUSEgoKY29tbWFuZF9pZBgBIAEoAxInCgVlcnJvchgCIAEoCzIYLmFua2thLnByb3RvY29sLnYx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09ORkxJQ1QQBRILCgdUSU1FT1VUEAYSDwoLVU5BVkFJTEFCTEUQBxITCg9XT1JLRkxPV19GQUlMRUQQCBIMCghOT1RfSE9NRRAJYgZwcm90bzM");
10
10
  /**
11
11
  * Describes the message ankka.protocol.v1.Payload.
12
12
  * Use `create(PayloadSchema)` to create a new message.
@@ -67,6 +67,11 @@ export const Retention_ExpireAfterSchema = /*@__PURE__*/ messageDesc(file_ankka_
67
67
  * Use `create(EmptySchema)` to create a new message.
68
68
  */
69
69
  export const EmptySchema = /*@__PURE__*/ messageDesc(file_ankka_protocol_v1_payload, 6);
70
+ /**
71
+ * Describes the message ankka.protocol.v1.WorkflowStanding.
72
+ * Use `create(WorkflowStandingSchema)` to create a new message.
73
+ */
74
+ export const WorkflowStandingSchema = /*@__PURE__*/ messageDesc(file_ankka_protocol_v1_payload, 7);
70
75
  /**
71
76
  * @generated from enum ankka.protocol.v1.ErrorCode
72
77
  */
@@ -103,6 +108,18 @@ export const ErrorCode = {
103
108
  * @generated from enum value: UNAVAILABLE = 7;
104
109
  */
105
110
  UNAVAILABLE: 7,
111
+ /**
112
+ * 1.18: a workflow a caller waited for failed or was deleted
113
+ *
114
+ * @generated from enum value: WORKFLOW_FAILED = 8;
115
+ */
116
+ WORKFLOW_FAILED: 8,
117
+ /**
118
+ * 1.19: a replicated entity's copy here cannot answer; the message names its home
119
+ *
120
+ * @generated from enum value: NOT_HOME = 9;
121
+ */
122
+ NOT_HOME: 9,
106
123
  };
107
124
  /**
108
125
  * Describes the enum ankka.protocol.v1.ErrorCode.
@@ -1,5 +1,5 @@
1
1
  import type { GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv2";
2
- import type { Empty, Metadata, Payload } from "./payload_pb.ts";
2
+ import type { Empty, Metadata, Payload, WorkflowStanding } from "./payload_pb.ts";
3
3
  import type { Message } from "@bufbuild/protobuf";
4
4
  /**
5
5
  * Describes the file ankka/protocol/v1/view.proto.
@@ -43,6 +43,12 @@ export type ViewRequest = Message<"ankka.protocol.v1.ViewRequest"> & {
43
43
  * @generated from field: optional string source_id = 6;
44
44
  */
45
45
  sourceId?: string | undefined;
46
+ /**
47
+ * 1.16: a change from a workflow source: where it stood once the effect was applied
48
+ *
49
+ * @generated from field: optional ankka.protocol.v1.WorkflowStanding standing = 7;
50
+ */
51
+ standing?: WorkflowStanding | undefined;
46
52
  };
47
53
  /**
48
54
  * Describes the message ankka.protocol.v1.ViewRequest.
@@ -6,7 +6,7 @@ import { file_ankka_protocol_v1_payload } from "./payload_pb.js";
6
6
  /**
7
7
  * Describes the file ankka/protocol/v1/view.proto.
8
8
  */
9
- export const file_ankka_protocol_v1_view = /*@__PURE__*/ fileDesc("ChxhbmtrYS9wcm90b2NvbC92MS92aWV3LnByb3RvEhFhbmtrYS5wcm90b2NvbC52MSLqAQoLVmlld1JlcXVlc3QSFAoMY29tcG9uZW50X2lkGAEgASgJEikKBWV2ZW50GAIgASgLMhouYW5ra2EucHJvdG9jb2wudjEuUGF5bG9hZBItCghtZXRhZGF0YRgDIAEoCzIbLmFua2thLnByb3RvY29sLnYxLk1ldGFkYXRhEiwKA3JvdxgEIAEoCzIaLmFua2thLnByb3RvY29sLnYxLlBheWxvYWRIAIgBARIPCgdkZWxldGVkGAUgASgIEhYKCXNvdXJjZV9pZBgGIAEoCUgBiAEBQgYKBF9yb3dCDAoKX3NvdXJjZV9pZCLTAQoKVmlld0VmZmVjdBIwCgp1cGRhdGVfcm93GAEgASgLMhouYW5ra2EucHJvdG9jb2wudjEuUGF5bG9hZEgAEi4KCmRlbGV0ZV9yb3cYAiABKAsyGC5hbmtrYS5wcm90b2NvbC52MS5FbXB0eUgAEioKBmlnbm9yZRgDIAEoCzIYLmFua2thLnByb3RvY29sLnYxLkVtcHR5SAASLQoEcm93cxgEIAEoCzIdLmFua2thLnByb3RvY29sLnYxLlJvd0NoYW5nZXNIAEIICgZlZmZlY3QiOwoKUm93Q2hhbmdlcxItCgdjaGFuZ2VzGAEgAygLMhwuYW5ra2EucHJvdG9jb2wudjEuUm93Q2hhbmdlInwKCVJvd0NoYW5nZRILCgNrZXkYASABKAkSLAoGdXBzZXJ0GAIgASgLMhouYW5ra2EucHJvdG9jb2wudjEuUGF5bG9hZEgAEioKBmRlbGV0ZRgDIAEoCzIYLmFua2thLnByb3RvY29sLnYxLkVtcHR5SABCCAoGY2hhbmdlMk8KBFZpZXcSRwoGSGFuZGxlEh4uYW5ra2EucHJvdG9jb2wudjEuVmlld1JlcXVlc3QaHS5hbmtrYS5wcm90b2NvbC52MS5WaWV3RWZmZWN0YgZwcm90bzM", [file_ankka_protocol_v1_payload]);
9
+ export const file_ankka_protocol_v1_view = /*@__PURE__*/ fileDesc("ChxhbmtrYS9wcm90b2NvbC92MS92aWV3LnByb3RvEhFhbmtrYS5wcm90b2NvbC52MSKzAgoLVmlld1JlcXVlc3QSFAoMY29tcG9uZW50X2lkGAEgASgJEikKBWV2ZW50GAIgASgLMhouYW5ra2EucHJvdG9jb2wudjEuUGF5bG9hZBItCghtZXRhZGF0YRgDIAEoCzIbLmFua2thLnByb3RvY29sLnYxLk1ldGFkYXRhEiwKA3JvdxgEIAEoCzIaLmFua2thLnByb3RvY29sLnYxLlBheWxvYWRIAIgBARIPCgdkZWxldGVkGAUgASgIEhYKCXNvdXJjZV9pZBgGIAEoCUgBiAEBEjoKCHN0YW5kaW5nGAcgASgLMiMuYW5ra2EucHJvdG9jb2wudjEuV29ya2Zsb3dTdGFuZGluZ0gCiAEBQgYKBF9yb3dCDAoKX3NvdXJjZV9pZEILCglfc3RhbmRpbmci0wEKClZpZXdFZmZlY3QSMAoKdXBkYXRlX3JvdxgBIAEoCzIaLmFua2thLnByb3RvY29sLnYxLlBheWxvYWRIABIuCgpkZWxldGVfcm93GAIgASgLMhguYW5ra2EucHJvdG9jb2wudjEuRW1wdHlIABIqCgZpZ25vcmUYAyABKAsyGC5hbmtrYS5wcm90b2NvbC52MS5FbXB0eUgAEi0KBHJvd3MYBCABKAsyHS5hbmtrYS5wcm90b2NvbC52MS5Sb3dDaGFuZ2VzSABCCAoGZWZmZWN0IjsKClJvd0NoYW5nZXMSLQoHY2hhbmdlcxgBIAMoCzIcLmFua2thLnByb3RvY29sLnYxLlJvd0NoYW5nZSJ8CglSb3dDaGFuZ2USCwoDa2V5GAEgASgJEiwKBnVwc2VydBgCIAEoCzIaLmFua2thLnByb3RvY29sLnYxLlBheWxvYWRIABIqCgZkZWxldGUYAyABKAsyGC5hbmtrYS5wcm90b2NvbC52MS5FbXB0eUgAQggKBmNoYW5nZTJPCgRWaWV3EkcKBkhhbmRsZRIeLmFua2thLnByb3RvY29sLnYxLlZpZXdSZXF1ZXN0Gh0uYW5ra2EucHJvdG9jb2wudjEuVmlld0VmZmVjdGIGcHJvdG8z", [file_ankka_protocol_v1_payload]);
10
10
  /**
11
11
  * Describes the message ankka.protocol.v1.ViewRequest.
12
12
  * Use `create(ViewRequestSchema)` to create a new message.
@@ -167,6 +167,18 @@ export type FoldRequest = Message<"ankka.protocol.v1.FoldRequest"> & {
167
167
  * @generated from field: int64 sequence = 5;
168
168
  */
169
169
  sequence: bigint;
170
+ /**
171
+ * 1.19: where the event was written; empty when none is named
172
+ *
173
+ * @generated from field: string installation = 6;
174
+ */
175
+ installation: string;
176
+ /**
177
+ * 1.19: written at another installation than this one
178
+ *
179
+ * @generated from field: bool mirrored = 7;
180
+ */
181
+ mirrored: boolean;
170
182
  };
171
183
  /**
172
184
  * Describes the message ankka.protocol.v1.FoldRequest.
@@ -14,7 +14,7 @@ import { file_ankka_protocol_v1_client } from "./client_pb.js";
14
14
  /**
15
15
  * Describes the file ankka/protocol/v1/wasm.proto.
16
16
  */
17
- export const file_ankka_protocol_v1_wasm = /*@__PURE__*/ fileDesc("ChxhbmtrYS9wcm90b2NvbC92MS93YXNtLnByb3RvEhFhbmtrYS5wcm90b2NvbC52MSJYCghXYXNtU3BlYxIlCgRzcGVjGAEgASgLMhcuYW5ra2EucHJvdG9jb2wudjEuU3BlYxIQCghzdGF0ZWZ1b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ZW50GAQgASgLMhouYW5ra2EucHJvdG9jb2wudjEuUGF5bG9hZBIQCghzZXF1ZW5jZRgFIAEoA0IICgZfc3RhdGUidAoJRm9sZFJlcGx5EikKBXN0YXRlGAEgASgLMhouYW5ra2EucHJvdG9jb2wudjEuUGF5bG9hZBIwCgdmYWlsdXJlGAIgASgLMhouYW5ra2EucHJvdG9jb2wudjEuRmFpbHVyZUgAiAEBQgoKCF9mYWlsdXJlIqkBCgtTdGVwUmVxdWVzdBIUCgxjb21wb25lbnRfaWQYASABKAkSEQoJZW50aXR5X2lkGAIgASgJEi4KBXN0YXRlGAMgASgLMhouYW5ra2EucHJvdG9jb2wudjEuUGF5bG9hZEgAiAEBEjcKCHJ1bl9zdGVwGAQgASgLMiUuYW5ra2EucHJvdG9jb2wudjEuV29ya2Zsb3dJbi5SdW5TdGVwQggKBl9zdGF0ZSK8AQoJU3RlcFJlcGx5EjcKBXJlcGx5GAEgASgLMiguYW5ra2EucHJvdG9jb2wudjEuV29ya2Zsb3dPdXQuU3RlcFJlcGx5Ei4KBXN0YXRlGAIgASgLMhouYW5ra2EucHJvdG9jb2wudjEuUGF5bG9hZEgAiAEBEjAKB2ZhaWx1cmUYAyABKAsyGi5hbmtrYS5wcm90b2NvbC52MS5GYWlsdXJlSAGIAQFCCAoGX3N0YXRlQgoKCF9mYWlsdXJlIjQKCVBhc3NpdmF0ZRIUCgxjb21wb25lbnRfaWQYASABKAkSEQoJZW50aXR5X2lkGAIgASgJIh0KDUNvbmZpZ1JlcXVlc3QSDAoEbmFtZRgBIAEoCSIrCgtDb25maWdSZXBseRISCgV2YWx1ZRgBIAEoCUgAiAEBQggKBl92YWx1ZSI+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]);
17
+ export const file_ankka_protocol_v1_wasm = /*@__PURE__*/ fileDesc("ChxhbmtrYS9wcm90b2NvbC92MS93YXNtLnByb3RvEhFhbmtrYS5wcm90b2NvbC52MSJYCghXYXNtU3BlYxIlCgRzcGVjGAEgASgLMhcuYW5ra2EucHJvdG9jb2wudjEuU3BlYxIQCghzdGF0ZWZ1bBgCIAMoCRITCgthYmlfdmVyc2lvbhgDIAEoCSLfAgoNSGFuZGxlUmVxdWVzdBIlCgRraW5kGAEgASgOMhcuYW5ra2EucHJvdG9jb2wudjEuS2luZBIUCgxjb21wb25lbnRfaWQYAiABKAkSEQoJZW50aXR5X2lkGAMgASgJEi4KBXN0YXRlGAQgASgLMhouYW5ra2EucHJvdG9jb2wudjEuUGF5bG9hZEgBiAEBEkIKDWV2ZW50X3NvdXJjZWQYCiABKAsyKS5hbmtrYS5wcm90b2NvbC52MS5FdmVudFNvdXJjZWRJbi5Db21tYW5kSAASOgoJa2V5X3ZhbHVlGAsgASgLMiUuYW5ra2EucHJvdG9jb2wudjEuS2V5VmFsdWVJbi5Db21tYW5kSAASOQoId29ya2Zsb3cYDCABKAsyJS5hbmtrYS5wcm90b2NvbC52MS5Xb3JrZmxvd0luLkNvbW1hbmRIAEIJCgdjb21tYW5kQggKBl9zdGF0ZSLGAgoLSGFuZGxlUmVwbHkSQQoNZXZlbnRfc291cmNlZBgKIAEoCzIoLmFua2thLnByb3RvY29sLnYxLkV2ZW50U291cmNlZE91dC5SZXBseUgAEjkKCWtleV92YWx1ZRgLIAEoCzIkLmFua2thLnByb3RvY29sLnYxLktleVZhbHVlT3V0LlJlcGx5SAASOAoId29ya2Zsb3cYDCABKAsyJC5hbmtrYS5wcm90b2NvbC52MS5Xb3JrZmxvd091dC5SZXBseUgAEi4KBXN0YXRlGAIgASgLMhouYW5ra2EucHJvdG9jb2wudjEuUGF5bG9hZEgBiAEBEjAKB2ZhaWx1cmUYAyABKAsyGi5hbmtrY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gwKBG5hbWUYASABKAkiKwoLQ29uZmlnUmVwbHkSEgoFdmFsdWUYASABKAlIAIgBAUIICgZfdmFsdWUiPgoMU3RyZWFtVG9rZW5zEi4KBnRva2VucxgBIAMoCzIeLmFua2thLnByb3RvY29sLnYxLlN0cmVhbVRva2VuYgZwcm90bzM", [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
18
  /**
19
19
  * Describes the message ankka.protocol.v1.WasmSpec.
20
20
  * Use `create(WasmSpecSchema)` to create a new message.
package/dist/agent.d.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  import type { Metadata } from "./effects/common.ts";
2
+ import { type ClientKeys } from "./client-keys.ts";
2
3
  import { type ComponentClient, type Secrets } from "./client.ts";
4
+ import { type Buckets } from "./storage.ts";
3
5
  import type { GuardrailRef, HandlerTable, ToolRef } from "./handlers.ts";
4
6
  import { AgentEffects } from "./effects/agent.ts";
5
7
  import { type Services } from "./services.ts";
@@ -15,6 +17,14 @@ export declare abstract class Agent {
15
17
  get secrets(): Secrets;
16
18
  /** A unit test's store in place of the runtime's: `component.secrets = new InMemorySecrets()`. */
17
19
  set secrets(store: Secrets);
20
+ /** The service's client keys (1.20): issued for its MCP endpoint, kept by the runtime, each shown once. */
21
+ get clientKeys(): ClientKeys;
22
+ /** A unit test's in place of the runtime's: `component.clientKeys = new InMemoryClientKeys()`. */
23
+ set clientKeys(keys: ClientKeys);
24
+ /** The service's buckets: `this.storage.default`, or `this.storage.bucket("photos")`. */
25
+ get storage(): Buckets;
26
+ /** A unit test's store in place of the runtime's: `component.storage = new InMemoryBuckets()`. */
27
+ set storage(buckets: Buckets);
18
28
  /** Other services, called as this one, through the runtime: `this.services.service("orders")`. */
19
29
  get services(): Services;
20
30
  /** A unit test's in place of the runtime's: `component.services = new ScriptedServices()`. */
package/dist/agent.js CHANGED
@@ -5,7 +5,9 @@
5
5
  // static readonly tools = { lookup: tool("lookup", "Looks up a cart by id.", CartLookup, (a: Assistant, input) => a.lookup(input.cartId)) }
6
6
  // static readonly guardrails = { noSecrets: guardrail("no-secrets", (stage, text) => text.includes("sk-") ? "a key leaked" : null) }
7
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 { clientKeysFor } from "./client-keys.js";
8
9
  import { secretsFor } from "./client.js";
10
+ import { processStorage } from "./storage.js";
9
11
  import { AgentEffects } from "./effects/agent.js";
10
12
  import { servicesFor } from "./services.js";
11
13
  export class Agent {
@@ -34,6 +36,24 @@ export class Agent {
34
36
  set secrets(store) {
35
37
  this.#secrets = store;
36
38
  }
39
+ #clientKeys;
40
+ /** The service's client keys (1.20): issued for its MCP endpoint, kept by the runtime, each shown once. */
41
+ get clientKeys() {
42
+ return this.#clientKeys ?? clientKeysFor(this.client);
43
+ }
44
+ /** A unit test's in place of the runtime's: `component.clientKeys = new InMemoryClientKeys()`. */
45
+ set clientKeys(keys) {
46
+ this.#clientKeys = keys;
47
+ }
48
+ #storage;
49
+ /** The service's buckets: `this.storage.default`, or `this.storage.bucket("photos")`. */
50
+ get storage() {
51
+ return this.#storage ?? processStorage();
52
+ }
53
+ /** A unit test's store in place of the runtime's: `component.storage = new InMemoryBuckets()`. */
54
+ set storage(buckets) {
55
+ this.#storage = buckets;
56
+ }
37
57
  #services;
38
58
  /** Other services, called as this one, through the runtime: `this.services.service("orders")`. */
39
59
  get services() {
@@ -1,6 +1,7 @@
1
1
  import { type ApprovalRequest, type DecisionInput } from "./approvals.ts";
2
2
  import type { McpServerRef, ResultGuardrailRef } from "./mcp.ts";
3
3
  import { type ComponentClient, type Secrets } from "./client.ts";
4
+ import { type Buckets } from "./storage.ts";
4
5
  import type { GuardrailRef, ToolRef } from "./handlers.ts";
5
6
  import type { Schema } from "./schema.ts";
6
7
  import { type Services } from "./services.ts";
@@ -58,6 +59,10 @@ export declare abstract class AutonomousAgent {
58
59
  get secrets(): Secrets;
59
60
  /** A unit test's store in place of the runtime's: `component.secrets = new InMemorySecrets()`. */
60
61
  set secrets(store: Secrets);
62
+ /** The service's buckets: `this.storage.default`, or `this.storage.bucket("photos")`. */
63
+ get storage(): Buckets;
64
+ /** A unit test's store in place of the runtime's: `component.storage = new InMemoryBuckets()`. */
65
+ set storage(buckets: Buckets);
61
66
  /** Other services, called as this one, through the runtime: `this.services.service("orders")`. */
62
67
  get services(): Services;
63
68
  /** A unit test's in place of the runtime's: `component.services = new ScriptedServices()`. */
@@ -16,6 +16,7 @@
16
16
  // request's tools run again — so a tool with a side effect should tolerate a repeat.
17
17
  import { requestFromJson } from "./approvals.js";
18
18
  import { secretsFor } from "./client.js";
19
+ import { processStorage } from "./storage.js";
19
20
  import { decodeJsonValue, reviver } from "./json.js";
20
21
  import { toJsonSchema } from "./schema.js";
21
22
  import { servicesFor } from "./services.js";
@@ -68,6 +69,15 @@ export class AutonomousAgent {
68
69
  set secrets(store) {
69
70
  this.#secrets = store;
70
71
  }
72
+ #storage;
73
+ /** The service's buckets: `this.storage.default`, or `this.storage.bucket("photos")`. */
74
+ get storage() {
75
+ return this.#storage ?? processStorage();
76
+ }
77
+ /** A unit test's store in place of the runtime's: `component.storage = new InMemoryBuckets()`. */
78
+ set storage(buckets) {
79
+ this.#storage = buckets;
80
+ }
71
81
  #services;
72
82
  /** Other services, called as this one, through the runtime: `this.services.service("orders")`. */
73
83
  get services() {
@@ -0,0 +1,89 @@
1
+ import { type ComponentClient } from "./client.ts";
2
+ import { Duration, Instant } from "./time.ts";
3
+ /** The first protocol whose runtime keeps client keys; an older one answers `UNIMPLEMENTED`. */
4
+ export declare const CLIENT_KEYS_SINCE = "1.20";
5
+ /** When a client key stops being admitted. There is no default: the issuer says, every time. */
6
+ export type Expiry = {
7
+ readonly kind: "after";
8
+ readonly millis: number;
9
+ } | {
10
+ readonly kind: "at";
11
+ readonly epochMillis: number;
12
+ } | {
13
+ readonly kind: "never";
14
+ };
15
+ export declare const Expiry: Readonly<{
16
+ /** After a while from now: `Expiry.after({ days: 365 })`, or a `Duration`. */
17
+ after(by: Duration | {
18
+ readonly days?: number;
19
+ readonly hours?: number;
20
+ readonly minutes?: number;
21
+ readonly seconds?: number;
22
+ readonly millis?: number;
23
+ }): Expiry;
24
+ /** At an instant. */
25
+ at(when: Instant | Date): Expiry;
26
+ /** Never: admitted until it is revoked. */
27
+ never: Expiry;
28
+ }>;
29
+ /** What to issue: the subject a tool is told, how long, and what for. */
30
+ export interface IssueClientKey {
31
+ readonly subject: string;
32
+ readonly expiry: Expiry;
33
+ /** The MCP endpoint's path; needed only when the service has several. */
34
+ readonly endpoint?: string;
35
+ /** The tools the key may call; every tool when empty. */
36
+ readonly scope?: Iterable<string>;
37
+ /** What a tool reads as the principal's claims: at most 16, each name and value at most 256 characters. */
38
+ readonly attributes?: Readonly<Record<string, string>>;
39
+ readonly label?: string;
40
+ }
41
+ /** An issued key: its id, which lists and revokes it, and the key, shown here once. */
42
+ export interface IssuedClientKey {
43
+ readonly id: string;
44
+ readonly clientKey: string;
45
+ }
46
+ /** One client key as a listing shows it: never the key, nor anything it could be derived from. */
47
+ export interface ClientKeySummary {
48
+ readonly id: string;
49
+ readonly subject: string;
50
+ readonly attributes: Readonly<Record<string, string>>;
51
+ readonly label: string | null;
52
+ readonly endpoint: string;
53
+ readonly scope: readonly string[];
54
+ readonly issuedAt: Instant;
55
+ readonly expiresAt: Instant | null;
56
+ readonly lastUsed: Instant | null;
57
+ readonly revokedAt: Instant | null;
58
+ }
59
+ /**
60
+ * The service's client keys, kept by the runtime. A refusal is a `CommandError` with the runtime's
61
+ * code: `BAD_REQUEST` for a request that breaks a rule, `UNAVAILABLE` when the service's MCP
62
+ * endpoints admit no client key (there is then nothing to keep them), `NOT_FOUND` for an unknown id.
63
+ */
64
+ export declare class ClientKeys {
65
+ #private;
66
+ /** The keys reached through `client`'s sidecar; with none, every call throws. */
67
+ constructor(client?: ComponentClient);
68
+ /** Issues a key; the answer is the one place the key is ever shown. */
69
+ issue(request: IssueClientKey): Promise<IssuedClientKey>;
70
+ /** Every client key of the service, revoked ones included; never a key itself. */
71
+ list(): Promise<ClientKeySummary[]>;
72
+ /** Revokes a key: refused on its next request on every instance. Revoking twice is not an error. */
73
+ revoke(id: string): Promise<void>;
74
+ }
75
+ /** Client keys for unit tests: a map, issuing keys that look like the runtime's and applying its rules. */
76
+ export declare class InMemoryClientKeys extends ClientKeys {
77
+ #private;
78
+ constructor();
79
+ /** The key issued under `id`, which a test may present; the runtime shows it only once. */
80
+ keyOf(id: string): string | undefined;
81
+ issue(request: IssueClientKey): Promise<IssuedClientKey>;
82
+ list(): Promise<ClientKeySummary[]>;
83
+ revoke(id: string): Promise<void>;
84
+ }
85
+ /**
86
+ * @internal The client keys reached through `client`'s sidecar. Not a member of the client, which an
87
+ * entity holds too: only the component kinds that may issue keys call this.
88
+ */
89
+ export declare function clientKeysFor(client: ComponentClient): ClientKeys;