@ottochain/sdk 1.7.0-beta.2 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/apps/contracts/index.js +1 -1
- package/dist/cjs/apps/contracts/state-machines/contract-agreement.js +272 -0
- package/dist/cjs/apps/contracts/state-machines/contract-escrow.js +284 -0
- package/dist/cjs/apps/contracts/state-machines/contract-universal.js +93 -0
- package/dist/cjs/apps/contracts/state-machines/index.js +177 -1
- package/dist/cjs/apps/corporate/state-machines/corp-board.js +1022 -0
- package/dist/cjs/apps/corporate/state-machines/corp-entity.js +671 -0
- package/dist/cjs/apps/corporate/state-machines/corp-securities.js +998 -0
- package/dist/cjs/apps/corporate/state-machines/corp-shareholders.js +1102 -0
- package/dist/cjs/apps/corporate/state-machines/index.js +20 -4440
- package/dist/cjs/apps/governance/index.js +7 -7
- package/dist/cjs/apps/governance/state-machines/dao-multisig.js +467 -0
- package/dist/cjs/apps/governance/state-machines/dao-reputation.js +458 -0
- package/dist/cjs/apps/governance/state-machines/dao-single.js +199 -0
- package/dist/cjs/apps/governance/state-machines/dao-token.js +503 -0
- package/dist/cjs/apps/governance/state-machines/governance-simple.js +482 -0
- package/dist/cjs/apps/governance/state-machines/governance-universal.js +138 -0
- package/dist/cjs/apps/governance/state-machines/index.js +16 -2934
- package/dist/cjs/apps/identity/constants.js +20 -20
- package/dist/cjs/apps/identity/index.js +13 -21
- package/dist/cjs/apps/identity/state-machines/identity-agent.js +256 -0
- package/dist/cjs/apps/identity/state-machines/identity-oracle.js +321 -0
- package/dist/cjs/apps/identity/state-machines/identity-universal.js +106 -0
- package/dist/cjs/apps/identity/state-machines/index.js +15 -784
- package/dist/cjs/apps/markets/index.js +1 -1
- package/dist/cjs/apps/markets/state-machines/index.js +14 -2298
- package/dist/cjs/apps/markets/state-machines/market-auction.js +283 -0
- package/dist/cjs/apps/markets/state-machines/market-crowdfund.js +312 -0
- package/dist/cjs/apps/markets/state-machines/market-group-buy.js +407 -0
- package/dist/cjs/apps/markets/state-machines/market-prediction.js +485 -0
- package/dist/cjs/apps/markets/state-machines/market-universal.js +129 -0
- package/dist/cjs/apps/oracles/index.js +36 -0
- package/dist/cjs/generated/index.js +14 -7
- package/dist/cjs/generated/ottochain/apps/identity/v1/identity.js +197 -198
- package/dist/cjs/schema/fiber-app.js +55 -0
- package/dist/cjs/schema/index.js +20 -0
- package/dist/esm/apps/contracts/index.js +3 -3
- package/dist/esm/apps/contracts/state-machines/contract-agreement.js +269 -0
- package/dist/esm/apps/contracts/state-machines/contract-escrow.js +281 -0
- package/dist/esm/apps/contracts/state-machines/contract-universal.js +90 -0
- package/dist/esm/apps/contracts/state-machines/index.js +177 -1
- package/dist/esm/apps/corporate/index.js +3 -3
- package/dist/esm/apps/corporate/state-machines/corp-board.js +1019 -0
- package/dist/esm/apps/corporate/state-machines/corp-entity.js +668 -0
- package/dist/esm/apps/corporate/state-machines/corp-securities.js +995 -0
- package/dist/esm/apps/corporate/state-machines/corp-shareholders.js +1099 -0
- package/dist/esm/apps/corporate/state-machines/index.js +15 -4439
- package/dist/esm/apps/governance/index.js +9 -9
- package/dist/esm/apps/governance/state-machines/dao-multisig.js +464 -0
- package/dist/esm/apps/governance/state-machines/dao-reputation.js +455 -0
- package/dist/esm/apps/governance/state-machines/dao-single.js +196 -0
- package/dist/esm/apps/governance/state-machines/dao-token.js +500 -0
- package/dist/esm/apps/governance/state-machines/governance-simple.js +479 -0
- package/dist/esm/apps/governance/state-machines/governance-universal.js +135 -0
- package/dist/esm/apps/governance/state-machines/index.js +9 -2933
- package/dist/esm/apps/identity/constants.js +21 -21
- package/dist/esm/apps/identity/index.js +13 -22
- package/dist/esm/apps/identity/state-machines/identity-agent.js +253 -0
- package/dist/esm/apps/identity/state-machines/identity-oracle.js +318 -0
- package/dist/esm/apps/identity/state-machines/identity-universal.js +103 -0
- package/dist/esm/apps/identity/state-machines/index.js +11 -783
- package/dist/esm/apps/index.js +5 -5
- package/dist/esm/apps/markets/index.js +3 -3
- package/dist/esm/apps/markets/state-machines/index.js +8 -2297
- package/dist/esm/apps/markets/state-machines/market-auction.js +280 -0
- package/dist/esm/apps/markets/state-machines/market-crowdfund.js +309 -0
- package/dist/esm/apps/markets/state-machines/market-group-buy.js +404 -0
- package/dist/esm/apps/markets/state-machines/market-prediction.js +482 -0
- package/dist/esm/apps/markets/state-machines/market-universal.js +126 -0
- package/dist/esm/apps/oracles/index.js +21 -0
- package/dist/esm/generated/index.js +8 -3
- package/dist/esm/generated/ottochain/apps/identity/v1/identity.js +196 -197
- package/dist/esm/schema/fiber-app.js +47 -0
- package/dist/esm/schema/index.js +4 -0
- package/dist/types/apps/contracts/index.d.ts +151 -2
- package/dist/types/apps/contracts/state-machines/contract-agreement.d.ts +462 -0
- package/dist/types/apps/contracts/state-machines/contract-escrow.d.ts +511 -0
- package/dist/types/apps/contracts/state-machines/contract-universal.d.ts +147 -0
- package/dist/types/apps/contracts/state-machines/index.d.ts +149 -0
- package/dist/types/apps/corporate/index.d.ts +5263 -3825
- package/dist/types/apps/corporate/state-machines/corp-board.d.ts +1479 -0
- package/dist/types/apps/corporate/state-machines/corp-entity.d.ts +970 -0
- package/dist/types/apps/corporate/state-machines/corp-securities.d.ts +1381 -0
- package/dist/types/apps/corporate/state-machines/corp-shareholders.d.ts +1631 -0
- package/dist/types/apps/corporate/state-machines/index.d.ts +5245 -3802
- package/dist/types/apps/governance/index.d.ts +875 -37
- package/dist/types/apps/governance/state-machines/dao-multisig.d.ts +644 -0
- package/dist/types/apps/governance/state-machines/dao-reputation.d.ts +610 -0
- package/dist/types/apps/governance/state-machines/dao-single.d.ts +276 -0
- package/dist/types/apps/governance/state-machines/dao-token.d.ts +601 -0
- package/dist/types/apps/governance/state-machines/governance-simple.d.ts +652 -0
- package/dist/types/apps/governance/state-machines/governance-universal.d.ts +181 -0
- package/dist/types/apps/governance/state-machines/index.d.ts +9 -2136
- package/dist/types/apps/identity/constants.d.ts +4 -7
- package/dist/types/apps/identity/index.d.ts +1082 -592
- package/dist/types/apps/identity/state-machines/identity-agent.d.ts +401 -0
- package/dist/types/apps/identity/state-machines/identity-oracle.d.ts +550 -0
- package/dist/types/apps/identity/state-machines/identity-universal.d.ts +151 -0
- package/dist/types/apps/identity/state-machines/index.d.ts +1069 -567
- package/dist/types/apps/index.d.ts +5 -5
- package/dist/types/apps/markets/index.d.ts +535 -7
- package/dist/types/apps/markets/state-machines/index.d.ts +8 -1678
- package/dist/types/apps/markets/state-machines/market-auction.d.ts +392 -0
- package/dist/types/apps/markets/state-machines/market-crowdfund.d.ts +443 -0
- package/dist/types/apps/markets/state-machines/market-group-buy.d.ts +539 -0
- package/dist/types/apps/markets/state-machines/market-prediction.d.ts +651 -0
- package/dist/types/apps/markets/state-machines/market-universal.d.ts +191 -0
- package/dist/types/apps/oracles/index.d.ts +18 -0
- package/dist/types/generated/index.d.ts +3 -1
- package/dist/types/generated/ottochain/apps/identity/v1/identity.d.ts +43 -64
- package/dist/types/schema/fiber-app.d.ts +139 -0
- package/dist/types/schema/index.d.ts +4 -0
- package/package.json +1 -1
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Identity Constants
|
|
4
4
|
*
|
|
5
|
-
* State machine transitions and configuration constants for
|
|
5
|
+
* State machine transitions and configuration constants for identity types.
|
|
6
6
|
*
|
|
7
7
|
* @packageDocumentation
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.
|
|
10
|
+
exports.getReputationDelta = exports.canTransition = exports.ATTESTATION_DELTAS = exports.AGENT_TRANSITIONS = exports.IDENTITY_TRANSITIONS = void 0;
|
|
11
11
|
const identity_js_1 = require("../../generated/ottochain/apps/identity/v1/identity.js");
|
|
12
12
|
const attestation_js_1 = require("../../generated/ottochain/apps/identity/v1/attestation.js");
|
|
13
13
|
// ---------------------------------------------------------------------------
|
|
@@ -16,20 +16,30 @@ const attestation_js_1 = require("../../generated/ottochain/apps/identity/v1/att
|
|
|
16
16
|
/**
|
|
17
17
|
* Valid transitions for each identity state.
|
|
18
18
|
* Maps current state to allowed event names.
|
|
19
|
+
* Note: Some transitions are type-specific (agent vs oracle)
|
|
19
20
|
*/
|
|
20
21
|
exports.IDENTITY_TRANSITIONS = {
|
|
21
22
|
[identity_js_1.IdentityState.IDENTITY_STATE_UNSPECIFIED]: [],
|
|
22
|
-
[identity_js_1.IdentityState.IDENTITY_STATE_UNREGISTERED]: [
|
|
23
|
-
[identity_js_1.IdentityState.IDENTITY_STATE_REGISTERED]: [
|
|
24
|
-
[identity_js_1.IdentityState.IDENTITY_STATE_ACTIVE]: [
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
23
|
+
[identity_js_1.IdentityState.IDENTITY_STATE_UNREGISTERED]: ["register"],
|
|
24
|
+
[identity_js_1.IdentityState.IDENTITY_STATE_REGISTERED]: ["activate", "withdraw"],
|
|
25
|
+
[identity_js_1.IdentityState.IDENTITY_STATE_ACTIVE]: [
|
|
26
|
+
"challenge",
|
|
27
|
+
"slash",
|
|
28
|
+
"deactivate",
|
|
29
|
+
"withdraw",
|
|
30
|
+
],
|
|
31
|
+
[identity_js_1.IdentityState.IDENTITY_STATE_CHALLENGED]: [
|
|
32
|
+
"uphold_challenge",
|
|
33
|
+
"dismiss_challenge",
|
|
34
|
+
],
|
|
35
|
+
[identity_js_1.IdentityState.IDENTITY_STATE_SUSPENDED]: ["begin_probation"],
|
|
36
|
+
[identity_js_1.IdentityState.IDENTITY_STATE_PROBATION]: ["complete_probation"],
|
|
37
|
+
[identity_js_1.IdentityState.IDENTITY_STATE_SLASHED]: ["reactivate", "withdraw"],
|
|
38
|
+
[identity_js_1.IdentityState.IDENTITY_STATE_INACTIVE]: ["activate", "withdraw"],
|
|
29
39
|
[identity_js_1.IdentityState.IDENTITY_STATE_WITHDRAWN]: [], // Terminal state
|
|
30
40
|
[identity_js_1.IdentityState.UNRECOGNIZED]: [],
|
|
31
41
|
};
|
|
32
|
-
// Legacy alias
|
|
42
|
+
// Legacy alias
|
|
33
43
|
exports.AGENT_TRANSITIONS = exports.IDENTITY_TRANSITIONS;
|
|
34
44
|
// ---------------------------------------------------------------------------
|
|
35
45
|
// Reputation Configuration
|
|
@@ -60,13 +70,3 @@ function getReputationDelta(type) {
|
|
|
60
70
|
return exports.ATTESTATION_DELTAS[type] ?? 0;
|
|
61
71
|
}
|
|
62
72
|
exports.getReputationDelta = getReputationDelta;
|
|
63
|
-
/**
|
|
64
|
-
* Identity type display names
|
|
65
|
-
*/
|
|
66
|
-
exports.IDENTITY_TYPE_NAMES = {
|
|
67
|
-
[identity_js_1.IdentityType.IDENTITY_TYPE_UNSPECIFIED]: 'Unknown',
|
|
68
|
-
[identity_js_1.IdentityType.IDENTITY_TYPE_AGENT]: 'Agent',
|
|
69
|
-
[identity_js_1.IdentityType.IDENTITY_TYPE_ORACLE]: 'Oracle',
|
|
70
|
-
[identity_js_1.IdentityType.IDENTITY_TYPE_SERVICE]: 'Service',
|
|
71
|
-
[identity_js_1.IdentityType.UNRECOGNIZED]: 'Unknown',
|
|
72
|
-
};
|
|
@@ -1,25 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* Identity Application
|
|
3
|
+
* Agent Identity Application
|
|
4
4
|
*
|
|
5
|
-
* Types and utilities for the Identity system on OttoChain.
|
|
6
|
-
* Includes agents, oracles, and services.
|
|
5
|
+
* Types and utilities for the Agent Identity system on OttoChain.
|
|
7
6
|
*
|
|
8
7
|
* @example
|
|
9
8
|
* ```typescript
|
|
10
9
|
* import {
|
|
11
|
-
*
|
|
12
|
-
*
|
|
10
|
+
* AgentState,
|
|
11
|
+
* AgentIdentity,
|
|
13
12
|
* getIdentityDefinition
|
|
14
13
|
* } from '@ottochain/sdk/apps/identity';
|
|
15
14
|
*
|
|
16
|
-
* const
|
|
15
|
+
* const identityDef = getIdentityDefinition();
|
|
17
16
|
* ```
|
|
18
17
|
*
|
|
19
18
|
* @packageDocumentation
|
|
20
19
|
*/
|
|
21
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
exports.getIdentityDefinition = exports.IDENTITY_DEFINITIONS = exports.identityOracleDef = exports.identityAgentDef = exports.identityUniversalDef = exports.
|
|
21
|
+
exports.getIdentityDefinition = exports.IDENTITY_DEFINITIONS = exports.identityOracleDef = exports.identityAgentDef = exports.identityUniversalDef = exports.DEFAULT_REPUTATION_CONFIG = exports.getReputationDelta = exports.canTransition = exports.ATTESTATION_DELTAS = exports.AGENT_TRANSITIONS = exports.IDENTITY_TRANSITIONS = exports.attestationTypeToJSON = exports.attestationTypeFromJSON = exports.ReputationConfig = exports.ChallengeRequest = exports.VouchRequest = exports.Attestation = exports.ReputationDelta = exports.AttestationType = exports.AgentState = exports.platformToJSON = exports.platformFromJSON = exports.identityStateToJSON = exports.identityStateFromJSON = exports.identityTypeToJSON = exports.identityTypeFromJSON = exports.IdentityDefinition = exports.WithdrawIdentityRequest = exports.AddStakeRequest = exports.ChallengeIdentityRequest = exports.LinkPlatformRequest = exports.ActivateIdentityRequest = exports.RegisterIdentityRequest = exports.Identity = exports.PenaltyEvent = exports.Reputation = exports.PlatformLink = exports.Platform = exports.IdentityState = exports.IdentityType = void 0;
|
|
23
22
|
// Re-export generated protobuf types (source of truth)
|
|
24
23
|
var identity_js_1 = require("../../generated/ottochain/apps/identity/v1/identity.js");
|
|
25
24
|
Object.defineProperty(exports, "IdentityType", { enumerable: true, get: function () { return identity_js_1.IdentityType; } });
|
|
@@ -31,9 +30,9 @@ Object.defineProperty(exports, "PenaltyEvent", { enumerable: true, get: function
|
|
|
31
30
|
Object.defineProperty(exports, "Identity", { enumerable: true, get: function () { return identity_js_1.Identity; } });
|
|
32
31
|
Object.defineProperty(exports, "RegisterIdentityRequest", { enumerable: true, get: function () { return identity_js_1.RegisterIdentityRequest; } });
|
|
33
32
|
Object.defineProperty(exports, "ActivateIdentityRequest", { enumerable: true, get: function () { return identity_js_1.ActivateIdentityRequest; } });
|
|
34
|
-
Object.defineProperty(exports, "
|
|
33
|
+
Object.defineProperty(exports, "LinkPlatformRequest", { enumerable: true, get: function () { return identity_js_1.LinkPlatformRequest; } });
|
|
35
34
|
Object.defineProperty(exports, "ChallengeIdentityRequest", { enumerable: true, get: function () { return identity_js_1.ChallengeIdentityRequest; } });
|
|
36
|
-
Object.defineProperty(exports, "
|
|
35
|
+
Object.defineProperty(exports, "AddStakeRequest", { enumerable: true, get: function () { return identity_js_1.AddStakeRequest; } });
|
|
37
36
|
Object.defineProperty(exports, "WithdrawIdentityRequest", { enumerable: true, get: function () { return identity_js_1.WithdrawIdentityRequest; } });
|
|
38
37
|
Object.defineProperty(exports, "IdentityDefinition", { enumerable: true, get: function () { return identity_js_1.IdentityDefinition; } });
|
|
39
38
|
Object.defineProperty(exports, "identityTypeFromJSON", { enumerable: true, get: function () { return identity_js_1.identityTypeFromJSON; } });
|
|
@@ -42,6 +41,9 @@ Object.defineProperty(exports, "identityStateFromJSON", { enumerable: true, get:
|
|
|
42
41
|
Object.defineProperty(exports, "identityStateToJSON", { enumerable: true, get: function () { return identity_js_1.identityStateToJSON; } });
|
|
43
42
|
Object.defineProperty(exports, "platformFromJSON", { enumerable: true, get: function () { return identity_js_1.platformFromJSON; } });
|
|
44
43
|
Object.defineProperty(exports, "platformToJSON", { enumerable: true, get: function () { return identity_js_1.platformToJSON; } });
|
|
44
|
+
// Legacy aliases for backward compatibility
|
|
45
|
+
var identity_js_2 = require("../../generated/ottochain/apps/identity/v1/identity.js");
|
|
46
|
+
Object.defineProperty(exports, "AgentState", { enumerable: true, get: function () { return identity_js_2.IdentityState; } });
|
|
45
47
|
var attestation_js_1 = require("../../generated/ottochain/apps/identity/v1/attestation.js");
|
|
46
48
|
Object.defineProperty(exports, "AttestationType", { enumerable: true, get: function () { return attestation_js_1.AttestationType; } });
|
|
47
49
|
Object.defineProperty(exports, "ReputationDelta", { enumerable: true, get: function () { return attestation_js_1.ReputationDelta; } });
|
|
@@ -56,14 +58,13 @@ var constants_js_1 = require("./constants.js");
|
|
|
56
58
|
Object.defineProperty(exports, "IDENTITY_TRANSITIONS", { enumerable: true, get: function () { return constants_js_1.IDENTITY_TRANSITIONS; } });
|
|
57
59
|
Object.defineProperty(exports, "AGENT_TRANSITIONS", { enumerable: true, get: function () { return constants_js_1.AGENT_TRANSITIONS; } });
|
|
58
60
|
Object.defineProperty(exports, "ATTESTATION_DELTAS", { enumerable: true, get: function () { return constants_js_1.ATTESTATION_DELTAS; } });
|
|
59
|
-
Object.defineProperty(exports, "IDENTITY_TYPE_NAMES", { enumerable: true, get: function () { return constants_js_1.IDENTITY_TYPE_NAMES; } });
|
|
60
61
|
Object.defineProperty(exports, "canTransition", { enumerable: true, get: function () { return constants_js_1.canTransition; } });
|
|
61
62
|
Object.defineProperty(exports, "getReputationDelta", { enumerable: true, get: function () { return constants_js_1.getReputationDelta; } });
|
|
62
63
|
// ---------------------------------------------------------------------------
|
|
63
64
|
// Configuration Defaults
|
|
64
65
|
// ---------------------------------------------------------------------------
|
|
65
66
|
/**
|
|
66
|
-
* Default reputation configuration for
|
|
67
|
+
* Default reputation configuration for agent identity
|
|
67
68
|
*/
|
|
68
69
|
exports.DEFAULT_REPUTATION_CONFIG = {
|
|
69
70
|
baseReputation: 10,
|
|
@@ -74,15 +75,6 @@ exports.DEFAULT_REPUTATION_CONFIG = {
|
|
|
74
75
|
minReputation: 0,
|
|
75
76
|
challengeThreshold: 5,
|
|
76
77
|
};
|
|
77
|
-
/**
|
|
78
|
-
* Default oracle configuration
|
|
79
|
-
*/
|
|
80
|
-
exports.DEFAULT_ORACLE_CONFIG = {
|
|
81
|
-
minStake: 100,
|
|
82
|
-
slashCooldownEpochs: 7,
|
|
83
|
-
accuracyThreshold: 70,
|
|
84
|
-
maxDisputeRate: 30,
|
|
85
|
-
};
|
|
86
78
|
// ---------------------------------------------------------------------------
|
|
87
79
|
// State Machine Definitions (generated from JSON at build time)
|
|
88
80
|
// ---------------------------------------------------------------------------
|
|
@@ -100,7 +92,7 @@ exports.IDENTITY_DEFINITIONS = {
|
|
|
100
92
|
* Get an identity state machine definition by type.
|
|
101
93
|
* @param type - 'universal' | 'agent' | 'oracle' (default: 'agent')
|
|
102
94
|
*/
|
|
103
|
-
function getIdentityDefinition(type =
|
|
95
|
+
function getIdentityDefinition(type = "agent") {
|
|
104
96
|
return exports.IDENTITY_DEFINITIONS[type];
|
|
105
97
|
}
|
|
106
98
|
exports.getIdentityDefinition = getIdentityDefinition;
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.identityAgentDef = void 0;
|
|
4
|
+
const fiber_app_js_1 = require("../../../schema/fiber-app.js");
|
|
5
|
+
/**
|
|
6
|
+
* Standard agent identity with reputation tracking, vouching, and lifecycle management.
|
|
7
|
+
*/
|
|
8
|
+
exports.identityAgentDef = (0, fiber_app_js_1.defineFiberApp)({
|
|
9
|
+
metadata: {
|
|
10
|
+
name: "IdentityAgent",
|
|
11
|
+
app: "identity",
|
|
12
|
+
type: "agent",
|
|
13
|
+
version: "1.0.0",
|
|
14
|
+
description: "Standard agent identity with reputation tracking, vouching, and lifecycle management",
|
|
15
|
+
},
|
|
16
|
+
createSchema: {
|
|
17
|
+
required: ["owner", "displayName"],
|
|
18
|
+
properties: {
|
|
19
|
+
owner: {
|
|
20
|
+
type: "address",
|
|
21
|
+
description: "Agent owner DAG address",
|
|
22
|
+
immutable: true,
|
|
23
|
+
},
|
|
24
|
+
displayName: {
|
|
25
|
+
type: "string",
|
|
26
|
+
maxLength: 64,
|
|
27
|
+
description: "Human-readable agent name",
|
|
28
|
+
},
|
|
29
|
+
bio: {
|
|
30
|
+
type: "string",
|
|
31
|
+
maxLength: 256,
|
|
32
|
+
default: "",
|
|
33
|
+
},
|
|
34
|
+
avatar: {
|
|
35
|
+
type: "uri",
|
|
36
|
+
default: null,
|
|
37
|
+
},
|
|
38
|
+
platforms: {
|
|
39
|
+
type: "array",
|
|
40
|
+
items: { $ref: "#/definitions/PlatformLink" },
|
|
41
|
+
default: [],
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
stateSchema: {
|
|
46
|
+
properties: {
|
|
47
|
+
owner: { type: "address", immutable: true },
|
|
48
|
+
displayName: { type: "string" },
|
|
49
|
+
bio: { type: "string" },
|
|
50
|
+
avatar: { type: "uri" },
|
|
51
|
+
platforms: {
|
|
52
|
+
type: "array",
|
|
53
|
+
items: { $ref: "#/definitions/PlatformLink" },
|
|
54
|
+
},
|
|
55
|
+
status: {
|
|
56
|
+
type: "string",
|
|
57
|
+
enum: [
|
|
58
|
+
"REGISTERED",
|
|
59
|
+
"ACTIVE",
|
|
60
|
+
"CHALLENGED",
|
|
61
|
+
"SUSPENDED",
|
|
62
|
+
"PROBATION",
|
|
63
|
+
"WITHDRAWN",
|
|
64
|
+
],
|
|
65
|
+
computed: true,
|
|
66
|
+
},
|
|
67
|
+
reputation: { type: "integer", default: 10, computed: true },
|
|
68
|
+
activatedAt: { type: "timestamp", computed: true },
|
|
69
|
+
suspendedAt: { type: "timestamp", computed: true },
|
|
70
|
+
probationStartedAt: { type: "timestamp", computed: true },
|
|
71
|
+
challengedBy: { type: "address", computed: true },
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
eventSchemas: {
|
|
75
|
+
activate: {
|
|
76
|
+
description: "Activate a registered agent",
|
|
77
|
+
},
|
|
78
|
+
receive_vouch: {
|
|
79
|
+
description: "Receive a vouch from another agent",
|
|
80
|
+
required: ["from"],
|
|
81
|
+
properties: {
|
|
82
|
+
from: { type: "address", description: "Address of vouching agent" },
|
|
83
|
+
weight: { type: "integer", minimum: 1, maximum: 10, default: 1 },
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
receive_completion: {
|
|
87
|
+
description: "Receive completion attestation from a fiber",
|
|
88
|
+
},
|
|
89
|
+
challenge: {
|
|
90
|
+
description: "Challenge an active agent's behavior",
|
|
91
|
+
required: ["challenger", "reason"],
|
|
92
|
+
properties: {
|
|
93
|
+
challenger: { type: "address" },
|
|
94
|
+
reason: { type: "string", maxLength: 512 },
|
|
95
|
+
evidence: { type: "array", items: { type: "uri" } },
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
dismiss_challenge: {
|
|
99
|
+
description: "Dismiss an active challenge",
|
|
100
|
+
},
|
|
101
|
+
uphold_challenge: {
|
|
102
|
+
description: "Uphold a challenge, suspending the agent",
|
|
103
|
+
},
|
|
104
|
+
begin_probation: {
|
|
105
|
+
description: "Move suspended agent to probation",
|
|
106
|
+
},
|
|
107
|
+
complete_probation: {
|
|
108
|
+
description: "Complete probation, reactivating the agent",
|
|
109
|
+
},
|
|
110
|
+
withdraw: {
|
|
111
|
+
description: "Permanently withdraw the agent",
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
definitions: {
|
|
115
|
+
PlatformLink: {
|
|
116
|
+
type: "object",
|
|
117
|
+
required: ["platform", "handle"],
|
|
118
|
+
properties: {
|
|
119
|
+
platform: {
|
|
120
|
+
type: "string",
|
|
121
|
+
enum: [
|
|
122
|
+
"twitter",
|
|
123
|
+
"github",
|
|
124
|
+
"discord",
|
|
125
|
+
"telegram",
|
|
126
|
+
"moltbook",
|
|
127
|
+
],
|
|
128
|
+
},
|
|
129
|
+
handle: { type: "string" },
|
|
130
|
+
verified: { type: "boolean", default: false },
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
states: {
|
|
135
|
+
REGISTERED: { id: "REGISTERED", isFinal: false },
|
|
136
|
+
ACTIVE: { id: "ACTIVE", isFinal: false },
|
|
137
|
+
CHALLENGED: { id: "CHALLENGED", isFinal: false },
|
|
138
|
+
SUSPENDED: { id: "SUSPENDED", isFinal: false },
|
|
139
|
+
PROBATION: { id: "PROBATION", isFinal: false },
|
|
140
|
+
WITHDRAWN: { id: "WITHDRAWN", isFinal: true },
|
|
141
|
+
},
|
|
142
|
+
initialState: "REGISTERED",
|
|
143
|
+
transitions: [
|
|
144
|
+
{
|
|
145
|
+
from: "REGISTERED",
|
|
146
|
+
to: "ACTIVE",
|
|
147
|
+
eventName: "activate",
|
|
148
|
+
guard: { "==": [1, 1] },
|
|
149
|
+
effect: {
|
|
150
|
+
merge: [
|
|
151
|
+
{ var: "state" },
|
|
152
|
+
{ status: "ACTIVE", activatedAt: { var: "$timestamp" } },
|
|
153
|
+
],
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
from: "ACTIVE",
|
|
158
|
+
to: "ACTIVE",
|
|
159
|
+
eventName: "receive_vouch",
|
|
160
|
+
guard: { "!!": [{ var: "event.from" }] },
|
|
161
|
+
effect: {
|
|
162
|
+
merge: [
|
|
163
|
+
{ var: "state" },
|
|
164
|
+
{ reputation: { "+": [{ var: "state.reputation" }, 2] } },
|
|
165
|
+
],
|
|
166
|
+
},
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
from: "ACTIVE",
|
|
170
|
+
to: "ACTIVE",
|
|
171
|
+
eventName: "receive_completion",
|
|
172
|
+
guard: { "==": [1, 1] },
|
|
173
|
+
effect: {
|
|
174
|
+
merge: [
|
|
175
|
+
{ var: "state" },
|
|
176
|
+
{ reputation: { "+": [{ var: "state.reputation" }, 5] } },
|
|
177
|
+
],
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
from: "ACTIVE",
|
|
182
|
+
to: "CHALLENGED",
|
|
183
|
+
eventName: "challenge",
|
|
184
|
+
guard: { "!!": [{ var: "event.challenger" }] },
|
|
185
|
+
effect: {
|
|
186
|
+
merge: [
|
|
187
|
+
{ var: "state" },
|
|
188
|
+
{ status: "CHALLENGED", challengedBy: { var: "event.challenger" } },
|
|
189
|
+
],
|
|
190
|
+
},
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
from: "CHALLENGED",
|
|
194
|
+
to: "ACTIVE",
|
|
195
|
+
eventName: "dismiss_challenge",
|
|
196
|
+
guard: { "==": [1, 1] },
|
|
197
|
+
effect: {
|
|
198
|
+
merge: [{ var: "state" }, { status: "ACTIVE", challengedBy: null }],
|
|
199
|
+
},
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
from: "CHALLENGED",
|
|
203
|
+
to: "SUSPENDED",
|
|
204
|
+
eventName: "uphold_challenge",
|
|
205
|
+
guard: { "==": [1, 1] },
|
|
206
|
+
effect: {
|
|
207
|
+
merge: [
|
|
208
|
+
{ var: "state" },
|
|
209
|
+
{ status: "SUSPENDED", suspendedAt: { var: "$timestamp" } },
|
|
210
|
+
],
|
|
211
|
+
},
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
from: "SUSPENDED",
|
|
215
|
+
to: "PROBATION",
|
|
216
|
+
eventName: "begin_probation",
|
|
217
|
+
guard: { "==": [1, 1] },
|
|
218
|
+
effect: {
|
|
219
|
+
merge: [
|
|
220
|
+
{ var: "state" },
|
|
221
|
+
{ status: "PROBATION", probationStartedAt: { var: "$timestamp" } },
|
|
222
|
+
],
|
|
223
|
+
},
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
from: "PROBATION",
|
|
227
|
+
to: "ACTIVE",
|
|
228
|
+
eventName: "complete_probation",
|
|
229
|
+
guard: { "==": [1, 1] },
|
|
230
|
+
effect: {
|
|
231
|
+
merge: [
|
|
232
|
+
{ var: "state" },
|
|
233
|
+
{ status: "ACTIVE", probationStartedAt: null },
|
|
234
|
+
],
|
|
235
|
+
},
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
from: "ACTIVE",
|
|
239
|
+
to: "WITHDRAWN",
|
|
240
|
+
eventName: "withdraw",
|
|
241
|
+
guard: { "==": [1, 1] },
|
|
242
|
+
effect: {
|
|
243
|
+
merge: [{ var: "state" }, { status: "WITHDRAWN" }],
|
|
244
|
+
},
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
from: "REGISTERED",
|
|
248
|
+
to: "WITHDRAWN",
|
|
249
|
+
eventName: "withdraw",
|
|
250
|
+
guard: { "==": [1, 1] },
|
|
251
|
+
effect: {
|
|
252
|
+
merge: [{ var: "state" }, { status: "WITHDRAWN" }],
|
|
253
|
+
},
|
|
254
|
+
},
|
|
255
|
+
],
|
|
256
|
+
});
|