@flow-engineer/flow 0.0.1 → 0.2.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.
Files changed (104) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +611 -0
  3. package/coding-agents/skill.md +353 -0
  4. package/coding-agents/test-skill.md +223 -0
  5. package/coding-agents/tools-skill.md +89 -0
  6. package/dist/flow-messaging/src/client.d.ts +40 -0
  7. package/dist/flow-messaging/src/client.js +142 -0
  8. package/dist/flow-messaging/src/index.d.ts +72 -0
  9. package/dist/flow-messaging/src/index.js +605 -0
  10. package/dist/simulators/src/index.d.ts +2 -0
  11. package/dist/simulators/src/index.js +2 -0
  12. package/dist/simulators/src/page.html +1245 -0
  13. package/dist/simulators/src/person.html +100 -0
  14. package/dist/simulators/src/platforms.d.ts +29 -0
  15. package/dist/simulators/src/platforms.js +72 -0
  16. package/dist/simulators/src/server.d.ts +201 -0
  17. package/dist/simulators/src/server.js +759 -0
  18. package/dist/src/agent.d.ts +504 -0
  19. package/dist/src/agent.js +818 -0
  20. package/dist/src/channels.d.ts +178 -0
  21. package/dist/src/channels.js +243 -0
  22. package/dist/src/conversation.d.ts +361 -0
  23. package/dist/src/conversation.js +1487 -0
  24. package/dist/src/db.d.ts +18 -0
  25. package/dist/src/db.js +57 -0
  26. package/dist/src/events.d.ts +17 -0
  27. package/dist/src/events.js +20 -0
  28. package/dist/src/http.d.ts +45 -0
  29. package/dist/src/http.js +269 -0
  30. package/dist/src/index.d.ts +14 -0
  31. package/dist/src/index.js +11 -0
  32. package/dist/src/model.d.ts +21 -0
  33. package/dist/src/model.js +96 -0
  34. package/dist/src/names.d.ts +22 -0
  35. package/dist/src/names.js +43 -0
  36. package/dist/src/nudges.d.ts +23 -0
  37. package/dist/src/nudges.js +117 -0
  38. package/dist/src/postgres.d.ts +20 -0
  39. package/dist/src/postgres.js +62 -0
  40. package/dist/src/schedules.d.ts +60 -0
  41. package/dist/src/schedules.js +249 -0
  42. package/dist/src/skills.d.ts +12 -0
  43. package/dist/src/skills.js +69 -0
  44. package/dist/src/store.d.ts +214 -0
  45. package/dist/src/store.js +448 -0
  46. package/dist/src/talk.d.ts +57 -0
  47. package/dist/src/talk.js +166 -0
  48. package/dist/src/time.d.ts +71 -0
  49. package/dist/src/time.js +170 -0
  50. package/dist/src/tools.d.ts +43 -0
  51. package/dist/src/tools.js +26 -0
  52. package/dist/src/traces.d.ts +31 -0
  53. package/dist/src/traces.js +303 -0
  54. package/dist/src/types.d.ts +260 -0
  55. package/dist/src/types.js +2 -0
  56. package/dist/testing/src/account.d.ts +4 -0
  57. package/dist/testing/src/account.js +580 -0
  58. package/dist/testing/src/chat.d.ts +3 -0
  59. package/dist/testing/src/chat.js +117 -0
  60. package/dist/testing/src/check-endpoint.d.ts +31 -0
  61. package/dist/testing/src/check-endpoint.js +158 -0
  62. package/dist/testing/src/chinwag.d.ts +2 -0
  63. package/dist/testing/src/chinwag.js +6 -0
  64. package/dist/testing/src/cli.d.ts +2 -0
  65. package/dist/testing/src/cli.js +592 -0
  66. package/dist/testing/src/client.d.ts +117 -0
  67. package/dist/testing/src/client.js +956 -0
  68. package/dist/testing/src/flow-login.d.ts +143 -0
  69. package/dist/testing/src/flow-login.js +249 -0
  70. package/dist/testing/src/http-agent.d.ts +47 -0
  71. package/dist/testing/src/http-agent.js +155 -0
  72. package/dist/testing/src/index.d.ts +3 -0
  73. package/dist/testing/src/index.js +2 -0
  74. package/dist/testing/src/new.d.ts +13 -0
  75. package/dist/testing/src/new.js +147 -0
  76. package/dist/testing/src/print-run.d.ts +3 -0
  77. package/dist/testing/src/print-run.js +22 -0
  78. package/dist/testing/src/protocol.d.ts +159 -0
  79. package/dist/testing/src/protocol.js +28 -0
  80. package/dist/testing/src/report.d.ts +74 -0
  81. package/dist/testing/src/report.js +90 -0
  82. package/dist/testing/src/show.d.ts +36 -0
  83. package/dist/testing/src/show.js +280 -0
  84. package/dist/testing/src/suite.d.ts +87 -0
  85. package/dist/testing/src/suite.js +198 -0
  86. package/docs/agents.md +85 -0
  87. package/examples/cafe/agent/AGENTS.md +10 -0
  88. package/examples/cafe/agent/skills/allergens/SKILL.md +7 -0
  89. package/examples/cafe/src/agent.ts +43 -0
  90. package/examples/cafe/src/channels.ts +20 -0
  91. package/examples/cafe/src/main.ts +30 -0
  92. package/examples/cafe/src/tools.ts +62 -0
  93. package/examples/cafe/tests/scenarios/latte-correction.yaml +30 -0
  94. package/examples/cafe/tests/scenarios/order-fails.yaml +26 -0
  95. package/examples/cafe/tests/tools/get_menu.yaml +14 -0
  96. package/examples/cafe/tests/tools/place_order.yaml +29 -0
  97. package/examples/http-agent/server.mjs +32 -0
  98. package/examples/http-agent/tests/scenarios/opening-hours.yaml +16 -0
  99. package/flow-messaging/README.md +191 -0
  100. package/package.json +63 -8
  101. package/spec/agent-endpoint.openapi.yaml +148 -0
  102. package/spec/nudges.openapi.yaml +167 -0
  103. package/spec/request.schema.json +121 -0
  104. package/spec/response.schema.json +284 -0
