1
0
mirror of https://codeberg.org/fediverse/fep.git synced 2026-08-08 21:45:52 +00:00

FEP-0837: New activity types (#864)

\+ smaller `@context` in examples

Reviewed-on: https://codeberg.org/fediverse/fep/pulls/864
This commit is contained in:
silverpill
2026-06-26 14:55:19 +02:00
committed by silverpill
parent 7dfa44a3cf
commit 7acaa11a4c
2 changed files with 37 additions and 67 deletions
+13 -1
View File
@@ -19,6 +19,18 @@
"satisfies": "vf:satisfies",
"stipulates": "vf:stipulates",
"stipulatesReciprocal": "vf:stipulatesReciprocal",
"unitBased": "vf:unitBased"
"unitBased": "vf:unitBased",
"OfferAgreement": {
"@id": "https://w3id.org/fep/0837/OfferAgreement",
"@type": "@id"
},
"AcceptAgreement": {
"@id": "https://w3id.org/fep/0837/AcceptAgreement",
"@type": "@id"
},
"RejectAgreement": {
"@id": "https://w3id.org/fep/0837/RejectAgreement",
"@type": "@id"
}
}
}
+24 -66
View File
@@ -27,9 +27,9 @@ The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "S
sequenceDiagram
actor Alice
actor Bob
Note right of Alice: Alice publishes a Proposal
Bob ->> Alice: Bob sends Offer(Agreement) activity
Alice ->> Bob: Alice sends Accept(Agreement) activity
Note right of Alice: Alice publishes a `Proposal`
Bob ->> Alice: Bob sends `OfferAgreement` activity
Alice ->> Bob: Alice sends `AcceptAgreement` activity
Note over Alice, Bob: Alice and Bob complete the transaction
Alice ->> Bob: Alice sends confirmation activity
```
@@ -77,19 +77,7 @@ Minimal example:
{
"@context": [
"https://www.w3.org/ns/activitystreams",
{
"vf": "https://w3id.org/valueflows/ont/vf#",
"Proposal": "vf:Proposal",
"Intent": "vf:Intent",
"action": "vf:action",
"purpose": "vf:purpose",
"unitBased": "vf:unitBased",
"publishes": "vf:publishes",
"resourceConformsTo": "vf:resourceConformsTo",
"resourceQuantity": "vf:resourceQuantity",
"hasUnit": "vf:hasUnit",
"hasNumericalValue": "vf:hasNumericalValue"
}
"https://w3id.org/fep/0837"
],
"type": "Proposal",
"id": "https://market.example/proposals/ddde9d6f-6f3b-4770-a966-3a18ef006930",
@@ -115,22 +103,7 @@ Full example:
{
"@context": [
"https://www.w3.org/ns/activitystreams",
{
"vf": "https://w3id.org/valueflows/ont/vf#",
"Proposal": "vf:Proposal",
"Intent": "vf:Intent",
"action": "vf:action",
"purpose": "vf:purpose",
"unitBased": "vf:unitBased",
"publishes": "vf:publishes",
"reciprocal": "vf:reciprocal",
"resourceConformsTo": "vf:resourceConformsTo",
"resourceQuantity": "vf:resourceQuantity",
"availableQuantity": "vf:availableQuantity",
"minimumQuantity": "vf:minimumQuantity",
"hasUnit": "vf:hasUnit",
"hasNumericalValue": "vf:hasNumericalValue"
}
"https://w3id.org/fep/0837"
],
"type": "Proposal",
"id": "https://market.example/proposals/ddde9d6f-6f3b-4770-a966-3a18ef006930",
@@ -187,7 +160,9 @@ Example of a proposal attached to an actor via payment link:
```json
{
"@context": "https://www.w3.org/ns/activitystreams",
"@context": [
"https://www.w3.org/ns/activitystreams"
],
"type": "Person",
"id": "https://market.example/users/alice",
"inbox": "https://market.example/users/alice",
@@ -214,9 +189,9 @@ An interested party responds to a proposal and then parties start negotiating to
To respond to a proposal, an interested party MUST send an `Agreement` object wrapped in `Offer` activity to the actor indicated by the `attributedTo` property of the proposal. The proposing party MUST either commit to the action described in the proposal or send a rejection.
In the first case, the proposer finalizes the agreement and sends `Accept(Offer)` activity back to the interested party.
In the first case, the proposer finalizes the agreement and sends `AcceptAgreement` activity back to the interested party.
In the second case, the proposer sends `Reject(Offer)` activity. The interested party MAY send `Offer(Agreement)` activities many times until agreement is reached.
In the second case, the proposer sends `RejectAgreement` activity. The interested party MAY send `OfferAgreement` activities many times until agreement is reached.
The representation of an agreement is a JSON document with the following properties:
@@ -237,25 +212,15 @@ The first commitment MUST satisfy the primary intent of the proposal. The second
The units specified in the agreement MUST match the units specified in the proposal. If the value of `unitBased` property of the proposal is `false`, the amount of resources specified in commitments MUST be equal to amounts specified in the proposal. If the value is `true`, amounts MUST be multiples of amounts specified in the proposal. If `unitBased` property is not present on the proposal, arbitrary amounts can be used.
Example of an `Offer(Agreement)` activity:
Example of an `OfferAgreement` activity:
```json
{
"@context": [
"https://www.w3.org/ns/activitystreams",
{
"vf": "https://w3id.org/valueflows/ont/vf#",
"Agreement": "vf:Agreement",
"stipulates": "vf:stipulates",
"stipulatesReciprocal": "vf:stipulatesReciprocal",
"Commitment": "vf:Commitment",
"satisfies": "vf:satisfies",
"resourceQuantity": "vf:resourceQuantity",
"hasUnit": "vf:hasUnit",
"hasNumericalValue": "vf:hasNumericalValue"
}
"https://w3id.org/fep/0837"
],
"type": "Offer",
"type": "OfferAgreement",
"id": "https://social.example/objects/fc4af0d2-c3a1-409b-947c-3c5be29f49b0/offer",
"actor": "https://social.example/users/bob",
"object": {
@@ -283,11 +248,11 @@ Example of an `Offer(Agreement)` activity:
### Accepting an agreement
The `object` of `Accept` activity MUST be the `id` of the `Offer` activity previously sent to the actor.
The `object` of `AcceptAgreement` activity MUST be the `id` of the `OfferAgreement` activity previously sent to the actor.
`Accept` activity MUST have the `result` property containing the `Agreement` object. The finalized agreement and corresponding commitments MUST have an `id` property. If a similar agreement between parties already exists, it MAY be updated and its `id` re-used. The finalized agreement MUST have an `attributedTo` property and its value MUST match the actor of the `Accept` activity.
The `AcceptAgreement` activity MUST have a `result` property containing the `Agreement` object. The finalized agreement and corresponding commitments MUST have an `id` property. If a similar agreement between parties already exists, it MAY be updated and its `id` re-used. The finalized agreement MUST have an `attributedTo` property and its value MUST match the actor of the `AcceptAgreement` activity.
The quantities specified in the finalized agreement MUST match the quantities specified in `Agreement` object from the `Offer` activity.
The quantities specified in the finalized agreement MUST match the quantities specified in the `Agreement` object from the `OfferAgreement` activity.
The finalized agreement MAY have `url` property containing one or more links to resources associated with the agreement. An example of such resource is a payment page (which can be represented as an [FEP-0ea0] link).
@@ -297,19 +262,9 @@ Example:
{
"@context": [
"https://www.w3.org/ns/activitystreams",
{
"vf": "https://w3id.org/valueflows/ont/vf#",
"Agreement": "vf:Agreement",
"stipulates": "vf:stipulates",
"stipulatesReciprocal": "vf:stipulatesReciprocal",
"Commitment": "vf:Commitment",
"satisfies": "vf:satisfies",
"resourceQuantity": "vf:resourceQuantity",
"hasUnit": "vf:hasUnit",
"hasNumericalValue": "vf:hasNumericalValue"
}
"https://w3id.org/fep/0837"
],
"type": "Accept",
"type": "AcceptAgreement",
"id": "https://market.example/activities/059f08fa-31b1-4136-8d76-5987d705a0ab",
"actor": "https://market.example/users/alice",
"object": "https://social.example/objects/fc4af0d2-c3a1-409b-947c-3c5be29f49b0/offer",
@@ -347,7 +302,7 @@ Example:
### Rejecting an agreement
The `object` of `Reject` activity MUST be the `id` of the `Offer` activity previously sent to the actor.
The `object` of `RejectAgreement` activity MUST be the `id` of the `OfferAgreement` activity previously sent to the actor.
Activity MAY contain `content` property indicating the reason for rejection.
@@ -355,8 +310,11 @@ Example:
```json
{
"@context": "https://www.w3.org/ns/activitystreams",
"type": "Reject",
"@context": [
"https://www.w3.org/ns/activitystreams",
"https://w3id.org/fep/0837"
],
"type": "RejectAgreement",
"id": "https://market.example/activities/8c05f97f-1531-4b70-9ca8-4ee4a09f36a4",
"actor": "https://market.example/users/alice",
"object": "https://social.example/objects/fc4af0d2-c3a1-409b-947c-3c5be29f49b0/offer",