@moltzap/client 2026.1004.0 → 2026.1005.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/NOTICE +1 -6
- package/dist/delivery/history-export.d.ts +2 -3
- package/dist/delivery/history-export.d.ts.map +1 -1
- package/dist/delivery/inbox.d.ts +2 -1
- package/dist/delivery/inbox.d.ts.map +1 -1
- package/dist/delivery/inbox.js +2 -1
- package/dist/delivery/inbox.js.map +1 -1
- package/dist/delivery/operations.d.ts +8 -10
- package/dist/delivery/operations.d.ts.map +1 -1
- package/dist/endpoint/harness-endpoint/events.js +1 -1
- package/dist/endpoint/harness-endpoint/events.js.map +1 -1
- package/dist/endpoint/harness-endpoint/index.js +1 -1
- package/dist/endpoint/harness-endpoint/index.js.map +1 -1
- package/dist/endpoint/mcp/events.d.ts.map +1 -1
- package/dist/endpoint/mcp/events.js +14 -2
- package/dist/endpoint/mcp/events.js.map +1 -1
- package/dist/endpoint/mcp/names.d.ts +18 -0
- package/dist/endpoint/mcp/names.d.ts.map +1 -0
- package/dist/endpoint/mcp/names.js +18 -0
- package/dist/endpoint/mcp/names.js.map +1 -0
- package/dist/endpoint/mcp/owner-tools.d.ts.map +1 -1
- package/dist/endpoint/mcp/owner-tools.js +1 -2
- package/dist/endpoint/mcp/owner-tools.js.map +1 -1
- package/dist/endpoint/mcp/schemas.d.ts +1 -19
- package/dist/endpoint/mcp/schemas.d.ts.map +1 -1
- package/dist/endpoint/mcp/schemas.js +2 -29
- package/dist/endpoint/mcp/schemas.js.map +1 -1
- package/dist/endpoint/mcp/tools.d.ts.map +1 -1
- package/dist/endpoint/mcp/tools.js +2 -1
- package/dist/endpoint/mcp/tools.js.map +1 -1
- package/dist/endpoint/mcp/webhook.js +1 -1
- package/dist/endpoint/mcp/webhook.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/index.types-check.d.ts +4 -3
- package/dist/index.types-check.d.ts.map +1 -1
- package/dist/index.types-check.js +2 -2
- package/dist/service/{activation.d.ts → activation/index.d.ts} +11 -10
- package/dist/service/activation/index.d.ts.map +1 -0
- package/dist/service/{activation.js → activation/index.js} +4 -4
- package/dist/service/activation/index.js.map +1 -0
- package/dist/service/bootstrap.d.ts +50 -0
- package/dist/service/bootstrap.d.ts.map +1 -0
- package/dist/service/bootstrap.js +6 -0
- package/dist/service/bootstrap.js.map +1 -0
- package/dist/service/configuration.d.ts +3 -49
- package/dist/service/configuration.d.ts.map +1 -1
- package/dist/service/configuration.js +4 -6
- package/dist/service/configuration.js.map +1 -1
- package/dist/service/controller.d.ts +2 -2
- package/dist/service/controller.d.ts.map +1 -1
- package/dist/service/controller.js +1 -1
- package/dist/service/controller.js.map +1 -1
- package/dist/service/index.js +1 -1
- package/dist/service/index.js.map +1 -1
- package/dist/service/lifecycle.d.ts +2 -2
- package/dist/service/lifecycle.d.ts.map +1 -1
- package/dist/service/lifecycle.js +1 -1
- package/dist/service/lifecycle.js.map +1 -1
- package/dist/service/management.d.ts +1 -1
- package/dist/service/management.d.ts.map +1 -1
- package/dist/service/management.js +3 -2
- package/dist/service/management.js.map +1 -1
- package/dist/service/{registration.d.ts → registration/index.d.ts} +3 -3
- package/dist/service/registration/index.d.ts.map +1 -0
- package/dist/service/{registration.js → registration/index.js} +2 -2
- package/dist/service/registration/index.js.map +1 -0
- package/dist/service/supervision.d.ts +2 -2
- package/dist/service/supervision.d.ts.map +1 -1
- package/dist/service/supervision.js +3 -3
- package/dist/service/supervision.js.map +1 -1
- package/dist/store/{deliveries.d.ts → queues/deliveries.d.ts} +1 -1
- package/dist/store/queues/deliveries.d.ts.map +1 -0
- package/dist/store/{deliveries.js → queues/deliveries.js} +3 -3
- package/dist/store/queues/deliveries.js.map +1 -0
- package/dist/store/{dissemination.d.ts → queues/dissemination.d.ts} +4 -2
- package/dist/store/queues/dissemination.d.ts.map +1 -0
- package/dist/store/{dissemination.js → queues/dissemination.js} +5 -4
- package/dist/store/queues/dissemination.js.map +1 -0
- package/dist/store/queues/index.d.ts +5 -0
- package/dist/store/queues/index.d.ts.map +1 -0
- package/dist/store/queues/index.js +7 -0
- package/dist/store/queues/index.js.map +1 -0
- package/dist/store/{outbound.d.ts → queues/outbound.d.ts} +1 -1
- package/dist/store/queues/outbound.d.ts.map +1 -0
- package/dist/store/{outbound.js → queues/outbound.js} +1 -1
- package/dist/store/queues/outbound.js.map +1 -0
- package/dist/store/reads.d.ts.map +1 -1
- package/dist/store/reads.js +1 -3
- package/dist/store/reads.js.map +1 -1
- package/dist/store/records.d.ts.map +1 -1
- package/dist/store/records.js +1 -2
- package/dist/store/records.js.map +1 -1
- package/dist/store/store.d.ts.map +1 -1
- package/dist/store/store.js +2 -4
- package/dist/store/store.js.map +1 -1
- package/dist/transport/collectives/failures.d.ts +1 -1
- package/dist/transport/collectives/failures.d.ts.map +1 -1
- package/dist/transport/collectives/forms.d.ts +38 -2
- package/dist/transport/collectives/forms.d.ts.map +1 -1
- package/dist/transport/collectives/forms.js +51 -20
- package/dist/transport/collectives/forms.js.map +1 -1
- package/dist/transport/collectives/inbound.d.ts +2 -3
- package/dist/transport/collectives/inbound.d.ts.map +1 -1
- package/dist/transport/collectives/inbound.js +8 -7
- package/dist/transport/collectives/inbound.js.map +1 -1
- package/dist/transport/collectives/index.d.ts +1 -1
- package/dist/transport/collectives/index.d.ts.map +1 -1
- package/dist/transport/collectives/index.js +1 -1
- package/dist/transport/collectives/index.js.map +1 -1
- package/dist/transport/collectives/message-text.d.ts +5 -2
- package/dist/transport/collectives/message-text.d.ts.map +1 -1
- package/dist/transport/collectives/message-text.js +20 -42
- package/dist/transport/collectives/message-text.js.map +1 -1
- package/dist/transport/collectives/operation.d.ts +20 -15
- package/dist/transport/collectives/operation.d.ts.map +1 -1
- package/dist/transport/collectives/operation.js +53 -60
- package/dist/transport/collectives/operation.js.map +1 -1
- package/dist/transport/collectives/{form-grammar.d.ts → part/grammar.d.ts} +1 -1
- package/dist/transport/collectives/part/grammar.d.ts.map +1 -0
- package/dist/transport/collectives/{form-grammar.js → part/grammar.js} +6 -10
- package/dist/transport/collectives/part/grammar.js.map +1 -0
- package/dist/transport/collectives/{wire.d.ts → part/index.d.ts} +32 -50
- package/dist/transport/collectives/part/index.d.ts.map +1 -0
- package/dist/transport/collectives/{wire.js → part/index.js} +14 -28
- package/dist/transport/collectives/part/index.js.map +1 -0
- package/dist/transport/collectives/received-request.d.ts +1 -1
- package/dist/transport/collectives/received-request.d.ts.map +1 -1
- package/dist/transport/collectives/render.d.ts +40 -0
- package/dist/transport/collectives/render.d.ts.map +1 -0
- package/dist/transport/collectives/render.js +74 -0
- package/dist/transport/collectives/render.js.map +1 -0
- package/dist/transport/collectives/request-sends.d.ts +1 -1
- package/dist/transport/collectives/request-sends.d.ts.map +1 -1
- package/dist/transport/collectives/shared-answers.d.ts +2 -2
- package/dist/transport/collectives/shared-answers.d.ts.map +1 -1
- package/dist/transport/collectives/validation.d.ts +8 -24
- package/dist/transport/collectives/validation.d.ts.map +1 -1
- package/dist/transport/collectives/validation.js +167 -16
- package/dist/transport/collectives/validation.js.map +1 -1
- package/dist/transport/messaging/address.d.ts +2 -32
- package/dist/transport/messaging/address.d.ts.map +1 -1
- package/dist/transport/messaging/address.js +1 -76
- package/dist/transport/messaging/address.js.map +1 -1
- package/dist/transport/messaging/certification.d.ts +1 -1
- package/dist/transport/messaging/certification.d.ts.map +1 -1
- package/dist/transport/messaging/certification.js +10 -7
- package/dist/transport/messaging/certification.js.map +1 -1
- package/dist/transport/messaging/dissemination.d.ts +1 -1
- package/dist/transport/messaging/dissemination.d.ts.map +1 -1
- package/dist/transport/messaging/dissemination.js +4 -3
- package/dist/transport/messaging/dissemination.js.map +1 -1
- package/dist/transport/messaging/evidence.d.ts +1 -1
- package/dist/transport/messaging/evidence.d.ts.map +1 -1
- package/dist/transport/messaging/index.d.ts +3 -3
- package/dist/transport/messaging/index.d.ts.map +1 -1
- package/dist/transport/messaging/index.js +15 -4
- package/dist/transport/messaging/index.js.map +1 -1
- package/dist/transport/messaging/message.d.ts.map +1 -1
- package/dist/transport/messaging/message.js +1 -2
- package/dist/transport/messaging/message.js.map +1 -1
- package/dist/transport/messaging/{recovery/reanchor-empty.d.ts → reanchor/empty.d.ts} +3 -3
- package/dist/transport/messaging/reanchor/empty.d.ts.map +1 -0
- package/dist/transport/messaging/{recovery/reanchor-empty.js → reanchor/empty.js} +2 -2
- package/dist/transport/messaging/reanchor/empty.js.map +1 -0
- package/dist/transport/messaging/{recovery/reanchor.d.ts → reanchor/index.d.ts} +2 -2
- package/dist/transport/messaging/reanchor/index.d.ts.map +1 -0
- package/dist/transport/messaging/{recovery/reanchor.js → reanchor/index.js} +4 -4
- package/dist/transport/messaging/reanchor/index.js.map +1 -0
- package/dist/transport/messaging/{durability.d.ts → records/index.d.ts} +9 -6
- package/dist/transport/messaging/records/index.d.ts.map +1 -0
- package/dist/transport/messaging/{durability.js → records/index.js} +9 -6
- package/dist/transport/messaging/records/index.js.map +1 -0
- package/dist/transport/messaging/recovery/barrier.d.ts +1 -1
- package/dist/transport/messaging/recovery/barrier.d.ts.map +1 -1
- package/dist/transport/messaging/recovery/evidence.d.ts +1 -1
- package/dist/transport/messaging/recovery/evidence.d.ts.map +1 -1
- package/dist/transport/messaging/recovery/index.d.ts +1 -1
- package/dist/transport/messaging/recovery/index.d.ts.map +1 -1
- package/dist/transport/messaging/recovery/index.js +16 -11
- package/dist/transport/messaging/recovery/index.js.map +1 -1
- package/dist/transport/messaging/recovery/persistence.d.ts +1 -1
- package/dist/transport/messaging/recovery/persistence.d.ts.map +1 -1
- package/dist/transport/messaging/{recovery/state.d.ts → recovery-session/index.d.ts} +2 -2
- package/dist/transport/messaging/recovery-session/index.d.ts.map +1 -0
- package/dist/transport/messaging/{recovery/state.js → recovery-session/index.js} +1 -1
- package/dist/transport/messaging/recovery-session/index.js.map +1 -0
- package/dist/transport/messaging/{types.d.ts → runtime/index.d.ts} +22 -7
- package/dist/transport/messaging/runtime/index.d.ts.map +1 -0
- package/dist/transport/messaging/{types.js → runtime/index.js} +1 -1
- package/dist/transport/messaging/runtime/index.js.map +1 -0
- package/dist/transport/messaging/send.d.ts +2 -2
- package/dist/transport/messaging/send.d.ts.map +1 -1
- package/dist/transport/messaging/send.js.map +1 -1
- package/dist/transport/router/types.d.ts +2 -3
- package/dist/transport/router/types.d.ts.map +1 -1
- package/dist/transport/router/types.js.map +1 -1
- package/dist/transport/wire/{canonical.d.ts → encoding/canonical.d.ts} +0 -1
- package/dist/transport/wire/encoding/canonical.d.ts.map +1 -0
- package/dist/transport/wire/{canonical.js → encoding/canonical.js} +1 -1
- package/dist/transport/wire/encoding/canonical.js.map +1 -0
- package/dist/transport/wire/{codec.d.ts → encoding/codec.d.ts} +2 -5
- package/dist/transport/wire/encoding/codec.d.ts.map +1 -0
- package/dist/transport/wire/{codec.js → encoding/codec.js} +4 -5
- package/dist/transport/wire/encoding/codec.js.map +1 -0
- package/dist/transport/wire/encoding/index.d.ts +4 -0
- package/dist/transport/wire/encoding/index.d.ts.map +1 -0
- package/dist/transport/wire/encoding/index.js +6 -0
- package/dist/transport/wire/encoding/index.js.map +1 -0
- package/dist/transport/wire/index.d.ts +2 -3
- package/dist/transport/wire/index.d.ts.map +1 -1
- package/dist/transport/wire/index.js +2 -3
- package/dist/transport/wire/index.js.map +1 -1
- package/dist/transport/wire/values.d.ts +37 -2
- package/dist/transport/wire/values.d.ts.map +1 -1
- package/dist/transport/wire/values.js +78 -1
- package/dist/transport/wire/values.js.map +1 -1
- package/dist/transport/wire/verification.d.ts +1 -2
- package/dist/transport/wire/verification.d.ts.map +1 -1
- package/dist/transport/wire/verification.js +1 -2
- package/dist/transport/wire/verification.js.map +1 -1
- package/package.json +3 -3
- package/dist/service/activation.d.ts.map +0 -1
- package/dist/service/activation.js.map +0 -1
- package/dist/service/registration.d.ts.map +0 -1
- package/dist/service/registration.js.map +0 -1
- package/dist/store/deliveries.d.ts.map +0 -1
- package/dist/store/deliveries.js.map +0 -1
- package/dist/store/dissemination.d.ts.map +0 -1
- package/dist/store/dissemination.js.map +0 -1
- package/dist/store/outbound.d.ts.map +0 -1
- package/dist/store/outbound.js.map +0 -1
- package/dist/transport/collectives/answer-check.d.ts +0 -22
- package/dist/transport/collectives/answer-check.d.ts.map +0 -1
- package/dist/transport/collectives/answer-check.js +0 -166
- package/dist/transport/collectives/answer-check.js.map +0 -1
- package/dist/transport/collectives/form-grammar.d.ts.map +0 -1
- package/dist/transport/collectives/form-grammar.js.map +0 -1
- package/dist/transport/collectives/wire.d.ts.map +0 -1
- package/dist/transport/collectives/wire.js.map +0 -1
- package/dist/transport/messaging/durability.d.ts.map +0 -1
- package/dist/transport/messaging/durability.js.map +0 -1
- package/dist/transport/messaging/recovery/reanchor-empty.d.ts.map +0 -1
- package/dist/transport/messaging/recovery/reanchor-empty.js.map +0 -1
- package/dist/transport/messaging/recovery/reanchor.d.ts.map +0 -1
- package/dist/transport/messaging/recovery/reanchor.js.map +0 -1
- package/dist/transport/messaging/recovery/state.d.ts.map +0 -1
- package/dist/transport/messaging/recovery/state.js.map +0 -1
- package/dist/transport/messaging/types.d.ts.map +0 -1
- package/dist/transport/messaging/types.js.map +0 -1
- package/dist/transport/wire/canonical.d.ts.map +0 -1
- package/dist/transport/wire/canonical.js.map +0 -1
- package/dist/transport/wire/codec.d.ts.map +0 -1
- package/dist/transport/wire/codec.js.map +0 -1
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/** @file The items an endpoint delivers to its host: messages and collective requests, results and failures. */
|
|
2
2
|
import { Schema } from "effect";
|
|
3
|
-
import { AgentAddress, MessageAddressInput } from "../messaging/address.js";
|
|
4
3
|
import { InboundMessage } from "../messaging/message.js";
|
|
5
|
-
import { exactStruct, PostId, wellFormedString } from "../wire/values.js";
|
|
4
|
+
import { AgentAddress, exactStruct, MessageAddressInput, PostId, wellFormedString, } from "../wire/values.js";
|
|
6
5
|
import { AnswerContent, CollectiveId, RequestedSchema } from "./forms.js";
|
|
7
6
|
/* eslint-disable @typescript-eslint/naming-convention, @typescript-eslint/no-redeclare -- Effect Schemas share their domain names with the nominal values they decode. */
|
|
8
7
|
/**
|
|
@@ -15,6 +14,8 @@ const multicastItem = exactStruct({
|
|
|
15
14
|
});
|
|
16
15
|
/** Absolute epoch milliseconds; endpoints assume zero clock skew. */
|
|
17
16
|
const epochMillis = Schema.Number.pipe(Schema.int(), Schema.positive());
|
|
17
|
+
/** Which collecting operation an item belongs to. */
|
|
18
|
+
const collectingOp = Schema.Literal("gather", "all_gather");
|
|
18
19
|
/**
|
|
19
20
|
* A question another agent asked this one. `postId` is the certified request
|
|
20
21
|
* post's and `to` the conversation it arrived in: the requester's `agent:`
|
|
@@ -23,6 +24,7 @@ const epochMillis = Schema.Number.pipe(Schema.int(), Schema.positive());
|
|
|
23
24
|
*/
|
|
24
25
|
const collectiveRequestItem = exactStruct({
|
|
25
26
|
kind: Schema.Literal("collectiveRequest"),
|
|
27
|
+
op: collectingOp,
|
|
26
28
|
id: CollectiveId,
|
|
27
29
|
postId: PostId,
|
|
28
30
|
from: AgentAddress,
|
|
@@ -41,18 +43,17 @@ const memberOutcome = Schema.Union(exactStruct({ kind: Schema.Literal("answered"
|
|
|
41
43
|
/**
|
|
42
44
|
* The result of a gather this endpoint started, or of an all_gather this
|
|
43
45
|
* endpoint started or was asked: exactly one outcome per member, in member
|
|
44
|
-
* order. `to` is the address the operation named.
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
* is the same.
|
|
46
|
+
* order. `to` is the address the operation named. Every member's all_gather
|
|
47
|
+
* result is built from exactly the answers the requester's close lists, so
|
|
48
|
+
* each endpoint's result is the same.
|
|
48
49
|
*/
|
|
49
50
|
const collectiveResultItem = exactStruct({
|
|
50
51
|
kind: Schema.Literal("collectiveResult"),
|
|
52
|
+
op: collectingOp,
|
|
51
53
|
id: CollectiveId,
|
|
52
54
|
to: MessageAddressInput,
|
|
53
55
|
question: wellFormedString,
|
|
54
56
|
outcomes: Schema.NonEmptyArray(exactStruct({ member: AgentAddress, outcome: memberOutcome })),
|
|
55
|
-
closePostId: Schema.optionalWith(PostId, { exact: true }),
|
|
56
57
|
});
|
|
57
58
|
/**
|
|
58
59
|
* A collective send that failed after the host's tool had returned, or an
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inbound.js","sourceRoot":"","sources":["../../../src/transport/collectives/inbound.ts"],"names":[],"mappings":"AAAA,gHAAgH;AAEhH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"inbound.js","sourceRoot":"","sources":["../../../src/transport/collectives/inbound.ts"],"names":[],"mappings":"AAAA,gHAAgH;AAEhH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EACL,YAAY,EACZ,WAAW,EACX,mBAAmB,EACnB,MAAM,EACN,gBAAgB,GACjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE1E,0KAA0K;AAE1K;;;GAGG;AACH,MAAM,aAAa,GAAG,WAAW,CAAC;IAChC,IAAI,EAAE,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC;IACjC,OAAO,EAAE,cAAc;CACxB,CAAC,CAAC;AAEH,qEAAqE;AACrE,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,EAAE,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC;AAExE,qDAAqD;AACrD,MAAM,YAAY,GAAG,MAAM,CAAC,OAAO,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;AAE5D;;;;;GAKG;AACH,MAAM,qBAAqB,GAAG,WAAW,CAAC;IACxC,IAAI,EAAE,MAAM,C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IACvB,KAAK,EAAE,MAAM,CAAC,MAAM;CACrB,CAAC,CAAC;AAEH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,CAAC,KAAK,CACrC,aAAa,EACb,qBAAqB,EACrB,oBAAoB,EACpB,mBAAmB,CACpB,CAAC,WAAW,CAAC;IACZ,UAAU,EAAE,aAAa;CAC1B,CAAC,CAAC;AAIH,0JAA0J"}
|
|
@@ -6,5 +6,5 @@ export { CollectiveEmitError } from "./forms.js";
|
|
|
6
6
|
/** The items those operations emit. */
|
|
7
7
|
export type { InboundItem } from "./inbound.js";
|
|
8
8
|
/** The collective part carried in a post's content. */
|
|
9
|
-
export { collectiveIdOf, readCollectiveValue } from "./
|
|
9
|
+
export { collectiveIdOf, readCollectiveValue } from "./part/index.js";
|
|
10
10
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/transport/collectives/index.ts"],"names":[],"mappings":"AAAA,mEAAmE;AAEnE,8DAA8D;AAC9D,OAAO,EACL,KAAK,oBAAoB,EACzB,wBAAwB,GACzB,MAAM,gBAAgB,CAAC;AACxB,6EAA6E;AAC7E,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACjD,uCAAuC;AACvC,YAAY,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,uDAAuD;AACvD,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/transport/collectives/index.ts"],"names":[],"mappings":"AAAA,mEAAmE;AAEnE,8DAA8D;AAC9D,OAAO,EACL,KAAK,oBAAoB,EACzB,wBAAwB,GACzB,MAAM,gBAAgB,CAAC;AACxB,6EAA6E;AAC7E,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACjD,uCAAuC;AACvC,YAAY,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,uDAAuD;AACvD,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -4,5 +4,5 @@ export { makeCollectiveOperations, } from "./operation.js";
|
|
|
4
4
|
/** The failure an emit port returns when the service cannot keep an item. */
|
|
5
5
|
export { CollectiveEmitError } from "./forms.js";
|
|
6
6
|
/** The collective part carried in a post's content. */
|
|
7
|
-
export { collectiveIdOf, readCollectiveValue } from "./
|
|
7
|
+
export { collectiveIdOf, readCollectiveValue } from "./part/index.js";
|
|
8
8
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/transport/collectives/index.ts"],"names":[],"mappings":"AAAA,mEAAmE;AAEnE,8DAA8D;AAC9D,OAAO,EAEL,wBAAwB,GACzB,MAAM,gBAAgB,CAAC;AACxB,6EAA6E;AAC7E,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAGjD,uDAAuD;AACvD,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/transport/collectives/index.ts"],"names":[],"mappings":"AAAA,mEAAmE;AAEnE,8DAA8D;AAC9D,OAAO,EAEL,wBAAwB,GACzB,MAAM,gBAAgB,CAAC;AACxB,6EAA6E;AAC7E,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAGjD,uDAAuD;AACvD,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -20,10 +20,13 @@
|
|
|
20
20
|
* the operation and the error names the field to fix.
|
|
21
21
|
*/
|
|
22
22
|
import { Either } from "effect";
|
|
23
|
-
import type
|
|
23
|
+
import { type MessageAddressInput } from "../wire/values.js";
|
|
24
24
|
import { SendInput } from "./forms.js";
|
|
25
|
+
/** The operations that ask a question, in the order their keys are read. */
|
|
26
|
+
declare const COLLECTING_OPERATIONS: readonly ["gather", "all_gather"];
|
|
27
|
+
type CollectingOperation = (typeof COLLECTING_OPERATIONS)[number];
|
|
25
28
|
/** Which operation a refused text stated. */
|
|
26
|
-
type StatedOperation = "message" |
|
|
29
|
+
type StatedOperation = "message" | CollectingOperation | "answer";
|
|
27
30
|
declare const MessageTextError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
28
31
|
readonly _tag: "MessageTextError";
|
|
29
32
|
} & Readonly<A>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message-text.d.ts","sourceRoot":"","sources":["../../../src/transport/collectives/message-text.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAQ,MAAM,
|
|
1
|
+
{"version":3,"file":"message-text.d.ts","sourceRoot":"","sources":["../../../src/transport/collectives/message-text.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAQ,MAAM,EAA6B,MAAM,QAAQ,CAAC;AACjE,OAAO,EAAe,KAAK,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,EAOL,SAAS,EACV,MAAM,YAAY,CAAC;AAIpB,4EAA4E;AAC5E,QAAA,MAAM,qBAAqB,YAAI,QAAQ,EAAE,YAAY,CAAU,CAAC;AAEhE,KAAK,mBAAmB,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,CAAC,CAAC;AAElE,6CAA6C;AAC7C,KAAK,eAAe,GAAG,SAAS,GAAG,mBAAmB,GAAG,QAAQ,CAAC;;;;AAElE;;;;GAIG;AACH,qBAAa,gBAAiB,SAAQ,sBAAqC;IACzE,QAAQ,CAAC,SAAS,EAAE,eAAe,CAAC;IACpC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB,CAAC;IACA,IAAa,OAAO,IAAI,MAAM,CAG7B;CACF;AA0BD;;;;;;;;GAQG;AACH,eAAO,MAAM,gBAAgB,OACvB,mBAAmB,QACjB,MAAM,KACX,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,gBAAgB,CAKxC,CAAC"}
|
|
@@ -19,9 +19,12 @@
|
|
|
19
19
|
* fails validation is refused, never sent as text, because the model meant
|
|
20
20
|
* the operation and the error names the field to fix.
|
|
21
21
|
*/
|
|
22
|
-
import { Data, Either, Option,
|
|
22
|
+
import { Data, Either, Option, Predicate, Schema } from "effect";
|
|
23
23
|
import { exactStruct } from "../wire/values.js";
|
|
24
|
-
import {
|
|
24
|
+
import { AcceptResponse, DeadlineSeconds, DeclineResponse, describeIssues, RequestedSchema, SendInput, } from "./forms.js";
|
|
25
|
+
/* eslint-disable @typescript-eslint/naming-convention -- Effect Schemas are named for the text shapes they decode. */
|
|
26
|
+
/** The operations that ask a question, in the order their keys are read. */
|
|
27
|
+
const COLLECTING_OPERATIONS = ["gather", "all_gather"];
|
|
25
28
|
/**
|
|
26
29
|
* A message text states an operation it does not validly carry, or is plain
|
|
27
30
|
* text that is not well-formed Unicode. The message names each failing field
|
|
@@ -29,26 +32,19 @@ import { AnswerContent, DeadlineSeconds, RequestedSchema, SendInput, } from "./f
|
|
|
29
32
|
*/
|
|
30
33
|
export class MessageTextError extends Data.TaggedError("MessageTextError") {
|
|
31
34
|
get message() {
|
|
32
|
-
|
|
35
|
+
const action = this.operation === "answer" ? "reply" : "send";
|
|
36
|
+
return `${action} failed: invalid ${this.operation}: ${this.detail}`;
|
|
33
37
|
}
|
|
34
38
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
all_gather: Schema.String,
|
|
39
|
+
/**
|
|
40
|
+
* A gather or all_gather, its question under the operation's own key, read
|
|
41
|
+
* as `question` so both share one decode.
|
|
42
|
+
*/
|
|
43
|
+
const collectingText = (op) => exactStruct({
|
|
44
|
+
question: Schema.propertySignature(Schema.String).pipe(Schema.fromKey(op)),
|
|
42
45
|
deadline: DeadlineSeconds,
|
|
43
46
|
requestedSchema: RequestedSchema,
|
|
44
47
|
});
|
|
45
|
-
const AcceptText = exactStruct({
|
|
46
|
-
action: Schema.Literal("accept"),
|
|
47
|
-
content: AnswerContent,
|
|
48
|
-
});
|
|
49
|
-
const DeclineText = exactStruct({
|
|
50
|
-
action: Schema.Literal("decline"),
|
|
51
|
-
});
|
|
52
48
|
/** The `action` key alone, so an unknown action is named as that field. */
|
|
53
49
|
const AnswerAction = Schema.Struct({
|
|
54
50
|
action: Schema.Literal("accept", "decline"),
|
|
@@ -74,30 +70,21 @@ export const parseMessageText = (to, text) => Option.match(jsonObject(text), {
|
|
|
74
70
|
* none of `gather`, `all_gather` and `action` and so is plain text.
|
|
75
71
|
*/
|
|
76
72
|
function statedOperation(to, value) {
|
|
77
|
-
|
|
78
|
-
|
|
73
|
+
const op = COLLECTING_OPERATIONS.find((key) => Object.hasOwn(value, key));
|
|
74
|
+
if (op !== undefined) {
|
|
75
|
+
return decodeText(op, collectingText(op), value).pipe(Either.flatMap(({ question, ...collective }) => sendInput(op, {
|
|
79
76
|
to,
|
|
80
|
-
text:
|
|
81
|
-
collective: { ...
|
|
82
|
-
})));
|
|
83
|
-
}
|
|
84
|
-
if (Object.hasOwn(value, "all_gather")) {
|
|
85
|
-
return decodeText("all_gather", AllGatherText, value).pipe(Either.flatMap((stated) => sendInput("all_gather", {
|
|
86
|
-
to,
|
|
87
|
-
text: stated.all_gather,
|
|
88
|
-
collective: { ...collecting(stated), op: "all_gather" },
|
|
77
|
+
text: question,
|
|
78
|
+
collective: { ...collective, op },
|
|
89
79
|
})));
|
|
90
80
|
}
|
|
91
81
|
return Object.hasOwn(value, "action") ? answer(to, value) : undefined;
|
|
92
82
|
}
|
|
93
|
-
function collecting(stated) {
|
|
94
|
-
return { deadline: stated.deadline, requestedSchema: stated.requestedSchema };
|
|
95
|
-
}
|
|
96
83
|
/** An answer: `action` decides which shape the rest must have. */
|
|
97
84
|
function answer(to, value) {
|
|
98
85
|
return decodeText("answer", AnswerAction, value).pipe(Either.flatMap(({ action }) => action === "accept"
|
|
99
|
-
? decodeText("answer",
|
|
100
|
-
: decodeText("answer",
|
|
86
|
+
? decodeText("answer", AcceptResponse, value)
|
|
87
|
+
: decodeText("answer", DeclineResponse, value)), Either.flatMap((collectiveResponse) => sendInput("answer", { to, collectiveResponse })));
|
|
101
88
|
}
|
|
102
89
|
function sendInput(operation, value) {
|
|
103
90
|
return decodeText(operation, SendInput, value);
|
|
@@ -105,14 +92,5 @@ function sendInput(operation, value) {
|
|
|
105
92
|
function decodeText(operation, schema, value) {
|
|
106
93
|
return Schema.decodeUnknownEither(schema, { errors: "all" })(value).pipe(Either.mapLeft((error) => new MessageTextError({ operation, detail: describeIssues(error) })));
|
|
107
94
|
}
|
|
108
|
-
/**
|
|
109
|
-
* One line per issue, each led by its field path, such as
|
|
110
|
-
* `requestedSchema.type: Expected "object", actual "obj"`.
|
|
111
|
-
*/
|
|
112
|
-
function describeIssues(error) {
|
|
113
|
-
return ParseResult.ArrayFormatter.formatErrorSync(error)
|
|
114
|
-
.map(({ path, message }) => path.length === 0 ? message : `${path.map(String).join(".")}: ${message}`)
|
|
115
|
-
.join("; ");
|
|
116
|
-
}
|
|
117
95
|
/* eslint-enable @typescript-eslint/naming-convention -- Restore the package naming rules after the text Schemas. */
|
|
118
96
|
//# sourceMappingURL=message-text.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message-text.js","sourceRoot":"","sources":["../../../src/transport/collectives/message-text.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"message-text.js","sourceRoot":"","sources":["../../../src/transport/collectives/message-text.ts"],"names":[],"mappings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E,QAAQ,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AACxE,CAAC;AAED,kEAAkE;AAClE,SAAS,MAAM,CACb,EAAuB,EACvB,KAAwC;IAExC,OAAO,UAAU,CAAC,QAAQ,EAAE,YAAY,EAAE,KAAK,CAAC,CAAC,IAAI,CACnD,MAAM,CAAC,OAAO,CACZ,CAAC,EAAE,MAAM,EAAE,EAAuD,EAAE,CAClE,MAAM,KAAK,QAAQ;QACjB,CAAC,CAAC,UAAU,CAAC,QAAQ,EAAE,cAAc,EAAE,KAAK,CAAC;QAC7C,CAAC,CAAC,UAAU,CAAC,QAAQ,EAAE,eAAe,EAAE,KAAK,CAAC,CACnD,EACD,MAAM,CAAC,OAAO,CAAC,CAAC,kBAAkB,EAAE,EAAE,CACpC,SAAS,CAAC,QAAQ,EAAE,EAAE,EAAE,EAAE,kBAAkB,EAAE,CAAC,CAChD,CACF,CAAC;AACJ,CAAC;AAED,SAAS,SAAS,CAChB,SAA0B,EAC1B,KAAc;IAEd,OAAO,UAAU,CAAC,SAAS,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;AACjD,CAAC;AAED,SAAS,UAAU,CACjB,SAA0B,EAC1B,MAA2B,EAC3B,KAAc;IAEd,OAAO,MAAM,CAAC,mBAAmB,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,CACtE,MAAM,CAAC,OAAO,CACZ,CAAC,KAAK,EAAE,EAAE,CACR,IAAI,gBAAgB,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,cAAc,CAAC,KAAK,CAAC,EAAE,CAAC,CACrE,CACF,CAAC;AACJ,CAAC;AAED,oHAAoH"}
|
|
@@ -19,13 +19,14 @@
|
|
|
19
19
|
* participant ME as Member endpoint
|
|
20
20
|
* participant MM as Member host
|
|
21
21
|
* RM->>RE: send gather to, question, deadline, schema
|
|
22
|
-
* RE->>RE: validate schema,
|
|
23
|
-
* RE->>
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
22
|
+
* RE->>RE: validate schema, resolve every member<br>refuse an address error before any post
|
|
23
|
+
* RE->>RE: mint id<br>deadline = now + duration
|
|
24
|
+
* RE->>ME: one request post in each member's direct conversation
|
|
25
|
+
* alt every request post is refused
|
|
26
|
+
* RE-->>RM: error naming each member and its reason
|
|
27
|
+
* else otherwise, after at most 20 s
|
|
27
28
|
* RE-->>RM: operation id
|
|
28
|
-
* RE->>RE:
|
|
29
|
+
* RE->>RE: a refused member is no-answer<br>a pending one settles later, no-answer at the deadline
|
|
29
30
|
* end
|
|
30
31
|
* ME->>MM: collectiveRequest item
|
|
31
32
|
* MM->>ME: send collectiveResponse to the requester, action, content
|
|
@@ -48,9 +49,10 @@
|
|
|
48
49
|
* participant ME as Member endpoints
|
|
49
50
|
* participant MM as Member hosts
|
|
50
51
|
* RM->>RE: send all_gather to group, question, deadline, schema
|
|
51
|
-
* RE->>
|
|
52
|
+
* RE->>RE: validate schema, resolve every member<br>refuse an address error before any post
|
|
53
|
+
* RE->>ME: one request post in the group conversation
|
|
52
54
|
* alt the group post is refused or not certified in time
|
|
53
|
-
* RE-->>RM: error naming
|
|
55
|
+
* RE-->>RM: error naming every member with the post's reason
|
|
54
56
|
* else request post certified
|
|
55
57
|
* RE-->>RM: operation id
|
|
56
58
|
* end
|
|
@@ -61,18 +63,21 @@
|
|
|
61
63
|
* ME->>ME: peer response posts, consumed and recorded by record hash
|
|
62
64
|
* Note over RE: complete when every member has an outcome<br>or at the deadline
|
|
63
65
|
* RE->>ME: close post listing the counted answers' record hashes
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
66
|
+
* alt the close is not certified
|
|
67
|
+
* RE->>RM: operationFailed item, and members get no result
|
|
68
|
+
* else close certified
|
|
69
|
+
* RE->>RM: collectiveResult item
|
|
70
|
+
* ME->>ME: build the result from exactly the listed answers
|
|
71
|
+
* ME->>MM: collectiveResult item, the same outcomes
|
|
72
|
+
* end
|
|
67
73
|
* ```
|
|
68
74
|
*/
|
|
69
75
|
import { Duration, Effect, Option, type Scope } from "effect";
|
|
70
76
|
import type { EngineSendInput, EngineSentPost } from "../messaging/index.js";
|
|
71
77
|
import type { InboundMessage } from "../messaging/message.js";
|
|
72
|
-
import type { RecordHash } from "../wire/index.js";
|
|
73
78
|
import type { InboundItem } from "./inbound.js";
|
|
74
|
-
import { AgentAddress } from "../messaging/address.js";
|
|
75
79
|
import { SendError } from "../messaging/errors.js";
|
|
80
|
+
import { AgentAddress, type RecordHash } from "../wire/index.js";
|
|
76
81
|
import { type CollectiveSendOutcome } from "./failures.js";
|
|
77
82
|
import { type CollectiveEmitError, CollectiveError, type FailureDelivery, type SendInput } from "./forms.js";
|
|
78
83
|
/** What the collective layer needs from the daemon around it. */
|
|
@@ -80,8 +85,8 @@ export interface CollectivePorts {
|
|
|
80
85
|
/** The local agent: a group gather or all_gather asks every member but this one. */
|
|
81
86
|
readonly self: AgentAddress;
|
|
82
87
|
/**
|
|
83
|
-
* Resolve one member's Registry card without sending
|
|
84
|
-
*
|
|
88
|
+
* Resolve one member's Registry card without sending, so a collecting
|
|
89
|
+
* operation refuses an address error before any post.
|
|
85
90
|
*/
|
|
86
91
|
readonly lookupMember: (member: AgentAddress) => Effect.Effect<void, SendError>;
|
|
87
92
|
/** Certify one post and complete once it is stored locally. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operation.d.ts","sourceRoot":"","sources":["../../../src/transport/collectives/operation.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"operation.d.ts","sourceRoot":"","sources":["../../../src/transport/collectives/operation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyEG;AAEH,OAAO,EAEL,QAAQ,EACR,MAA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AAE,cAAc,CAAC;IACjC,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;CACjC;AAED,6DAA6D;AAC7D,MAAM,WAAW,oBAAoB;IACnC;;;;;;;OAOG;IACH,QAAQ,CAAC,IAAI,EAAE,CACb,KAAK,EAAE,SAAS,EAChB,eAAe,EAAE,eAAe,KAC7B,MAAM,CAAC,MAAM,CAAC,qBAAqB,EAAE,SAAS,GAAG,eAAe,CAAC,CAAC;IACvE;;;;;;;OAOG;IACH,QAAQ,CAAC,QAAQ,EAAE,CACjB,IAAI,EAAE,aAAa,KAChB,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,mBAAmB,CAAC,CAAC;CACrE;AA2DD;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,UAC5B,eAAe,KACrB,oBAiBF,CAAC"}
|
|
@@ -19,13 +19,14 @@
|
|
|
19
19
|
* participant ME as Member endpoint
|
|
20
20
|
* participant MM as Member host
|
|
21
21
|
* RM->>RE: send gather to, question, deadline, schema
|
|
22
|
-
* RE->>RE: validate schema,
|
|
23
|
-
* RE->>
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
22
|
+
* RE->>RE: validate schema, resolve every member<br>refuse an address error before any post
|
|
23
|
+
* RE->>RE: mint id<br>deadline = now + duration
|
|
24
|
+
* RE->>ME: one request post in each member's direct conversation
|
|
25
|
+
* alt every request post is refused
|
|
26
|
+
* RE-->>RM: error naming each member and its reason
|
|
27
|
+
* else otherwise, after at most 20 s
|
|
27
28
|
* RE-->>RM: operation id
|
|
28
|
-
* RE->>RE:
|
|
29
|
+
* RE->>RE: a refused member is no-answer<br>a pending one settles later, no-answer at the deadline
|
|
29
30
|
* end
|
|
30
31
|
* ME->>MM: collectiveRequest item
|
|
31
32
|
* MM->>ME: send collectiveResponse to the requester, action, content
|
|
@@ -48,9 +49,10 @@
|
|
|
48
49
|
* participant ME as Member endpoints
|
|
49
50
|
* participant MM as Member hosts
|
|
50
51
|
* RM->>RE: send all_gather to group, question, deadline, schema
|
|
51
|
-
* RE->>
|
|
52
|
+
* RE->>RE: validate schema, resolve every member<br>refuse an address error before any post
|
|
53
|
+
* RE->>ME: one request post in the group conversation
|
|
52
54
|
* alt the group post is refused or not certified in time
|
|
53
|
-
* RE-->>RM: error naming
|
|
55
|
+
* RE-->>RM: error naming every member with the post's reason
|
|
54
56
|
* else request post certified
|
|
55
57
|
* RE-->>RM: operation id
|
|
56
58
|
* end
|
|
@@ -61,21 +63,26 @@
|
|
|
61
63
|
* ME->>ME: peer response posts, consumed and recorded by record hash
|
|
62
64
|
* Note over RE: complete when every member has an outcome<br>or at the deadline
|
|
63
65
|
* RE->>ME: close post listing the counted answers' record hashes
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
66
|
+
* alt the close is not certified
|
|
67
|
+
* RE->>RM: operationFailed item, and members get no result
|
|
68
|
+
* else close certified
|
|
69
|
+
* RE->>RM: collectiveResult item
|
|
70
|
+
* ME->>ME: build the result from exactly the listed answers
|
|
71
|
+
* ME->>MM: collectiveResult item, the same outcomes
|
|
72
|
+
* end
|
|
67
73
|
* ```
|
|
68
74
|
*/
|
|
69
|
-
import { Clock, Duration, Effect, Array as EffectArray, Fiber, Option,
|
|
70
|
-
import {
|
|
75
|
+
import { Clock, Duration, Effect, Array as EffectArray, Fiber, Option, Schema, } from "effect";
|
|
76
|
+
import { canonicalMessageAddress } from "../messaging/address.js";
|
|
71
77
|
import { SendError } from "../messaging/errors.js";
|
|
78
|
+
import { AgentAddress, } from "../wire/index.js";
|
|
72
79
|
import { emitFailureAsSendError, refusedAs, reportFailure, } from "./failures.js";
|
|
73
|
-
import { CollectiveError,
|
|
80
|
+
import { closeFailureText, CollectiveError, describeIssues, MAXIMUM_DEADLINE_SECONDS, } from "./forms.js";
|
|
81
|
+
import { collectiveIdOf, encodeCollectiveContent, FormModeSchema, mintCollectiveId, readCollectiveValue, withoutCollectivePart, } from "./part/index.js";
|
|
74
82
|
import { matchOpenRequest, } from "./received-request.js";
|
|
75
83
|
import { isAddressRefusal, lookupRefusals, requestsSoFar, } from "./request-sends.js";
|
|
76
84
|
import { keepFirstAnswer, listedAnswers, memberOutcomes, } from "./shared-answers.js";
|
|
77
85
|
import { outcomeOfResponse, validateAnswer } from "./validation.js";
|
|
78
|
-
import { collectiveIdOf, encodeCollectiveContent, FormModeSchema, mintCollectiveId, readCollectiveValue, withoutCollectivePart, } from "./wire.js";
|
|
79
86
|
/**
|
|
80
87
|
* How long a collecting operation's send waits for its request posts before
|
|
81
88
|
* returning. A gather's request still uncertified then is left running: its
|
|
@@ -108,7 +115,6 @@ const RECEIVED_DEADLINE_ALLOWANCE = Duration.hours(1);
|
|
|
108
115
|
/** The furthest past `now` a received request's deadline may lie. */
|
|
109
116
|
const RECEIVED_DEADLINE_HORIZON = Duration.toMillis(Duration.sum(Duration.seconds(MAXIMUM_DEADLINE_SECONDS), RECEIVED_DEADLINE_ALLOWANCE));
|
|
110
117
|
const decodeAgentAddress = Schema.decodeUnknownOption(AgentAddress);
|
|
111
|
-
const decodeRequestedSchema = Schema.decodeUnknownOption(RequestedSchema);
|
|
112
118
|
const contentInvalid = () => new SendError({ reason: "content-invalid" });
|
|
113
119
|
const collectiveFailure = (id, failure) => new CollectiveError({ id, failure });
|
|
114
120
|
/**
|
|
@@ -186,11 +192,7 @@ function gatherAddress(to, self, op) {
|
|
|
186
192
|
function formModeSchema(id, requestedSchema) {
|
|
187
193
|
return Schema.decodeUnknown(FormModeSchema)(requestedSchema).pipe(Effect.mapError((error) => collectiveFailure(id, {
|
|
188
194
|
kind: "schema-invalid",
|
|
189
|
-
detail:
|
|
190
|
-
.map(({ path, message }) => path.length === 0
|
|
191
|
-
? message
|
|
192
|
-
: `${path.map(String).join(".")}: ${message}`)
|
|
193
|
-
.join("; "),
|
|
195
|
+
detail: describeIssues(error),
|
|
194
196
|
})));
|
|
195
197
|
}
|
|
196
198
|
/**
|
|
@@ -332,8 +334,11 @@ function updateGather(state, id, change) {
|
|
|
332
334
|
* Send an all_gather's one request post to the group and wait for it, never
|
|
333
335
|
* past the deadline. A refused post, or one still uncertified when the wait
|
|
334
336
|
* ends, abandons the all_gather: the group's GENESIS needs every member. The
|
|
335
|
-
*
|
|
336
|
-
*
|
|
337
|
+
* deadline timer is forked just before the wait starts, so it can complete
|
|
338
|
+
* the all_gather first; its result then stands and the send succeeds, so an
|
|
339
|
+
* operation ends in exactly one refusal or one result. A group post succeeds
|
|
340
|
+
* or fails as a whole, so the refusal names every member with its reason;
|
|
341
|
+
* members whose address resolution fails were refused before the post.
|
|
337
342
|
*/
|
|
338
343
|
function sendGroupRequest(state, prepared) {
|
|
339
344
|
return state.ports
|
|
@@ -341,24 +346,12 @@ function sendGroupRequest(state, prepared) {
|
|
|
341
346
|
.pipe(Effect.timeoutFail({
|
|
342
347
|
duration: requestWait(state, prepared),
|
|
343
348
|
onTimeout: () => new SendError({ reason: "certification-unavailable" }),
|
|
344
|
-
}), Effect.map((post) => [post.postId]), Effect.catchAll((error) =>
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
* The members to name for a refused group post. A group post succeeds or
|
|
351
|
-
* fails as a whole, so each member is looked up on its own: the members whose
|
|
352
|
-
* lookup fails are named with their own reason, and when every lookup
|
|
353
|
-
* succeeds each member is named with the group post's reason.
|
|
354
|
-
*/
|
|
355
|
-
function unreachableMembers(state, members, groupReason) {
|
|
356
|
-
return lookupRefusals(members, state.ports.lookupMember).pipe(Effect.map(([first, ...rest]) => first === undefined
|
|
357
|
-
? EffectArray.map(members, (member) => ({
|
|
358
|
-
member,
|
|
359
|
-
reason: groupReason,
|
|
360
|
-
}))
|
|
361
|
-
: [first, ...rest]));
|
|
349
|
+
}), Effect.map((post) => [post.postId]), Effect.catchAll((error) => Effect.suspend(() => state.gathers.has(prepared.id)
|
|
350
|
+
? forgetGather(state, prepared.id).pipe(Effect.zipRight(Effect.fail(collectiveFailure(prepared.id, {
|
|
351
|
+
kind: "members-unreachable",
|
|
352
|
+
members: EffectArray.map(prepared.open.members, (member) => ({ member, reason: error.reason })),
|
|
353
|
+
}))))
|
|
354
|
+
: Effect.succeed([]))));
|
|
362
355
|
}
|
|
363
356
|
/** How long a send waits for request posts: the bound, never past the deadline. */
|
|
364
357
|
function requestWait(state, prepared) {
|
|
@@ -388,6 +381,7 @@ function completeGather(state, id) {
|
|
|
388
381
|
state.gathers.delete(id);
|
|
389
382
|
const result = {
|
|
390
383
|
kind: "collectiveResult",
|
|
384
|
+
op: open.op,
|
|
391
385
|
id,
|
|
392
386
|
to: open.to,
|
|
393
387
|
question: open.question,
|
|
@@ -407,8 +401,7 @@ function completeGather(state, id) {
|
|
|
407
401
|
}
|
|
408
402
|
/**
|
|
409
403
|
* Post an all_gather's close, listing the certified record of every answer
|
|
410
|
-
* its result counts, and emit the result once the close is certified
|
|
411
|
-
* the close post. A close that cannot be certified ends the operation as an
|
|
404
|
+
* its result counts, and emit the result once the close is certified. A close that cannot be certified ends the operation as an
|
|
412
405
|
* `operationFailed` item, since members then have no result to agree on.
|
|
413
406
|
*/
|
|
414
407
|
function closeAllGather(state, open, result) {
|
|
@@ -422,9 +415,9 @@ function closeAllGather(state, open, result) {
|
|
|
422
415
|
kind: "operationFailed",
|
|
423
416
|
id: result.id,
|
|
424
417
|
to: open.to,
|
|
425
|
-
error:
|
|
418
|
+
error: closeFailureText(error.reason),
|
|
426
419
|
}),
|
|
427
|
-
onSuccess: (
|
|
420
|
+
onSuccess: () => state.ports.emit(result),
|
|
428
421
|
}));
|
|
429
422
|
}
|
|
430
423
|
/**
|
|
@@ -465,10 +458,7 @@ function openRequest(state, to) {
|
|
|
465
458
|
*/
|
|
466
459
|
function responseContent(request, response) {
|
|
467
460
|
const validated = response.action === "accept"
|
|
468
|
-
? validateAnswer(request.requestedSchema, response.content).pipe(Effect.mapError((
|
|
469
|
-
kind: "answer-invalid",
|
|
470
|
-
fields: error.failures,
|
|
471
|
-
})))
|
|
461
|
+
? validateAnswer(request.requestedSchema, response.content).pipe(Effect.mapError((fields) => collectiveFailure(response.id, { kind: "answer-invalid", fields })))
|
|
472
462
|
: Effect.void;
|
|
473
463
|
return validated.pipe(Effect.zipRight(encodeCollectiveContent(response).pipe(Effect.mapError(contentInvalid))));
|
|
474
464
|
}
|
|
@@ -627,16 +617,19 @@ function requestItem(state, message, value) {
|
|
|
627
617
|
forgetExpiredRequests(state, now);
|
|
628
618
|
state.requests.set(value.id, received.value);
|
|
629
619
|
}
|
|
630
|
-
return
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
620
|
+
return now < value.deadlineAt
|
|
621
|
+
? Option.some({
|
|
622
|
+
kind: "collectiveRequest",
|
|
623
|
+
op: value.op,
|
|
624
|
+
id: value.id,
|
|
625
|
+
postId: message.postId,
|
|
626
|
+
from: message.sender,
|
|
627
|
+
to: received.value.to,
|
|
628
|
+
question: questionText(message.content),
|
|
629
|
+
requestedSchema: value.requestedSchema,
|
|
630
|
+
deadlineAt: value.deadlineAt,
|
|
631
|
+
})
|
|
632
|
+
: Option.none();
|
|
640
633
|
}));
|
|
641
634
|
}
|
|
642
635
|
/** Forget every request past the time `retainedUntil` gives it. */
|
|
@@ -766,11 +759,11 @@ function applyClose(state, asked, close) {
|
|
|
766
759
|
}
|
|
767
760
|
return Effect.forEach(answers, (answer) => outcomeOfResponse(request.requestedSchema, answer.response).pipe(Effect.map((outcome) => [answer.member, outcome])), { concurrency: 1 }).pipe(Effect.flatMap((outcomes) => state.ports.emit({
|
|
768
761
|
kind: "collectiveResult",
|
|
762
|
+
op: "all_gather",
|
|
769
763
|
id,
|
|
770
764
|
to: request.to,
|
|
771
765
|
question: shared.question,
|
|
772
766
|
outcomes: memberOutcomes(shared.members, new Map(outcomes)),
|
|
773
|
-
closePostId: close.postId,
|
|
774
767
|
})));
|
|
775
768
|
}
|
|
776
769
|
//# sourceMappingURL=operation.js.map
|