@otonoma/paranet-client 2.13.1-rc.8 → 2.13.1
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/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/schema/paranet.d.ts +115 -23
- package/dist/schema/paranet.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +2 -0
- package/src/schema/paranet.ts +119 -23
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAE1B,cAAc,cAAc,CAAC;AAC7B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,mCAAmC,CAAC;AAClD,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AAEpC,cAAc,QAAQ,CAAC;AAEvB,cAAc,QAAQ,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAE1B,cAAc,cAAc,CAAC;AAC7B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,mCAAmC,CAAC;AAClD,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AAEpC,cAAc,QAAQ,CAAC;AAEvB,cAAc,QAAQ,CAAC;AAEvB,YAAY,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC"}
|
package/dist/schema/paranet.d.ts
CHANGED
|
@@ -16,12 +16,8 @@ export type PncpPacket = {
|
|
|
16
16
|
[k: string]: any;
|
|
17
17
|
};
|
|
18
18
|
export type ConversationId = string;
|
|
19
|
-
export type EntityId = string;
|
|
20
|
-
/**
|
|
21
|
-
* Determines the match strategy used by the paranet.
|
|
22
|
-
*/
|
|
23
|
-
export type SkillMatchStrategy = "BEST" | "FIRST" | "STRICT";
|
|
24
19
|
export type EntityReq = string;
|
|
20
|
+
export type EntityId = string;
|
|
25
21
|
export type PncpMessageBody = {
|
|
26
22
|
type: "response";
|
|
27
23
|
body: PncpDataMessage;
|
|
@@ -47,7 +43,12 @@ export type PncpMessageBody = {
|
|
|
47
43
|
body: PncpDataMessage;
|
|
48
44
|
[k: string]: any;
|
|
49
45
|
};
|
|
46
|
+
/**
|
|
47
|
+
* Determines the match strategy used by the paranet.
|
|
48
|
+
*/
|
|
49
|
+
export type SkillMatchStrategy = "BEST" | "FIRST" | "STRICT";
|
|
50
50
|
export type Id = string;
|
|
51
|
+
export type ResponseKind = "MATCH" | "BROADCAST" | "UNMATCHED" | "NETWORKED" | "DATA";
|
|
51
52
|
/**
|
|
52
53
|
* Represents all message types that can be sent from the paranet to an actor.
|
|
53
54
|
*/
|
|
@@ -60,25 +61,60 @@ export type PncpCallback = {
|
|
|
60
61
|
body: PncpMessageCallback;
|
|
61
62
|
[k: string]: any;
|
|
62
63
|
};
|
|
64
|
+
export type SchemaRef = {
|
|
65
|
+
/**
|
|
66
|
+
* Allowed to be empty/not present.
|
|
67
|
+
*/
|
|
68
|
+
optional?: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Indicates that the field should be redacted from the ledger as well as observers.
|
|
71
|
+
*/
|
|
72
|
+
redacted?: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Indicates that the object can be an array of values.
|
|
75
|
+
*/
|
|
76
|
+
repeated?: boolean;
|
|
77
|
+
[k: string]: any;
|
|
78
|
+
} & SchemaRef1;
|
|
79
|
+
export type SchemaRef1 = {
|
|
80
|
+
type: "ref";
|
|
81
|
+
value: string;
|
|
82
|
+
[k: string]: any;
|
|
83
|
+
} | {
|
|
84
|
+
type: "object";
|
|
85
|
+
value: {
|
|
86
|
+
[k: string]: SchemaRef;
|
|
87
|
+
};
|
|
88
|
+
[k: string]: any;
|
|
89
|
+
};
|
|
90
|
+
export type SchemaRefValue = {
|
|
91
|
+
type: "ref";
|
|
92
|
+
value: string;
|
|
93
|
+
[k: string]: any;
|
|
94
|
+
} | {
|
|
95
|
+
type: "object";
|
|
96
|
+
value: {
|
|
97
|
+
[k: string]: SchemaRef;
|
|
98
|
+
};
|
|
99
|
+
[k: string]: any;
|
|
100
|
+
};
|
|
63
101
|
/**
|
|
64
|
-
*
|
|
65
|
-
|
|
66
|
-
export type ConversationState = "IN_PROGRESS" | "COMPLETED" | "ERRORED" | "CANCELED";
|
|
67
|
-
/**
|
|
68
|
-
* A common root type. This type is itself not used, but it will allow schema resolution to properly find all of the types in one place.
|
|
102
|
+
* A common root type. This type is itself not used, but it will allow schema resolution to
|
|
103
|
+
* properly find all of the types in one place.
|
|
69
104
|
*/
|
|
70
105
|
export interface ParanetTypes {
|
|
71
106
|
pncp: PncpPacket;
|
|
107
|
+
strategy: SkillMatchStrategy;
|
|
108
|
+
response: MessageResponse;
|
|
72
109
|
callback: PncpCallback;
|
|
110
|
+
schema_ref: SchemaRef;
|
|
111
|
+
schema_ref_value: SchemaRefValue;
|
|
73
112
|
[k: string]: any;
|
|
74
113
|
}
|
|
75
114
|
/**
|
|
76
115
|
* Represents a "skill message" request. All conversations are initiated via a skill request.
|
|
77
116
|
*/
|
|
78
117
|
export interface PncpRequest {
|
|
79
|
-
/**
|
|
80
|
-
* The core body to the request.
|
|
81
|
-
*/
|
|
82
118
|
body: PncpSkillMessage;
|
|
83
119
|
/**
|
|
84
120
|
* Information provided on callback to the actor when a response is received.
|
|
@@ -93,11 +129,11 @@ export interface PncpRequest {
|
|
|
93
129
|
/**
|
|
94
130
|
* Identifying information about who is making the call.
|
|
95
131
|
*/
|
|
96
|
-
author:
|
|
132
|
+
author: string;
|
|
97
133
|
/**
|
|
98
134
|
* Specifies the match strategy.
|
|
99
135
|
*/
|
|
100
|
-
matchStrategy?:
|
|
136
|
+
matchStrategy?: "BEST" | "FIRST" | "STRICT";
|
|
101
137
|
/**
|
|
102
138
|
* Version request spec for the (subject, action) pair.
|
|
103
139
|
*/
|
|
@@ -116,8 +152,28 @@ export interface PncpRequest {
|
|
|
116
152
|
* ID of the medium that made the request.
|
|
117
153
|
*/
|
|
118
154
|
mediumInfo?: PncpRequestMediumInfo | null;
|
|
155
|
+
/**
|
|
156
|
+
* If this is true, a match is required to be made upon the initial request. If it is false, the
|
|
157
|
+
* broker can store the message and conversation in an unmatched state and rematch it at a later
|
|
158
|
+
* time based on later actor availability.
|
|
159
|
+
* If the corresponding skill is a `Broadcast` skill, this field is not considered as they are
|
|
160
|
+
* not matched.
|
|
161
|
+
*/
|
|
162
|
+
mustMatch?: boolean;
|
|
163
|
+
/**
|
|
164
|
+
* If this is true, then this request should use the provided actor lock.
|
|
165
|
+
*/
|
|
166
|
+
useLock?: boolean;
|
|
167
|
+
/**
|
|
168
|
+
* If this is true, then the request can use open networking and search other nodes open nodes on the
|
|
169
|
+
* network for a fulfiller if this node doesn't know of a fulfiller.
|
|
170
|
+
*/
|
|
171
|
+
allowOpenMatch?: boolean;
|
|
119
172
|
[k: string]: any;
|
|
120
173
|
}
|
|
174
|
+
/**
|
|
175
|
+
* The core body to the request.
|
|
176
|
+
*/
|
|
121
177
|
export interface PncpSkillMessage {
|
|
122
178
|
/**
|
|
123
179
|
* Subject of the request.
|
|
@@ -128,6 +184,7 @@ export interface PncpSkillMessage {
|
|
|
128
184
|
*/
|
|
129
185
|
action: string;
|
|
130
186
|
body: any;
|
|
187
|
+
taint?: string | null;
|
|
131
188
|
[k: string]: any;
|
|
132
189
|
}
|
|
133
190
|
export interface PncpRequestMediumInfo {
|
|
@@ -141,6 +198,7 @@ export interface PncpRequestMediumInfo {
|
|
|
141
198
|
export interface PncpMessage {
|
|
142
199
|
id: ConversationId;
|
|
143
200
|
message: PncpMessageBody;
|
|
201
|
+
taint?: string | null;
|
|
144
202
|
[k: string]: any;
|
|
145
203
|
}
|
|
146
204
|
/**
|
|
@@ -171,17 +229,32 @@ export interface PncpAnswerMessage {
|
|
|
171
229
|
/**
|
|
172
230
|
* The ID of the question message being replied to.
|
|
173
231
|
*/
|
|
174
|
-
replyTo:
|
|
232
|
+
replyTo: string;
|
|
175
233
|
data: any;
|
|
176
234
|
[k: string]: any;
|
|
177
235
|
}
|
|
236
|
+
/**
|
|
237
|
+
* Response generated from the paranet in response to an actor making a "MessageRequest".
|
|
238
|
+
*/
|
|
239
|
+
export interface MessageResponse {
|
|
240
|
+
id: ConversationId;
|
|
241
|
+
message_id: Id;
|
|
242
|
+
time_created: string;
|
|
243
|
+
/**
|
|
244
|
+
* Current state of the conversation after this request was made.
|
|
245
|
+
*/
|
|
246
|
+
state: ("IN_PROGRESS" | "COMPLETED" | "ERRORED" | "CANCELED" | "UNMATCHED") | "NETWORKING";
|
|
247
|
+
kind: ResponseKind;
|
|
248
|
+
matched_id?: EntityId | null;
|
|
249
|
+
[k: string]: any;
|
|
250
|
+
}
|
|
178
251
|
/**
|
|
179
252
|
* Skill request sent to an actor from the paranet.
|
|
180
253
|
*/
|
|
181
254
|
export interface PncpRequestCallback {
|
|
182
255
|
id: ConversationId;
|
|
183
256
|
messageId: Id;
|
|
184
|
-
body:
|
|
257
|
+
body: PncpSkillMessage1;
|
|
185
258
|
/**
|
|
186
259
|
* The parent conversation ID, if one exists.
|
|
187
260
|
*/
|
|
@@ -189,15 +262,33 @@ export interface PncpRequestCallback {
|
|
|
189
262
|
timeCreated: string;
|
|
190
263
|
authorId: EntityId;
|
|
191
264
|
/**
|
|
192
|
-
* The actor ID of the receiving actor. This is optional as some skill matches have no targets
|
|
265
|
+
* The actor ID of the receiving actor. This is optional as some skill matches have no targets
|
|
266
|
+
* in the case of a broadcast skill message type.
|
|
193
267
|
*/
|
|
194
268
|
targetActorId?: EntityId | null;
|
|
269
|
+
parameters?: ParameterData;
|
|
195
270
|
/**
|
|
196
|
-
*
|
|
271
|
+
* See pncp.proto CallbackFlags
|
|
197
272
|
*/
|
|
198
|
-
|
|
273
|
+
flags?: number;
|
|
274
|
+
[k: string]: any;
|
|
275
|
+
}
|
|
276
|
+
export interface PncpSkillMessage1 {
|
|
277
|
+
/**
|
|
278
|
+
* Subject of the request.
|
|
279
|
+
*/
|
|
280
|
+
subject: string;
|
|
281
|
+
/**
|
|
282
|
+
* Action of the request.
|
|
283
|
+
*/
|
|
284
|
+
action: string;
|
|
285
|
+
body: any;
|
|
286
|
+
taint?: string | null;
|
|
199
287
|
[k: string]: any;
|
|
200
288
|
}
|
|
289
|
+
/**
|
|
290
|
+
* Additional parameters included with the request. These come from actor/skill templates.
|
|
291
|
+
*/
|
|
201
292
|
export interface ParameterData {
|
|
202
293
|
/**
|
|
203
294
|
* Default to empty values.
|
|
@@ -212,13 +303,14 @@ export interface ParameterData {
|
|
|
212
303
|
[k: string]: any;
|
|
213
304
|
}
|
|
214
305
|
/**
|
|
215
|
-
* In the flow of paranet messages, this is logically a "response" message. The `data` field comes
|
|
306
|
+
* In the flow of paranet messages, this is logically a "response" message. The `data` field comes
|
|
307
|
+
* from the targeted actor whereas others are contextual from the paranet.
|
|
216
308
|
*/
|
|
217
309
|
export interface PncpMessageCallback {
|
|
218
310
|
/**
|
|
219
311
|
* The identifier for the target actor (initiator of the original conversation, typically).
|
|
220
312
|
*/
|
|
221
|
-
id:
|
|
313
|
+
id: string;
|
|
222
314
|
messageId: Id;
|
|
223
315
|
timeCreated: string;
|
|
224
316
|
/**
|
|
@@ -239,7 +331,7 @@ export interface PncpMessageCallback {
|
|
|
239
331
|
/**
|
|
240
332
|
* Any change to the conversation state will be present here.
|
|
241
333
|
*/
|
|
242
|
-
conversationState:
|
|
334
|
+
conversationState: ("IN_PROGRESS" | "COMPLETED" | "ERRORED" | "CANCELED" | "UNMATCHED") | "NETWORKING";
|
|
243
335
|
[k: string]: any;
|
|
244
336
|
}
|
|
245
337
|
//# sourceMappingURL=paranet.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paranet.d.ts","sourceRoot":"","sources":["../../src/schema/paranet.ts"],"names":[],"mappings":"AACA;;;;GAIG;AAEH;;GAEG;AACH,MAAM,MAAM,UAAU,GAClB;IACE,IAAI,EAAE,SAAS,CAAC;IAChB,IAAI,EAAE,WAAW,CAAC;IAClB,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC;CAClB,GACD;IACE,IAAI,EAAE,SAAS,CAAC;IAChB,IAAI,EAAE,WAAW,CAAC;IAClB,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC;CAClB,CAAC;AACN,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC;AACpC,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"paranet.d.ts","sourceRoot":"","sources":["../../src/schema/paranet.ts"],"names":[],"mappings":"AACA;;;;GAIG;AAEH;;GAEG;AACH,MAAM,MAAM,UAAU,GAClB;IACE,IAAI,EAAE,SAAS,CAAC;IAChB,IAAI,EAAE,WAAW,CAAC;IAClB,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC;CAClB,GACD;IACE,IAAI,EAAE,SAAS,CAAC;IAChB,IAAI,EAAE,WAAW,CAAC;IAClB,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC;CAClB,CAAC;AACN,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC;AACpC,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC;AAC/B,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC;AAC9B,MAAM,MAAM,eAAe,GACvB;IACE,IAAI,EAAE,UAAU,CAAC;IACjB,IAAI,EAAE,eAAe,CAAC;IACtB,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC;CAClB,GACD;IACE,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,EAAE,eAAe,CAAC;IACtB,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,C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WAAW,iBAAiB;IAChC;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,GAAG,CAAC;IACV,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC;CAClB;AACD;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,QAAQ,CAAC,EAAE;QACT,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC;KAClB,CAAC;IACF,KAAK,CAAC,EAAE;QACN,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC;KAClB,CAAC;IACF,MAAM,CAAC,EAAE,GAAG,CAAC;IACb,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC;CAClB;AACD;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,EAAE,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,GAAG,CAAC,EAAE;QACJ,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC;KAClB,CAAC;IACF,OAAO,EAAE,WAAW,CAAC;IACrB,MAAM,CAAC,EAAE,GAAG,CAAC;IACb;;OAEG;IACH,QAAQ,CAAC,EAAE;QACT,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC;KAClB,CAAC;IACF,MAAM,CAAC,EAAE,GAAG,CAAC;IACb;;OAEG;IACH,iBAAiB,EAAE,CAAC,aAAa,GAAG,WAAW,GAAG,SAAS,GAAG,UAAU,GAAG,WAAW,CAAC,GAAG,YAAY,CAAC;IACvG,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC;CAClB"}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
package/src/schema/paranet.ts
CHANGED
|
@@ -20,12 +20,8 @@ export type PncpPacket =
|
|
|
20
20
|
[k: string]: any;
|
|
21
21
|
};
|
|
22
22
|
export type ConversationId = string;
|
|
23
|
-
export type EntityId = string;
|
|
24
|
-
/**
|
|
25
|
-
* Determines the match strategy used by the paranet.
|
|
26
|
-
*/
|
|
27
|
-
export type SkillMatchStrategy = "BEST" | "FIRST" | "STRICT";
|
|
28
23
|
export type EntityReq = string;
|
|
24
|
+
export type EntityId = string;
|
|
29
25
|
export type PncpMessageBody =
|
|
30
26
|
| {
|
|
31
27
|
type: "response";
|
|
@@ -57,7 +53,12 @@ export type PncpMessageBody =
|
|
|
57
53
|
body: PncpDataMessage;
|
|
58
54
|
[k: string]: any;
|
|
59
55
|
};
|
|
56
|
+
/**
|
|
57
|
+
* Determines the match strategy used by the paranet.
|
|
58
|
+
*/
|
|
59
|
+
export type SkillMatchStrategy = "BEST" | "FIRST" | "STRICT";
|
|
60
60
|
export type Id = string;
|
|
61
|
+
export type ResponseKind = "MATCH" | "BROADCAST" | "UNMATCHED" | "NETWORKED" | "DATA";
|
|
61
62
|
/**
|
|
62
63
|
* Represents all message types that can be sent from the paranet to an actor.
|
|
63
64
|
*/
|
|
@@ -72,26 +73,65 @@ export type PncpCallback =
|
|
|
72
73
|
body: PncpMessageCallback;
|
|
73
74
|
[k: string]: any;
|
|
74
75
|
};
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
76
|
+
export type SchemaRef = {
|
|
77
|
+
/**
|
|
78
|
+
* Allowed to be empty/not present.
|
|
79
|
+
*/
|
|
80
|
+
optional?: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Indicates that the field should be redacted from the ledger as well as observers.
|
|
83
|
+
*/
|
|
84
|
+
redacted?: boolean;
|
|
85
|
+
/**
|
|
86
|
+
* Indicates that the object can be an array of values.
|
|
87
|
+
*/
|
|
88
|
+
repeated?: boolean;
|
|
89
|
+
[k: string]: any;
|
|
90
|
+
} & SchemaRef1;
|
|
91
|
+
export type SchemaRef1 =
|
|
92
|
+
| {
|
|
93
|
+
type: "ref";
|
|
94
|
+
value: string;
|
|
95
|
+
[k: string]: any;
|
|
96
|
+
}
|
|
97
|
+
| {
|
|
98
|
+
type: "object";
|
|
99
|
+
value: {
|
|
100
|
+
[k: string]: SchemaRef;
|
|
101
|
+
};
|
|
102
|
+
[k: string]: any;
|
|
103
|
+
};
|
|
104
|
+
export type SchemaRefValue =
|
|
105
|
+
| {
|
|
106
|
+
type: "ref";
|
|
107
|
+
value: string;
|
|
108
|
+
[k: string]: any;
|
|
109
|
+
}
|
|
110
|
+
| {
|
|
111
|
+
type: "object";
|
|
112
|
+
value: {
|
|
113
|
+
[k: string]: SchemaRef;
|
|
114
|
+
};
|
|
115
|
+
[k: string]: any;
|
|
116
|
+
};
|
|
79
117
|
|
|
80
118
|
/**
|
|
81
|
-
* A common root type. This type is itself not used, but it will allow schema resolution to
|
|
119
|
+
* A common root type. This type is itself not used, but it will allow schema resolution to
|
|
120
|
+
* properly find all of the types in one place.
|
|
82
121
|
*/
|
|
83
122
|
export interface ParanetTypes {
|
|
84
123
|
pncp: PncpPacket;
|
|
124
|
+
strategy: SkillMatchStrategy;
|
|
125
|
+
response: MessageResponse;
|
|
85
126
|
callback: PncpCallback;
|
|
127
|
+
schema_ref: SchemaRef;
|
|
128
|
+
schema_ref_value: SchemaRefValue;
|
|
86
129
|
[k: string]: any;
|
|
87
130
|
}
|
|
88
131
|
/**
|
|
89
132
|
* Represents a "skill message" request. All conversations are initiated via a skill request.
|
|
90
133
|
*/
|
|
91
134
|
export interface PncpRequest {
|
|
92
|
-
/**
|
|
93
|
-
* The core body to the request.
|
|
94
|
-
*/
|
|
95
135
|
body: PncpSkillMessage;
|
|
96
136
|
/**
|
|
97
137
|
* Information provided on callback to the actor when a response is received.
|
|
@@ -106,11 +146,11 @@ export interface PncpRequest {
|
|
|
106
146
|
/**
|
|
107
147
|
* Identifying information about who is making the call.
|
|
108
148
|
*/
|
|
109
|
-
author:
|
|
149
|
+
author: string;
|
|
110
150
|
/**
|
|
111
151
|
* Specifies the match strategy.
|
|
112
152
|
*/
|
|
113
|
-
matchStrategy?:
|
|
153
|
+
matchStrategy?: "BEST" | "FIRST" | "STRICT";
|
|
114
154
|
/**
|
|
115
155
|
* Version request spec for the (subject, action) pair.
|
|
116
156
|
*/
|
|
@@ -129,8 +169,28 @@ export interface PncpRequest {
|
|
|
129
169
|
* ID of the medium that made the request.
|
|
130
170
|
*/
|
|
131
171
|
mediumInfo?: PncpRequestMediumInfo | null;
|
|
172
|
+
/**
|
|
173
|
+
* If this is true, a match is required to be made upon the initial request. If it is false, the
|
|
174
|
+
* broker can store the message and conversation in an unmatched state and rematch it at a later
|
|
175
|
+
* time based on later actor availability.
|
|
176
|
+
* If the corresponding skill is a `Broadcast` skill, this field is not considered as they are
|
|
177
|
+
* not matched.
|
|
178
|
+
*/
|
|
179
|
+
mustMatch?: boolean;
|
|
180
|
+
/**
|
|
181
|
+
* If this is true, then this request should use the provided actor lock.
|
|
182
|
+
*/
|
|
183
|
+
useLock?: boolean;
|
|
184
|
+
/**
|
|
185
|
+
* If this is true, then the request can use open networking and search other nodes open nodes on the
|
|
186
|
+
* network for a fulfiller if this node doesn't know of a fulfiller.
|
|
187
|
+
*/
|
|
188
|
+
allowOpenMatch?: boolean;
|
|
132
189
|
[k: string]: any;
|
|
133
190
|
}
|
|
191
|
+
/**
|
|
192
|
+
* The core body to the request.
|
|
193
|
+
*/
|
|
134
194
|
export interface PncpSkillMessage {
|
|
135
195
|
/**
|
|
136
196
|
* Subject of the request.
|
|
@@ -141,6 +201,7 @@ export interface PncpSkillMessage {
|
|
|
141
201
|
*/
|
|
142
202
|
action: string;
|
|
143
203
|
body: any;
|
|
204
|
+
taint?: string | null;
|
|
144
205
|
[k: string]: any;
|
|
145
206
|
}
|
|
146
207
|
export interface PncpRequestMediumInfo {
|
|
@@ -154,6 +215,7 @@ export interface PncpRequestMediumInfo {
|
|
|
154
215
|
export interface PncpMessage {
|
|
155
216
|
id: ConversationId;
|
|
156
217
|
message: PncpMessageBody;
|
|
218
|
+
taint?: string | null;
|
|
157
219
|
[k: string]: any;
|
|
158
220
|
}
|
|
159
221
|
/**
|
|
@@ -184,17 +246,32 @@ export interface PncpAnswerMessage {
|
|
|
184
246
|
/**
|
|
185
247
|
* The ID of the question message being replied to.
|
|
186
248
|
*/
|
|
187
|
-
replyTo:
|
|
249
|
+
replyTo: string;
|
|
188
250
|
data: any;
|
|
189
251
|
[k: string]: any;
|
|
190
252
|
}
|
|
253
|
+
/**
|
|
254
|
+
* Response generated from the paranet in response to an actor making a "MessageRequest".
|
|
255
|
+
*/
|
|
256
|
+
export interface MessageResponse {
|
|
257
|
+
id: ConversationId;
|
|
258
|
+
message_id: Id;
|
|
259
|
+
time_created: string;
|
|
260
|
+
/**
|
|
261
|
+
* Current state of the conversation after this request was made.
|
|
262
|
+
*/
|
|
263
|
+
state: ("IN_PROGRESS" | "COMPLETED" | "ERRORED" | "CANCELED" | "UNMATCHED") | "NETWORKING";
|
|
264
|
+
kind: ResponseKind;
|
|
265
|
+
matched_id?: EntityId | null;
|
|
266
|
+
[k: string]: any;
|
|
267
|
+
}
|
|
191
268
|
/**
|
|
192
269
|
* Skill request sent to an actor from the paranet.
|
|
193
270
|
*/
|
|
194
271
|
export interface PncpRequestCallback {
|
|
195
272
|
id: ConversationId;
|
|
196
273
|
messageId: Id;
|
|
197
|
-
body:
|
|
274
|
+
body: PncpSkillMessage1;
|
|
198
275
|
/**
|
|
199
276
|
* The parent conversation ID, if one exists.
|
|
200
277
|
*/
|
|
@@ -202,15 +279,33 @@ export interface PncpRequestCallback {
|
|
|
202
279
|
timeCreated: string;
|
|
203
280
|
authorId: EntityId;
|
|
204
281
|
/**
|
|
205
|
-
* The actor ID of the receiving actor. This is optional as some skill matches have no targets
|
|
282
|
+
* The actor ID of the receiving actor. This is optional as some skill matches have no targets
|
|
283
|
+
* in the case of a broadcast skill message type.
|
|
206
284
|
*/
|
|
207
285
|
targetActorId?: EntityId | null;
|
|
286
|
+
parameters?: ParameterData;
|
|
208
287
|
/**
|
|
209
|
-
*
|
|
288
|
+
* See pncp.proto CallbackFlags
|
|
210
289
|
*/
|
|
211
|
-
|
|
290
|
+
flags?: number;
|
|
291
|
+
[k: string]: any;
|
|
292
|
+
}
|
|
293
|
+
export interface PncpSkillMessage1 {
|
|
294
|
+
/**
|
|
295
|
+
* Subject of the request.
|
|
296
|
+
*/
|
|
297
|
+
subject: string;
|
|
298
|
+
/**
|
|
299
|
+
* Action of the request.
|
|
300
|
+
*/
|
|
301
|
+
action: string;
|
|
302
|
+
body: any;
|
|
303
|
+
taint?: string | null;
|
|
212
304
|
[k: string]: any;
|
|
213
305
|
}
|
|
306
|
+
/**
|
|
307
|
+
* Additional parameters included with the request. These come from actor/skill templates.
|
|
308
|
+
*/
|
|
214
309
|
export interface ParameterData {
|
|
215
310
|
/**
|
|
216
311
|
* Default to empty values.
|
|
@@ -225,13 +320,14 @@ export interface ParameterData {
|
|
|
225
320
|
[k: string]: any;
|
|
226
321
|
}
|
|
227
322
|
/**
|
|
228
|
-
* In the flow of paranet messages, this is logically a "response" message. The `data` field comes
|
|
323
|
+
* In the flow of paranet messages, this is logically a "response" message. The `data` field comes
|
|
324
|
+
* from the targeted actor whereas others are contextual from the paranet.
|
|
229
325
|
*/
|
|
230
326
|
export interface PncpMessageCallback {
|
|
231
327
|
/**
|
|
232
328
|
* The identifier for the target actor (initiator of the original conversation, typically).
|
|
233
329
|
*/
|
|
234
|
-
id:
|
|
330
|
+
id: string;
|
|
235
331
|
messageId: Id;
|
|
236
332
|
timeCreated: string;
|
|
237
333
|
/**
|
|
@@ -252,6 +348,6 @@ export interface PncpMessageCallback {
|
|
|
252
348
|
/**
|
|
253
349
|
* Any change to the conversation state will be present here.
|
|
254
350
|
*/
|
|
255
|
-
conversationState:
|
|
351
|
+
conversationState: ("IN_PROGRESS" | "COMPLETED" | "ERRORED" | "CANCELED" | "UNMATCHED") | "NETWORKING";
|
|
256
352
|
[k: string]: any;
|
|
257
353
|
}
|