@@ -0,0 +1,284 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://github.com/flow-engineer/flow/blob/main/spec/response.schema.json",
4
+ "title": "AgentResponse",
5
+ "description": "The agent's answer to one message: status 200, content-type application/json, the replies to send, in order. An empty list sends nothing. Keys other than `replies` are ignored.",
6
+ "type": "object",
7
+ "required": [
8
+ "replies"
9
+ ],
10
+ "properties": {
11
+ "replies": {
12
+ "type": "array",
13
+ "description": "Sent to the person one after another. Each is checked on its own against what the run's platform can show (see x-chinwag-platforms in agent-endpoint.openapi.yaml): one that does not fit is not sent and the run says why; the others still go.",
14
+ "items": {
15
+ "oneOf": [
16
+ {
17
+ "$ref": "#/$defs/message"
18
+ },
19
+ {
20
+ "$ref": "#/$defs/read"
21
+ },
22
+ {
23
+ "$ref": "#/$defs/reaction"
24
+ },
25
+ {
26
+ "$ref": "#/$defs/template"
27
+ },
28
+ {
29
+ "$ref": "#/$defs/status"
30
+ },
31
+ {
32
+ "$ref": "#/$defs/typing"
33
+ }
34
+ ]
35
+ }
36
+ }
37
+ },
38
+ "$defs": {
39
+ "message": {
40
+ "description": "A message to the person. Only the keys below: any other key is refused as something the platform does not show. Not allowed together: `link` with `buttons` or `list`; `image` with `list`. With `image`, `text` is its caption.",
41
+ "type": "object",
42
+ "required": [
43
+ "type",
44
+ "text"
45
+ ],
46
+ "additionalProperties": false,
47
+ "properties": {
48
+ "type": {
49
+ "const": "message"
50
+ },
51
+ "text": {
52
+ "type": "string",
53
+ "minLength": 1,
54
+ "maxLength": 4096,
55
+ "description": "At most the platform's maxLength (4,000 where it sets none)."
56
+ },
57
+ "replyTo": {
58
+ "type": "string",
59
+ "description": "Quote one of the person's messages, by its messageId (such as m3). Platforms with replies only."
60
+ },
61
+ "buttons": {
62
+ "type": "array",
63
+ "description": "Reply buttons; a tap comes back as the person's message, with `choice`. Platforms with buttons only, within their max and labelMax.",
64
+ "items": {
65
+ "type": "string",
66
+ "minLength": 1
67
+ }
68
+ },
69
+ "list": {
70
+ "type": "object",
71
+ "description": "A list the person picks one row from; the pick comes back with `choice`. Platforms with lists only, within their maxRows, titleMax and buttonMax.",
72
+ "required": [
73
+ "button",
74
+ "rows"
75
+ ],
76
+ "properties": {
77
+ "button": {
78
+ "type": "string",
79
+ "minLength": 1,
80
+ "description": "The label that opens the list."
81
+ },
82
+ "rows": {
83
+ "type": "array",
84
+ "minItems": 1,
85
+ "items": {
86
+ "type": "object",
87
+ "required": [
88
+ "id",
89
+ "title"
90
+ ],
91
+ "properties": {
92
+ "id": {
93
+ "type": "string",
94
+ "minLength": 1,
95
+ "maxLength": 64
96
+ },
97
+ "title": {
98
+ "type": "string",
99
+ "minLength": 1
100
+ },
101
+ "description": {
102
+ "type": "string",
103
+ "maxLength": 72
104
+ }
105
+ }
106
+ }
107
+ }
108
+ }
109
+ },
110
+ "link": {
111
+ "type": "object",
112
+ "description": "A page by https URL: a button where the platform has linkButton (label within its labelMax), else the URL goes on a line after the text (label at most 20 characters).",
113
+ "required": [
114
+ "label",
115
+ "url"
116
+ ],
117
+ "properties": {
118
+ "label": {
119
+ "type": "string",
120
+ "minLength": 1
121
+ },
122
+ "url": {
123
+ "type": "string",
124
+ "pattern": "^https://[^\\s/?#]+"
125
+ }
126
+ }
127
+ },
128
+ "image": {
129
+ "type": "object",
130
+ "description": "A photo by https URL, `text` its caption (within the platform's captionMax). Where the platform has no images, the text goes alone.",
131
+ "required": [
132
+ "url"
133
+ ],
134
+ "properties": {
135
+ "url": {
136
+ "type": "string",
137
+ "pattern": "^https://[^\\s/?#]+"
138
+ }
139
+ }
140
+ },
141
+ "fields": {
142
+ "type": "object",
143
+ "description": "The channel's own parameters, passed on as they are."
144
+ }
145
+ }
146
+ },
147
+ "read": {
148
+ "description": "The agent has picked these messages up (read receipts, where the platform shows them).",
149
+ "type": "object",
150
+ "required": [
151
+ "type",
152
+ "messageIds"
153
+ ],
154
+ "properties": {
155
+ "type": {
156
+ "const": "read"
157
+ },
158
+ "messageIds": {
159
+ "type": "array",
160
+ "items": {
161
+ "type": "string"
162
+ }
163
+ }
164
+ }
165
+ },
166
+ "reaction": {
167
+ "description": "An emoji reaction on one of the person's messages, by its messageId (platforms with reactions).",
168
+ "type": "object",
169
+ "required": [
170
+ "type",
171
+ "emoji",
172
+ "messageId"
173
+ ],
174
+ "properties": {
175
+ "type": {
176
+ "const": "reaction"
177
+ },
178
+ "emoji": {
179
+ "type": "string",
180
+ "minLength": 1
181
+ },
182
+ "messageId": {
183
+ "type": "string",
184
+ "minLength": 1
185
+ }
186
+ }
187
+ },
188
+ "template": {
189
+ "description": "A WhatsApp template the owner set up, sent as is, even outside the 24-hour window. Other keys are passed on.",
190
+ "type": "object",
191
+ "required": [
192
+ "type",
193
+ "name"
194
+ ],
195
+ "properties": {
196
+ "type": {
197
+ "const": "template"
198
+ },
199
+ "name": {
200
+ "type": "string",
201
+ "minLength": 1,
202
+ "description": "Its name as approved."
203
+ },
204
+ "language": {
205
+ "type": "string",
206
+ "description": "Such as en, en_US, hi."
207
+ },
208
+ "header": {
209
+ "type": "object",
210
+ "description": "{ kind: text, text } or { kind: image | video | document, url? or fileId? }."
211
+ },
212
+ "body": {
213
+ "type": "array",
214
+ "items": {
215
+ "type": "string"
216
+ },
217
+ "description": "Values for the body's {{1}}, {{2}}, ... in order."
218
+ },
219
+ "buttons": {
220
+ "type": "array",
221
+ "description": "Values for the buttons that take one, by position from 0.",
222
+ "items": {
223
+ "type": "object",
224
+ "required": [
225
+ "index",
226
+ "value"
227
+ ],
228
+ "properties": {
229
+ "index": {
230
+ "type": "integer",
231
+ "minimum": 0
232
+ },
233
+ "value": {
234
+ "type": "string"
235
+ }
236
+ }
237
+ }
238
+ },
239
+ "variables": {
240
+ "type": "object",
241
+ "additionalProperties": {
242
+ "type": "string"
243
+ },
244
+ "description": "The body's values by number ({ \"1\": \"Maria\" }), the older form of `body`."
245
+ }
246
+ }
247
+ },
248
+ "status": {
249
+ "description": "A short line of what the agent is doing, in the loading indicator (platforms with status); null clears it.",
250
+ "type": "object",
251
+ "required": [
252
+ "type",
253
+ "text"
254
+ ],
255
+ "properties": {
256
+ "type": {
257
+ "const": "status"
258
+ },
259
+ "text": {
260
+ "type": [
261
+ "string",
262
+ "null"
263
+ ]
264
+ }
265
+ }
266
+ },
267
+ "typing": {
268
+ "description": "Show or stop the typing indicator.",
269
+ "type": "object",
270
+ "required": [
271
+ "type",
272
+ "on"
273
+ ],
274
+ "properties": {
275
+ "type": {
276
+ "const": "typing"
277
+ },
278
+ "on": {
279
+ "type": "boolean"
280
+ }
281
+ }
282
+ }
283
+ }
284
+ }