abstractnote 0.1.0__py3-none-any.whl

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 (80) hide show
  1. abstractnote/__init__.py +18 -0
  2. abstractnote/cli.py +240 -0
  3. abstractnote/flows/__init__.py +2 -0
  4. abstractnote/flows/build.py +970 -0
  5. abstractnote/flows/bundle.py +62 -0
  6. abstractnote/flows/contract.py +88 -0
  7. abstractnote/flows/graph.py +540 -0
  8. abstractnote/flows/json/note-capture.json +2280 -0
  9. abstractnote/flows/json/note-drain.json +2012 -0
  10. abstractnote/flows/json/note-mine.json +2392 -0
  11. abstractnote/flows/json/note-process.json +1853 -0
  12. abstractnote/flows/json/note-recall.json +1876 -0
  13. abstractnote/flows/json/note-reflect.json +2057 -0
  14. abstractnote/flows/prompts_fallback.py +119 -0
  15. abstractnote/flows/runner.py +320 -0
  16. abstractnote/flows/schemas_fallback.py +175 -0
  17. abstractnote/gateway/__init__.py +24 -0
  18. abstractnote/gateway/appspec.py +10 -0
  19. abstractnote/gateway/router.py +571 -0
  20. abstractnote/gateway/tools.py +74 -0
  21. abstractnote/ids.py +177 -0
  22. abstractnote/importers/__init__.py +142 -0
  23. abstractnote/importers/__main__.py +3 -0
  24. abstractnote/importers/agora.py +203 -0
  25. abstractnote/importers/claude_sessions.py +415 -0
  26. abstractnote/importers/cli.py +113 -0
  27. abstractnote/importers/files.py +72 -0
  28. abstractnote/importers/markdown.py +165 -0
  29. abstractnote/ingest/__init__.py +7 -0
  30. abstractnote/ingest/blobs.py +47 -0
  31. abstractnote/ingest/capture.py +265 -0
  32. abstractnote/ingest/extract.py +118 -0
  33. abstractnote/ingest/normalise.py +95 -0
  34. abstractnote/model.py +229 -0
  35. abstractnote/process/__init__.py +5 -0
  36. abstractnote/process/context.py +218 -0
  37. abstractnote/process/merge.py +60 -0
  38. abstractnote/process/prompts/__init__.py +39 -0
  39. abstractnote/process/prompts/extract.md +30 -0
  40. abstractnote/process/prompts/link.md +32 -0
  41. abstractnote/process/prompts/mine_dossier.md +13 -0
  42. abstractnote/process/prompts/mine_findings.md +13 -0
  43. abstractnote/process/prompts/mine_plan.md +13 -0
  44. abstractnote/process/prompts/quick_filing.md +23 -0
  45. abstractnote/process/prompts/reflect.md +10 -0
  46. abstractnote/process/prompts/synthesize.md +17 -0
  47. abstractnote/process/resolve.py +96 -0
  48. abstractnote/process/revise.py +410 -0
  49. abstractnote/process/schemas.py +377 -0
  50. abstractnote/process/vocabulary.py +68 -0
  51. abstractnote/recall/__init__.py +1 -0
  52. abstractnote/recall/changes.py +191 -0
  53. abstractnote/recall/expand.py +379 -0
  54. abstractnote/recall/insights.py +62 -0
  55. abstractnote/recall/reflect.py +202 -0
  56. abstractnote/recall/review.py +191 -0
  57. abstractnote/recall/search.py +205 -0
  58. abstractnote/recall/shapes.py +52 -0
  59. abstractnote/recall/then_now.py +100 -0
  60. abstractnote/store/__init__.py +12 -0
  61. abstractnote/store/archive.py +166 -0
  62. abstractnote/store/embeddings.py +275 -0
  63. abstractnote/store/kg.py +219 -0
  64. abstractnote/store/notebook.py +829 -0
  65. abstractnote/store/notes.py +1190 -0
  66. abstractnote/store/queue.py +159 -0
  67. abstractnote/store/schema.py +348 -0
  68. abstractnote/store/vector_index.py +88 -0
  69. abstractnote/tools/__init__.py +215 -0
  70. abstractnote/tools/capture.py +121 -0
  71. abstractnote/tools/context.py +19 -0
  72. abstractnote/tools/process.py +22 -0
  73. abstractnote/tools/queue.py +23 -0
  74. abstractnote/tools/recall.py +64 -0
  75. abstractnote-0.1.0.dist-info/METADATA +145 -0
  76. abstractnote-0.1.0.dist-info/RECORD +80 -0
  77. abstractnote-0.1.0.dist-info/WHEEL +5 -0
  78. abstractnote-0.1.0.dist-info/entry_points.txt +2 -0
  79. abstractnote-0.1.0.dist-info/licenses/LICENSE +21 -0
  80. abstractnote-0.1.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,2012 @@
1
+ {
2
+ "id": "note-drain",
3
+ "name": "Process queued notes",
4
+ "description": "Take queued notes by priority and understand them one at a time, within a count and time budget.",
5
+ "interfaces": [
6
+ "abstractnote.drain.v1"
7
+ ],
8
+ "nodes": [
9
+ {
10
+ "id": "start",
11
+ "type": "on_flow_start",
12
+ "position": {
13
+ "x": 0.0,
14
+ "y": 0.0
15
+ },
16
+ "data": {
17
+ "nodeType": "on_flow_start",
18
+ "label": "Start",
19
+ "inputs": [],
20
+ "outputs": [
21
+ {
22
+ "id": "exec-out",
23
+ "label": "",
24
+ "type": "execution"
25
+ },
26
+ {
27
+ "id": "max_items",
28
+ "label": "max_items",
29
+ "type": "number"
30
+ },
31
+ {
32
+ "id": "budget_s",
33
+ "label": "budget_s",
34
+ "type": "number"
35
+ },
36
+ {
37
+ "id": "provider",
38
+ "label": "provider",
39
+ "type": "provider_text"
40
+ },
41
+ {
42
+ "id": "model",
43
+ "label": "model",
44
+ "type": "model"
45
+ }
46
+ ],
47
+ "pinDefaults": {
48
+ "max_items": 20,
49
+ "budget_s": 90,
50
+ "provider": "",
51
+ "model": ""
52
+ }
53
+ }
54
+ },
55
+ {
56
+ "id": "init",
57
+ "type": "code",
58
+ "position": {
59
+ "x": 480.0,
60
+ "y": 0.0
61
+ },
62
+ "data": {
63
+ "nodeType": "code",
64
+ "label": "Budget",
65
+ "inputs": [
66
+ {
67
+ "id": "exec-in",
68
+ "label": "",
69
+ "type": "execution"
70
+ },
71
+ {
72
+ "id": "max_items",
73
+ "label": "max_items",
74
+ "type": "number"
75
+ },
76
+ {
77
+ "id": "budget_s",
78
+ "label": "budget_s",
79
+ "type": "number"
80
+ },
81
+ {
82
+ "id": "permissions",
83
+ "label": "permissions",
84
+ "type": "string"
85
+ }
86
+ ],
87
+ "outputs": [
88
+ {
89
+ "id": "exec-out",
90
+ "label": "",
91
+ "type": "execution"
92
+ },
93
+ {
94
+ "id": "updates",
95
+ "label": "updates",
96
+ "type": "object"
97
+ }
98
+ ],
99
+ "pinDefaults": {
100
+ "permissions": "sandbox"
101
+ },
102
+ "functionName": "transform",
103
+ "codeBody": "import time\nleft = int(max_items if max_items is not None else 20)\nif left < 1:\n raise ValueError(\"max_items must be at least 1.\")\nbudget = float(budget_s if budget_s is not None else 90)\nnow = time.time()\nreturn {\"updates\": {\"drain_deadline\": now + budget, \"drain_left\": left, \"drain_continue\": True,\n \"drain_processed\": 0, \"drain_failed\": 0, \"drain_errors\": [],\n \"drain_worker\": \"drain-\" + str(int(now * 1000))}}\n"
104
+ }
105
+ },
106
+ {
107
+ "id": "init_vars",
108
+ "type": "set_vars",
109
+ "position": {
110
+ "x": 960.0,
111
+ "y": 0.0
112
+ },
113
+ "data": {
114
+ "nodeType": "set_vars",
115
+ "label": "Remember the budget",
116
+ "inputs": [
117
+ {
118
+ "id": "exec-in",
119
+ "label": "",
120
+ "type": "execution"
121
+ },
122
+ {
123
+ "id": "updates",
124
+ "label": "updates",
125
+ "type": "object"
126
+ }
127
+ ],
128
+ "outputs": [
129
+ {
130
+ "id": "exec-out",
131
+ "label": "",
132
+ "type": "execution"
133
+ },
134
+ {
135
+ "id": "updates",
136
+ "label": "updates",
137
+ "type": "object"
138
+ }
139
+ ]
140
+ }
141
+ },
142
+ {
143
+ "id": "continue",
144
+ "type": "get_var",
145
+ "position": {
146
+ "x": 960.0,
147
+ "y": 320.0
148
+ },
149
+ "data": {
150
+ "nodeType": "get_var",
151
+ "label": "Get drain_continue",
152
+ "inputs": [
153
+ {
154
+ "id": "name",
155
+ "label": "name",
156
+ "type": "string"
157
+ },
158
+ {
159
+ "id": "default",
160
+ "label": "default",
161
+ "type": "any"
162
+ }
163
+ ],
164
+ "outputs": [
165
+ {
166
+ "id": "value",
167
+ "label": "value",
168
+ "type": "any"
169
+ }
170
+ ],
171
+ "pinDefaults": {
172
+ "name": "drain_continue",
173
+ "default": false
174
+ }
175
+ }
176
+ },
177
+ {
178
+ "id": "drain_loop",
179
+ "type": "while",
180
+ "position": {
181
+ "x": 1440.0,
182
+ "y": 0.0
183
+ },
184
+ "data": {
185
+ "nodeType": "while",
186
+ "label": "While there is budget",
187
+ "inputs": [
188
+ {
189
+ "id": "exec-in",
190
+ "label": "",
191
+ "type": "execution"
192
+ },
193
+ {
194
+ "id": "condition",
195
+ "label": "condition",
196
+ "type": "boolean"
197
+ }
198
+ ],
199
+ "outputs": [
200
+ {
201
+ "id": "loop",
202
+ "label": "loop",
203
+ "type": "execution"
204
+ },
205
+ {
206
+ "id": "done",
207
+ "label": "done",
208
+ "type": "execution"
209
+ },
210
+ {
211
+ "id": "index",
212
+ "label": "index",
213
+ "type": "number"
214
+ },
215
+ {
216
+ "id": "item",
217
+ "label": "item",
218
+ "type": "any"
219
+ }
220
+ ]
221
+ }
222
+ },
223
+ {
224
+ "id": "worker",
225
+ "type": "get_var",
226
+ "position": {
227
+ "x": 1440.0,
228
+ "y": 320.0
229
+ },
230
+ "data": {
231
+ "nodeType": "get_var",
232
+ "label": "Get drain_worker",
233
+ "inputs": [
234
+ {
235
+ "id": "name",
236
+ "label": "name",
237
+ "type": "string"
238
+ },
239
+ {
240
+ "id": "default",
241
+ "label": "default",
242
+ "type": "any"
243
+ }
244
+ ],
245
+ "outputs": [
246
+ {
247
+ "id": "value",
248
+ "label": "value",
249
+ "type": "any"
250
+ }
251
+ ],
252
+ "pinDefaults": {
253
+ "name": "drain_worker",
254
+ "default": ""
255
+ }
256
+ }
257
+ },
258
+ {
259
+ "id": "lease_args",
260
+ "type": "code",
261
+ "position": {
262
+ "x": 1920.0,
263
+ "y": 0.0
264
+ },
265
+ "data": {
266
+ "nodeType": "code",
267
+ "label": "Take the next note: arguments",
268
+ "inputs": [
269
+ {
270
+ "id": "exec-in",
271
+ "label": "",
272
+ "type": "execution"
273
+ },
274
+ {
275
+ "id": "worker_id",
276
+ "label": "worker_id",
277
+ "type": "string"
278
+ },
279
+ {
280
+ "id": "max_items",
281
+ "label": "max_items",
282
+ "type": "number"
283
+ },
284
+ {
285
+ "id": "permissions",
286
+ "label": "permissions",
287
+ "type": "string"
288
+ }
289
+ ],
290
+ "outputs": [
291
+ {
292
+ "id": "exec-out",
293
+ "label": "",
294
+ "type": "execution"
295
+ },
296
+ {
297
+ "id": "tool_calls",
298
+ "label": "tool_calls",
299
+ "type": "array"
300
+ }
301
+ ],
302
+ "pinDefaults": {
303
+ "permissions": "sandbox",
304
+ "max_items": 1
305
+ },
306
+ "functionName": "transform",
307
+ "codeBody": "arguments = {}\nif worker_id is not None and worker_id != \"\":\n arguments[\"worker_id\"] = worker_id\nif max_items is not None and max_items != \"\":\n arguments[\"max_items\"] = max_items\nreturn {\"tool_calls\": [{\"name\": \"note_queue_lease\", \"call_id\": \"lease\", \"arguments\": arguments}]}\n"
308
+ }
309
+ },
310
+ {
311
+ "id": "lease",
312
+ "type": "tool_calls",
313
+ "position": {
314
+ "x": 2400.0,
315
+ "y": 0.0
316
+ },
317
+ "data": {
318
+ "nodeType": "tool_calls",
319
+ "label": "Take the next note",
320
+ "inputs": [
321
+ {
322
+ "id": "exec-in",
323
+ "label": "",
324
+ "type": "execution"
325
+ },
326
+ {
327
+ "id": "tool_calls",
328
+ "label": "tool_calls",
329
+ "type": "array"
330
+ },
331
+ {
332
+ "id": "allowed_tools",
333
+ "label": "allowed_tools",
334
+ "type": "array"
335
+ }
336
+ ],
337
+ "outputs": [
338
+ {
339
+ "id": "exec-out",
340
+ "label": "",
341
+ "type": "execution"
342
+ },
343
+ {
344
+ "id": "results",
345
+ "label": "results",
346
+ "type": "array"
347
+ },
348
+ {
349
+ "id": "success",
350
+ "label": "success",
351
+ "type": "boolean"
352
+ }
353
+ ],
354
+ "pinDefaults": {
355
+ "allowed_tools": [
356
+ "note_queue_lease"
357
+ ]
358
+ },
359
+ "effectConfig": {
360
+ "allowed_tools": [
361
+ "note_queue_lease"
362
+ ]
363
+ }
364
+ }
365
+ },
366
+ {
367
+ "id": "lease_out",
368
+ "type": "code",
369
+ "position": {
370
+ "x": 2880.0,
371
+ "y": 0.0
372
+ },
373
+ "data": {
374
+ "nodeType": "code",
375
+ "label": "Take the next note: result",
376
+ "inputs": [
377
+ {
378
+ "id": "exec-in",
379
+ "label": "",
380
+ "type": "execution"
381
+ },
382
+ {
383
+ "id": "results",
384
+ "label": "results",
385
+ "type": "array"
386
+ },
387
+ {
388
+ "id": "permissions",
389
+ "label": "permissions",
390
+ "type": "string"
391
+ }
392
+ ],
393
+ "outputs": [
394
+ {
395
+ "id": "exec-out",
396
+ "label": "",
397
+ "type": "execution"
398
+ },
399
+ {
400
+ "id": "items",
401
+ "label": "items",
402
+ "type": "array"
403
+ },
404
+ {
405
+ "id": "tool_output",
406
+ "label": "tool_output",
407
+ "type": "object"
408
+ },
409
+ {
410
+ "id": "failed",
411
+ "label": "failed",
412
+ "type": "boolean"
413
+ },
414
+ {
415
+ "id": "failure",
416
+ "label": "failure",
417
+ "type": "string"
418
+ }
419
+ ],
420
+ "pinDefaults": {
421
+ "permissions": "sandbox"
422
+ },
423
+ "functionName": "transform",
424
+ "codeBody": "r = results[0] if isinstance(results, list) and results else None\nfailure = None\nout = None\nif not isinstance(r, dict):\n failure = \"note_queue_lease returned no result.\"\nelif not r.get(\"success\"):\n failure = str(r.get(\"error\") or \"note_queue_lease failed.\")\nelse:\n out = r.get(\"output\")\n if not isinstance(out, dict):\n failure = \"note_queue_lease returned something other than an object.\"\nif failure is not None:\n return {\"failed\": True, \"failure\": failure}\nreturn dict(out, tool_output=out, failed=False, failure=None)\n"
425
+ }
426
+ },
427
+ {
428
+ "id": "lease_failed",
429
+ "type": "if",
430
+ "position": {
431
+ "x": 3360.0,
432
+ "y": 0.0
433
+ },
434
+ "data": {
435
+ "nodeType": "if",
436
+ "label": "Take the next note: failed?",
437
+ "inputs": [
438
+ {
439
+ "id": "exec-in",
440
+ "label": "",
441
+ "type": "execution"
442
+ },
443
+ {
444
+ "id": "condition",
445
+ "label": "condition",
446
+ "type": "boolean"
447
+ }
448
+ ],
449
+ "outputs": [
450
+ {
451
+ "id": "true",
452
+ "label": "true",
453
+ "type": "execution"
454
+ },
455
+ {
456
+ "id": "false",
457
+ "label": "false",
458
+ "type": "execution"
459
+ }
460
+ ]
461
+ }
462
+ },
463
+ {
464
+ "id": "lease_stopped",
465
+ "type": "on_flow_end",
466
+ "position": {
467
+ "x": 3840.0,
468
+ "y": 0.0
469
+ },
470
+ "data": {
471
+ "nodeType": "on_flow_end",
472
+ "label": "Stopped: take the next note failed",
473
+ "inputs": [
474
+ {
475
+ "id": "exec-in",
476
+ "label": "",
477
+ "type": "execution"
478
+ },
479
+ {
480
+ "id": "response",
481
+ "label": "response",
482
+ "type": "string"
483
+ },
484
+ {
485
+ "id": "error",
486
+ "label": "error",
487
+ "type": "string"
488
+ },
489
+ {
490
+ "id": "success",
491
+ "label": "success",
492
+ "type": "boolean"
493
+ }
494
+ ],
495
+ "outputs": [],
496
+ "pinDefaults": {
497
+ "success": false
498
+ }
499
+ }
500
+ },
501
+ {
502
+ "id": "pick",
503
+ "type": "code",
504
+ "position": {
505
+ "x": 3840.0,
506
+ "y": 320.0
507
+ },
508
+ "data": {
509
+ "nodeType": "code",
510
+ "label": "Next note",
511
+ "inputs": [
512
+ {
513
+ "id": "exec-in",
514
+ "label": "",
515
+ "type": "execution"
516
+ },
517
+ {
518
+ "id": "items",
519
+ "label": "items",
520
+ "type": "array"
521
+ },
522
+ {
523
+ "id": "permissions",
524
+ "label": "permissions",
525
+ "type": "string"
526
+ }
527
+ ],
528
+ "outputs": [
529
+ {
530
+ "id": "exec-out",
531
+ "label": "",
532
+ "type": "execution"
533
+ },
534
+ {
535
+ "id": "has_item",
536
+ "label": "has_item",
537
+ "type": "boolean"
538
+ },
539
+ {
540
+ "id": "note_id",
541
+ "label": "note_id",
542
+ "type": "string"
543
+ }
544
+ ],
545
+ "pinDefaults": {
546
+ "permissions": "sandbox"
547
+ },
548
+ "functionName": "transform",
549
+ "codeBody": "first = items[0] if isinstance(items, list) and items else None\nreturn {\"has_item\": isinstance(first, dict), \"note_id\": first.get(\"note_id\") if isinstance(first, dict) else None}\n"
550
+ }
551
+ },
552
+ {
553
+ "id": "has_item",
554
+ "type": "if",
555
+ "position": {
556
+ "x": 4320.0,
557
+ "y": 0.0
558
+ },
559
+ "data": {
560
+ "nodeType": "if",
561
+ "label": "Anything queued?",
562
+ "inputs": [
563
+ {
564
+ "id": "exec-in",
565
+ "label": "",
566
+ "type": "execution"
567
+ },
568
+ {
569
+ "id": "condition",
570
+ "label": "condition",
571
+ "type": "boolean"
572
+ }
573
+ ],
574
+ "outputs": [
575
+ {
576
+ "id": "true",
577
+ "label": "true",
578
+ "type": "execution"
579
+ },
580
+ {
581
+ "id": "false",
582
+ "label": "false",
583
+ "type": "execution"
584
+ }
585
+ ]
586
+ }
587
+ },
588
+ {
589
+ "id": "stop",
590
+ "type": "set_var",
591
+ "position": {
592
+ "x": 4800.0,
593
+ "y": 0.0
594
+ },
595
+ "data": {
596
+ "nodeType": "set_var",
597
+ "label": "Stop: queue empty",
598
+ "inputs": [
599
+ {
600
+ "id": "exec-in",
601
+ "label": "",
602
+ "type": "execution"
603
+ },
604
+ {
605
+ "id": "name",
606
+ "label": "name",
607
+ "type": "string"
608
+ },
609
+ {
610
+ "id": "value",
611
+ "label": "value",
612
+ "type": "any"
613
+ }
614
+ ],
615
+ "outputs": [
616
+ {
617
+ "id": "exec-out",
618
+ "label": "",
619
+ "type": "execution"
620
+ },
621
+ {
622
+ "id": "value",
623
+ "label": "value",
624
+ "type": "any"
625
+ }
626
+ ],
627
+ "pinDefaults": {
628
+ "name": "drain_continue",
629
+ "value": false
630
+ }
631
+ }
632
+ },
633
+ {
634
+ "id": "process",
635
+ "type": "subflow",
636
+ "position": {
637
+ "x": 4800.0,
638
+ "y": 320.0
639
+ },
640
+ "data": {
641
+ "nodeType": "subflow",
642
+ "label": "Understand the note",
643
+ "inputs": [
644
+ {
645
+ "id": "exec-in",
646
+ "label": "",
647
+ "type": "execution"
648
+ },
649
+ {
650
+ "id": "inherit_context",
651
+ "label": "inherit_context",
652
+ "type": "boolean"
653
+ },
654
+ {
655
+ "id": "note_id",
656
+ "label": "note_id",
657
+ "type": "string"
658
+ },
659
+ {
660
+ "id": "provider",
661
+ "label": "provider",
662
+ "type": "provider_text"
663
+ },
664
+ {
665
+ "id": "model",
666
+ "label": "model",
667
+ "type": "model"
668
+ }
669
+ ],
670
+ "outputs": [
671
+ {
672
+ "id": "exec-out",
673
+ "label": "",
674
+ "type": "execution"
675
+ },
676
+ {
677
+ "id": "output",
678
+ "label": "output",
679
+ "type": "object"
680
+ },
681
+ {
682
+ "id": "child_output",
683
+ "label": "child_output",
684
+ "type": "object"
685
+ },
686
+ {
687
+ "id": "revision_id",
688
+ "label": "revision_id",
689
+ "type": "string"
690
+ }
691
+ ],
692
+ "pinDefaults": {
693
+ "inherit_context": false
694
+ },
695
+ "subflowId": "note-process"
696
+ }
697
+ },
698
+ {
699
+ "id": "outcome",
700
+ "type": "code",
701
+ "position": {
702
+ "x": 5280.0,
703
+ "y": 0.0
704
+ },
705
+ "data": {
706
+ "nodeType": "code",
707
+ "label": "Outcome",
708
+ "inputs": [
709
+ {
710
+ "id": "exec-in",
711
+ "label": "",
712
+ "type": "execution"
713
+ },
714
+ {
715
+ "id": "output",
716
+ "label": "output",
717
+ "type": "object"
718
+ },
719
+ {
720
+ "id": "child_output",
721
+ "label": "child_output",
722
+ "type": "object"
723
+ },
724
+ {
725
+ "id": "permissions",
726
+ "label": "permissions",
727
+ "type": "string"
728
+ }
729
+ ],
730
+ "outputs": [
731
+ {
732
+ "id": "exec-out",
733
+ "label": "",
734
+ "type": "execution"
735
+ },
736
+ {
737
+ "id": "outcome",
738
+ "label": "outcome",
739
+ "type": "string"
740
+ },
741
+ {
742
+ "id": "failure",
743
+ "label": "failure",
744
+ "type": "string"
745
+ },
746
+ {
747
+ "id": "revision_id",
748
+ "label": "revision_id",
749
+ "type": "string"
750
+ }
751
+ ],
752
+ "pinDefaults": {
753
+ "permissions": "sandbox"
754
+ },
755
+ "functionName": "transform",
756
+ "codeBody": "o = output if isinstance(output, dict) else {}\nc = child_output if isinstance(child_output, dict) else {}\nerr = str(c.get(\"error\") or o.get(\"error\") or \"\")\nfor prefix in (\"Runtime error: \", \"Execution error: \"):\n if err.startswith(prefix):\n err = err[len(prefix):]\nfailed = c.get(\"success\") is False or o.get(\"success\") is False or bool(err) or not o.get(\"revision_id\")\nreturn {\"outcome\": \"error\" if failed else \"ok\",\n \"failure\": (str(err) if err else \"The note could not be processed.\") if failed else None,\n \"revision_id\": None if failed else o.get(\"revision_id\")}\n"
757
+ }
758
+ },
759
+ {
760
+ "id": "ack_args",
761
+ "type": "code",
762
+ "position": {
763
+ "x": 5760.0,
764
+ "y": 0.0
765
+ },
766
+ "data": {
767
+ "nodeType": "code",
768
+ "label": "Record the outcome: arguments",
769
+ "inputs": [
770
+ {
771
+ "id": "exec-in",
772
+ "label": "",
773
+ "type": "execution"
774
+ },
775
+ {
776
+ "id": "note_id",
777
+ "label": "note_id",
778
+ "type": "string"
779
+ },
780
+ {
781
+ "id": "outcome",
782
+ "label": "outcome",
783
+ "type": "string"
784
+ },
785
+ {
786
+ "id": "error",
787
+ "label": "error",
788
+ "type": "string"
789
+ },
790
+ {
791
+ "id": "revision_id",
792
+ "label": "revision_id",
793
+ "type": "string"
794
+ },
795
+ {
796
+ "id": "permissions",
797
+ "label": "permissions",
798
+ "type": "string"
799
+ }
800
+ ],
801
+ "outputs": [
802
+ {
803
+ "id": "exec-out",
804
+ "label": "",
805
+ "type": "execution"
806
+ },
807
+ {
808
+ "id": "tool_calls",
809
+ "label": "tool_calls",
810
+ "type": "array"
811
+ }
812
+ ],
813
+ "pinDefaults": {
814
+ "permissions": "sandbox"
815
+ },
816
+ "functionName": "transform",
817
+ "codeBody": "arguments = {}\nif note_id is not None and note_id != \"\":\n arguments[\"note_id\"] = note_id\nif outcome is not None and outcome != \"\":\n arguments[\"outcome\"] = outcome\nif error is not None and error != \"\":\n arguments[\"error\"] = error\nif revision_id is not None and revision_id != \"\":\n arguments[\"revision_id\"] = revision_id\nreturn {\"tool_calls\": [{\"name\": \"note_queue_ack\", \"call_id\": \"ack\", \"arguments\": arguments}]}\n"
818
+ }
819
+ },
820
+ {
821
+ "id": "ack",
822
+ "type": "tool_calls",
823
+ "position": {
824
+ "x": 6240.0,
825
+ "y": 0.0
826
+ },
827
+ "data": {
828
+ "nodeType": "tool_calls",
829
+ "label": "Record the outcome",
830
+ "inputs": [
831
+ {
832
+ "id": "exec-in",
833
+ "label": "",
834
+ "type": "execution"
835
+ },
836
+ {
837
+ "id": "tool_calls",
838
+ "label": "tool_calls",
839
+ "type": "array"
840
+ },
841
+ {
842
+ "id": "allowed_tools",
843
+ "label": "allowed_tools",
844
+ "type": "array"
845
+ }
846
+ ],
847
+ "outputs": [
848
+ {
849
+ "id": "exec-out",
850
+ "label": "",
851
+ "type": "execution"
852
+ },
853
+ {
854
+ "id": "results",
855
+ "label": "results",
856
+ "type": "array"
857
+ },
858
+ {
859
+ "id": "success",
860
+ "label": "success",
861
+ "type": "boolean"
862
+ }
863
+ ],
864
+ "pinDefaults": {
865
+ "allowed_tools": [
866
+ "note_queue_ack"
867
+ ]
868
+ },
869
+ "effectConfig": {
870
+ "allowed_tools": [
871
+ "note_queue_ack"
872
+ ]
873
+ }
874
+ }
875
+ },
876
+ {
877
+ "id": "ack_out",
878
+ "type": "code",
879
+ "position": {
880
+ "x": 6720.0,
881
+ "y": 0.0
882
+ },
883
+ "data": {
884
+ "nodeType": "code",
885
+ "label": "Record the outcome: result",
886
+ "inputs": [
887
+ {
888
+ "id": "exec-in",
889
+ "label": "",
890
+ "type": "execution"
891
+ },
892
+ {
893
+ "id": "results",
894
+ "label": "results",
895
+ "type": "array"
896
+ },
897
+ {
898
+ "id": "permissions",
899
+ "label": "permissions",
900
+ "type": "string"
901
+ }
902
+ ],
903
+ "outputs": [
904
+ {
905
+ "id": "exec-out",
906
+ "label": "",
907
+ "type": "execution"
908
+ },
909
+ {
910
+ "id": "status",
911
+ "label": "status",
912
+ "type": "string"
913
+ },
914
+ {
915
+ "id": "tool_output",
916
+ "label": "tool_output",
917
+ "type": "object"
918
+ },
919
+ {
920
+ "id": "failed",
921
+ "label": "failed",
922
+ "type": "boolean"
923
+ },
924
+ {
925
+ "id": "failure",
926
+ "label": "failure",
927
+ "type": "string"
928
+ }
929
+ ],
930
+ "pinDefaults": {
931
+ "permissions": "sandbox"
932
+ },
933
+ "functionName": "transform",
934
+ "codeBody": "r = results[0] if isinstance(results, list) and results else None\nfailure = None\nout = None\nif not isinstance(r, dict):\n failure = \"note_queue_ack returned no result.\"\nelif not r.get(\"success\"):\n failure = str(r.get(\"error\") or \"note_queue_ack failed.\")\nelse:\n out = r.get(\"output\")\n if not isinstance(out, dict):\n failure = \"note_queue_ack returned something other than an object.\"\nif failure is not None:\n return {\"failed\": True, \"failure\": failure}\nreturn dict(out, tool_output=out, failed=False, failure=None)\n"
935
+ }
936
+ },
937
+ {
938
+ "id": "ack_failed",
939
+ "type": "if",
940
+ "position": {
941
+ "x": 7200.0,
942
+ "y": 0.0
943
+ },
944
+ "data": {
945
+ "nodeType": "if",
946
+ "label": "Record the outcome: failed?",
947
+ "inputs": [
948
+ {
949
+ "id": "exec-in",
950
+ "label": "",
951
+ "type": "execution"
952
+ },
953
+ {
954
+ "id": "condition",
955
+ "label": "condition",
956
+ "type": "boolean"
957
+ }
958
+ ],
959
+ "outputs": [
960
+ {
961
+ "id": "true",
962
+ "label": "true",
963
+ "type": "execution"
964
+ },
965
+ {
966
+ "id": "false",
967
+ "label": "false",
968
+ "type": "execution"
969
+ }
970
+ ]
971
+ }
972
+ },
973
+ {
974
+ "id": "ack_stopped",
975
+ "type": "on_flow_end",
976
+ "position": {
977
+ "x": 7680.0,
978
+ "y": 0.0
979
+ },
980
+ "data": {
981
+ "nodeType": "on_flow_end",
982
+ "label": "Stopped: record the outcome failed",
983
+ "inputs": [
984
+ {
985
+ "id": "exec-in",
986
+ "label": "",
987
+ "type": "execution"
988
+ },
989
+ {
990
+ "id": "response",
991
+ "label": "response",
992
+ "type": "string"
993
+ },
994
+ {
995
+ "id": "error",
996
+ "label": "error",
997
+ "type": "string"
998
+ },
999
+ {
1000
+ "id": "success",
1001
+ "label": "success",
1002
+ "type": "boolean"
1003
+ }
1004
+ ],
1005
+ "outputs": [],
1006
+ "pinDefaults": {
1007
+ "success": false
1008
+ }
1009
+ }
1010
+ },
1011
+ {
1012
+ "id": "left",
1013
+ "type": "get_var",
1014
+ "position": {
1015
+ "x": 7200.0,
1016
+ "y": 320.0
1017
+ },
1018
+ "data": {
1019
+ "nodeType": "get_var",
1020
+ "label": "Get drain_left",
1021
+ "inputs": [
1022
+ {
1023
+ "id": "name",
1024
+ "label": "name",
1025
+ "type": "string"
1026
+ },
1027
+ {
1028
+ "id": "default",
1029
+ "label": "default",
1030
+ "type": "any"
1031
+ }
1032
+ ],
1033
+ "outputs": [
1034
+ {
1035
+ "id": "value",
1036
+ "label": "value",
1037
+ "type": "any"
1038
+ }
1039
+ ],
1040
+ "pinDefaults": {
1041
+ "name": "drain_left",
1042
+ "default": 0
1043
+ }
1044
+ }
1045
+ },
1046
+ {
1047
+ "id": "deadline",
1048
+ "type": "get_var",
1049
+ "position": {
1050
+ "x": 7200.0,
1051
+ "y": 640.0
1052
+ },
1053
+ "data": {
1054
+ "nodeType": "get_var",
1055
+ "label": "Get drain_deadline",
1056
+ "inputs": [
1057
+ {
1058
+ "id": "name",
1059
+ "label": "name",
1060
+ "type": "string"
1061
+ },
1062
+ {
1063
+ "id": "default",
1064
+ "label": "default",
1065
+ "type": "any"
1066
+ }
1067
+ ],
1068
+ "outputs": [
1069
+ {
1070
+ "id": "value",
1071
+ "label": "value",
1072
+ "type": "any"
1073
+ }
1074
+ ],
1075
+ "pinDefaults": {
1076
+ "name": "drain_deadline",
1077
+ "default": 0
1078
+ }
1079
+ }
1080
+ },
1081
+ {
1082
+ "id": "processed",
1083
+ "type": "get_var",
1084
+ "position": {
1085
+ "x": 7200.0,
1086
+ "y": 960.0
1087
+ },
1088
+ "data": {
1089
+ "nodeType": "get_var",
1090
+ "label": "Get drain_processed",
1091
+ "inputs": [
1092
+ {
1093
+ "id": "name",
1094
+ "label": "name",
1095
+ "type": "string"
1096
+ },
1097
+ {
1098
+ "id": "default",
1099
+ "label": "default",
1100
+ "type": "any"
1101
+ }
1102
+ ],
1103
+ "outputs": [
1104
+ {
1105
+ "id": "value",
1106
+ "label": "value",
1107
+ "type": "any"
1108
+ }
1109
+ ],
1110
+ "pinDefaults": {
1111
+ "name": "drain_processed",
1112
+ "default": 0
1113
+ }
1114
+ }
1115
+ },
1116
+ {
1117
+ "id": "failed",
1118
+ "type": "get_var",
1119
+ "position": {
1120
+ "x": 7200.0,
1121
+ "y": 1280.0
1122
+ },
1123
+ "data": {
1124
+ "nodeType": "get_var",
1125
+ "label": "Get drain_failed",
1126
+ "inputs": [
1127
+ {
1128
+ "id": "name",
1129
+ "label": "name",
1130
+ "type": "string"
1131
+ },
1132
+ {
1133
+ "id": "default",
1134
+ "label": "default",
1135
+ "type": "any"
1136
+ }
1137
+ ],
1138
+ "outputs": [
1139
+ {
1140
+ "id": "value",
1141
+ "label": "value",
1142
+ "type": "any"
1143
+ }
1144
+ ],
1145
+ "pinDefaults": {
1146
+ "name": "drain_failed",
1147
+ "default": 0
1148
+ }
1149
+ }
1150
+ },
1151
+ {
1152
+ "id": "errors",
1153
+ "type": "get_var",
1154
+ "position": {
1155
+ "x": 7200.0,
1156
+ "y": 1600.0
1157
+ },
1158
+ "data": {
1159
+ "nodeType": "get_var",
1160
+ "label": "Get drain_errors",
1161
+ "inputs": [
1162
+ {
1163
+ "id": "name",
1164
+ "label": "name",
1165
+ "type": "string"
1166
+ },
1167
+ {
1168
+ "id": "default",
1169
+ "label": "default",
1170
+ "type": "any"
1171
+ }
1172
+ ],
1173
+ "outputs": [
1174
+ {
1175
+ "id": "value",
1176
+ "label": "value",
1177
+ "type": "any"
1178
+ }
1179
+ ],
1180
+ "pinDefaults": {
1181
+ "name": "drain_errors",
1182
+ "default": []
1183
+ }
1184
+ }
1185
+ },
1186
+ {
1187
+ "id": "budget",
1188
+ "type": "code",
1189
+ "position": {
1190
+ "x": 7680.0,
1191
+ "y": 320.0
1192
+ },
1193
+ "data": {
1194
+ "nodeType": "code",
1195
+ "label": "Budget left?",
1196
+ "inputs": [
1197
+ {
1198
+ "id": "exec-in",
1199
+ "label": "",
1200
+ "type": "execution"
1201
+ },
1202
+ {
1203
+ "id": "outcome",
1204
+ "label": "outcome",
1205
+ "type": "string"
1206
+ },
1207
+ {
1208
+ "id": "failure",
1209
+ "label": "failure",
1210
+ "type": "string"
1211
+ },
1212
+ {
1213
+ "id": "note_id",
1214
+ "label": "note_id",
1215
+ "type": "string"
1216
+ },
1217
+ {
1218
+ "id": "left",
1219
+ "label": "left",
1220
+ "type": "number"
1221
+ },
1222
+ {
1223
+ "id": "deadline",
1224
+ "label": "deadline",
1225
+ "type": "number"
1226
+ },
1227
+ {
1228
+ "id": "processed",
1229
+ "label": "processed",
1230
+ "type": "number"
1231
+ },
1232
+ {
1233
+ "id": "failed",
1234
+ "label": "failed",
1235
+ "type": "number"
1236
+ },
1237
+ {
1238
+ "id": "errors",
1239
+ "label": "errors",
1240
+ "type": "array"
1241
+ },
1242
+ {
1243
+ "id": "permissions",
1244
+ "label": "permissions",
1245
+ "type": "string"
1246
+ }
1247
+ ],
1248
+ "outputs": [
1249
+ {
1250
+ "id": "exec-out",
1251
+ "label": "",
1252
+ "type": "execution"
1253
+ },
1254
+ {
1255
+ "id": "updates",
1256
+ "label": "updates",
1257
+ "type": "object"
1258
+ }
1259
+ ],
1260
+ "pinDefaults": {
1261
+ "permissions": "sandbox"
1262
+ },
1263
+ "functionName": "transform",
1264
+ "codeBody": "import time\nok = outcome == \"ok\"\nerrs = list(errors or [])\nif not ok:\n errs.append({\"note_id\": note_id, \"error\": failure})\nremaining = int(left or 0) - 1\nreturn {\"updates\": {\"drain_left\": remaining,\n \"drain_processed\": int(processed or 0) + (1 if ok else 0),\n \"drain_failed\": int(failed or 0) + (0 if ok else 1), \"drain_errors\": errs,\n \"drain_continue\": remaining > 0 and time.time() < float(deadline or 0)}}\n"
1265
+ }
1266
+ },
1267
+ {
1268
+ "id": "budget_vars",
1269
+ "type": "set_vars",
1270
+ "position": {
1271
+ "x": 8160.0,
1272
+ "y": 0.0
1273
+ },
1274
+ "data": {
1275
+ "nodeType": "set_vars",
1276
+ "label": "Remember the budget",
1277
+ "inputs": [
1278
+ {
1279
+ "id": "exec-in",
1280
+ "label": "",
1281
+ "type": "execution"
1282
+ },
1283
+ {
1284
+ "id": "updates",
1285
+ "label": "updates",
1286
+ "type": "object"
1287
+ }
1288
+ ],
1289
+ "outputs": [
1290
+ {
1291
+ "id": "exec-out",
1292
+ "label": "",
1293
+ "type": "execution"
1294
+ },
1295
+ {
1296
+ "id": "updates",
1297
+ "label": "updates",
1298
+ "type": "object"
1299
+ }
1300
+ ]
1301
+ }
1302
+ },
1303
+ {
1304
+ "id": "r_processed",
1305
+ "type": "get_var",
1306
+ "position": {
1307
+ "x": 1440.0,
1308
+ "y": 640.0
1309
+ },
1310
+ "data": {
1311
+ "nodeType": "get_var",
1312
+ "label": "Get drain_processed",
1313
+ "inputs": [
1314
+ {
1315
+ "id": "name",
1316
+ "label": "name",
1317
+ "type": "string"
1318
+ },
1319
+ {
1320
+ "id": "default",
1321
+ "label": "default",
1322
+ "type": "any"
1323
+ }
1324
+ ],
1325
+ "outputs": [
1326
+ {
1327
+ "id": "value",
1328
+ "label": "value",
1329
+ "type": "any"
1330
+ }
1331
+ ],
1332
+ "pinDefaults": {
1333
+ "name": "drain_processed",
1334
+ "default": 0
1335
+ }
1336
+ }
1337
+ },
1338
+ {
1339
+ "id": "r_failed",
1340
+ "type": "get_var",
1341
+ "position": {
1342
+ "x": 1440.0,
1343
+ "y": 960.0
1344
+ },
1345
+ "data": {
1346
+ "nodeType": "get_var",
1347
+ "label": "Get drain_failed",
1348
+ "inputs": [
1349
+ {
1350
+ "id": "name",
1351
+ "label": "name",
1352
+ "type": "string"
1353
+ },
1354
+ {
1355
+ "id": "default",
1356
+ "label": "default",
1357
+ "type": "any"
1358
+ }
1359
+ ],
1360
+ "outputs": [
1361
+ {
1362
+ "id": "value",
1363
+ "label": "value",
1364
+ "type": "any"
1365
+ }
1366
+ ],
1367
+ "pinDefaults": {
1368
+ "name": "drain_failed",
1369
+ "default": 0
1370
+ }
1371
+ }
1372
+ },
1373
+ {
1374
+ "id": "r_errors",
1375
+ "type": "get_var",
1376
+ "position": {
1377
+ "x": 1440.0,
1378
+ "y": 1280.0
1379
+ },
1380
+ "data": {
1381
+ "nodeType": "get_var",
1382
+ "label": "Get drain_errors",
1383
+ "inputs": [
1384
+ {
1385
+ "id": "name",
1386
+ "label": "name",
1387
+ "type": "string"
1388
+ },
1389
+ {
1390
+ "id": "default",
1391
+ "label": "default",
1392
+ "type": "any"
1393
+ }
1394
+ ],
1395
+ "outputs": [
1396
+ {
1397
+ "id": "value",
1398
+ "label": "value",
1399
+ "type": "any"
1400
+ }
1401
+ ],
1402
+ "pinDefaults": {
1403
+ "name": "drain_errors",
1404
+ "default": []
1405
+ }
1406
+ }
1407
+ },
1408
+ {
1409
+ "id": "report",
1410
+ "type": "code",
1411
+ "position": {
1412
+ "x": 1920.0,
1413
+ "y": 320.0
1414
+ },
1415
+ "data": {
1416
+ "nodeType": "code",
1417
+ "label": "Report",
1418
+ "inputs": [
1419
+ {
1420
+ "id": "exec-in",
1421
+ "label": "",
1422
+ "type": "execution"
1423
+ },
1424
+ {
1425
+ "id": "processed",
1426
+ "label": "processed",
1427
+ "type": "number"
1428
+ },
1429
+ {
1430
+ "id": "failed",
1431
+ "label": "failed",
1432
+ "type": "number"
1433
+ },
1434
+ {
1435
+ "id": "errors",
1436
+ "label": "errors",
1437
+ "type": "array"
1438
+ },
1439
+ {
1440
+ "id": "permissions",
1441
+ "label": "permissions",
1442
+ "type": "string"
1443
+ }
1444
+ ],
1445
+ "outputs": [
1446
+ {
1447
+ "id": "exec-out",
1448
+ "label": "",
1449
+ "type": "execution"
1450
+ },
1451
+ {
1452
+ "id": "message",
1453
+ "label": "message",
1454
+ "type": "string"
1455
+ },
1456
+ {
1457
+ "id": "processed",
1458
+ "label": "processed",
1459
+ "type": "number"
1460
+ },
1461
+ {
1462
+ "id": "failed",
1463
+ "label": "failed",
1464
+ "type": "number"
1465
+ },
1466
+ {
1467
+ "id": "errors",
1468
+ "label": "errors",
1469
+ "type": "array"
1470
+ }
1471
+ ],
1472
+ "pinDefaults": {
1473
+ "permissions": "sandbox"
1474
+ },
1475
+ "functionName": "transform",
1476
+ "codeBody": "n = int(processed or 0)\nk = int(failed or 0)\nif n == 0 and k == 0:\n msg = \"Nothing to process.\"\nelse:\n msg = \"Processed \" + str(n) + (\" note.\" if n == 1 else \" notes.\")\n if k:\n msg = msg[:-1] + \"; \" + str(k) + (\" could not be processed.\" if k > 1 else \" could not be processed.\")\nreturn {\"message\": msg, \"processed\": n, \"failed\": k, \"errors\": list(errors or [])}\n"
1477
+ }
1478
+ },
1479
+ {
1480
+ "id": "end",
1481
+ "type": "on_flow_end",
1482
+ "position": {
1483
+ "x": 2400.0,
1484
+ "y": 320.0
1485
+ },
1486
+ "data": {
1487
+ "nodeType": "on_flow_end",
1488
+ "label": "Done",
1489
+ "inputs": [
1490
+ {
1491
+ "id": "exec-in",
1492
+ "label": "",
1493
+ "type": "execution"
1494
+ },
1495
+ {
1496
+ "id": "response",
1497
+ "label": "response",
1498
+ "type": "string"
1499
+ },
1500
+ {
1501
+ "id": "processed",
1502
+ "label": "processed",
1503
+ "type": "number"
1504
+ },
1505
+ {
1506
+ "id": "failed",
1507
+ "label": "failed",
1508
+ "type": "number"
1509
+ },
1510
+ {
1511
+ "id": "errors",
1512
+ "label": "errors",
1513
+ "type": "array"
1514
+ }
1515
+ ],
1516
+ "outputs": []
1517
+ }
1518
+ }
1519
+ ],
1520
+ "edges": [
1521
+ {
1522
+ "id": "e-start-max_items-init-max_items",
1523
+ "source": "start",
1524
+ "sourceHandle": "max_items",
1525
+ "target": "init",
1526
+ "targetHandle": "max_items"
1527
+ },
1528
+ {
1529
+ "id": "e-start-budget_s-init-budget_s",
1530
+ "source": "start",
1531
+ "sourceHandle": "budget_s",
1532
+ "target": "init",
1533
+ "targetHandle": "budget_s"
1534
+ },
1535
+ {
1536
+ "id": "e-start-exec-out-init-exec-in",
1537
+ "source": "start",
1538
+ "sourceHandle": "exec-out",
1539
+ "target": "init",
1540
+ "targetHandle": "exec-in"
1541
+ },
1542
+ {
1543
+ "id": "e-init-updates-init_vars-updates",
1544
+ "source": "init",
1545
+ "sourceHandle": "updates",
1546
+ "target": "init_vars",
1547
+ "targetHandle": "updates"
1548
+ },
1549
+ {
1550
+ "id": "e-init-exec-out-init_vars-exec-in",
1551
+ "source": "init",
1552
+ "sourceHandle": "exec-out",
1553
+ "target": "init_vars",
1554
+ "targetHandle": "exec-in"
1555
+ },
1556
+ {
1557
+ "id": "e-continue-value-drain_loop-condition",
1558
+ "source": "continue",
1559
+ "sourceHandle": "value",
1560
+ "target": "drain_loop",
1561
+ "targetHandle": "condition"
1562
+ },
1563
+ {
1564
+ "id": "e-init_vars-exec-out-drain_loop-exec-in",
1565
+ "source": "init_vars",
1566
+ "sourceHandle": "exec-out",
1567
+ "target": "drain_loop",
1568
+ "targetHandle": "exec-in"
1569
+ },
1570
+ {
1571
+ "id": "e-worker-value-lease_args-worker_id",
1572
+ "source": "worker",
1573
+ "sourceHandle": "value",
1574
+ "target": "lease_args",
1575
+ "targetHandle": "worker_id"
1576
+ },
1577
+ {
1578
+ "id": "e-drain_loop-loop-lease_args-exec-in",
1579
+ "source": "drain_loop",
1580
+ "sourceHandle": "loop",
1581
+ "target": "lease_args",
1582
+ "targetHandle": "exec-in"
1583
+ },
1584
+ {
1585
+ "id": "e-lease_args-tool_calls-lease-tool_calls",
1586
+ "source": "lease_args",
1587
+ "sourceHandle": "tool_calls",
1588
+ "target": "lease",
1589
+ "targetHandle": "tool_calls"
1590
+ },
1591
+ {
1592
+ "id": "e-lease_args-exec-out-lease-exec-in",
1593
+ "source": "lease_args",
1594
+ "sourceHandle": "exec-out",
1595
+ "target": "lease",
1596
+ "targetHandle": "exec-in"
1597
+ },
1598
+ {
1599
+ "id": "e-lease-results-lease_out-results",
1600
+ "source": "lease",
1601
+ "sourceHandle": "results",
1602
+ "target": "lease_out",
1603
+ "targetHandle": "results"
1604
+ },
1605
+ {
1606
+ "id": "e-lease-exec-out-lease_out-exec-in",
1607
+ "source": "lease",
1608
+ "sourceHandle": "exec-out",
1609
+ "target": "lease_out",
1610
+ "targetHandle": "exec-in"
1611
+ },
1612
+ {
1613
+ "id": "e-lease_out-failed-lease_failed-condition",
1614
+ "source": "lease_out",
1615
+ "sourceHandle": "failed",
1616
+ "target": "lease_failed",
1617
+ "targetHandle": "condition"
1618
+ },
1619
+ {
1620
+ "id": "e-lease_out-exec-out-lease_failed-exec-in",
1621
+ "source": "lease_out",
1622
+ "sourceHandle": "exec-out",
1623
+ "target": "lease_failed",
1624
+ "targetHandle": "exec-in"
1625
+ },
1626
+ {
1627
+ "id": "e-lease_out-failure-lease_stopped-response",
1628
+ "source": "lease_out",
1629
+ "sourceHandle": "failure",
1630
+ "target": "lease_stopped",
1631
+ "targetHandle": "response"
1632
+ },
1633
+ {
1634
+ "id": "e-lease_out-failure-lease_stopped-error",
1635
+ "source": "lease_out",
1636
+ "sourceHandle": "failure",
1637
+ "target": "lease_stopped",
1638
+ "targetHandle": "error"
1639
+ },
1640
+ {
1641
+ "id": "e-lease_failed-true-lease_stopped-exec-in",
1642
+ "source": "lease_failed",
1643
+ "sourceHandle": "true",
1644
+ "target": "lease_stopped",
1645
+ "targetHandle": "exec-in"
1646
+ },
1647
+ {
1648
+ "id": "e-lease_out-items-pick-items",
1649
+ "source": "lease_out",
1650
+ "sourceHandle": "items",
1651
+ "target": "pick",
1652
+ "targetHandle": "items"
1653
+ },
1654
+ {
1655
+ "id": "e-lease_failed-false-pick-exec-in",
1656
+ "source": "lease_failed",
1657
+ "sourceHandle": "false",
1658
+ "target": "pick",
1659
+ "targetHandle": "exec-in"
1660
+ },
1661
+ {
1662
+ "id": "e-pick-has_item-has_item-condition",
1663
+ "source": "pick",
1664
+ "sourceHandle": "has_item",
1665
+ "target": "has_item",
1666
+ "targetHandle": "condition"
1667
+ },
1668
+ {
1669
+ "id": "e-pick-exec-out-has_item-exec-in",
1670
+ "source": "pick",
1671
+ "sourceHandle": "exec-out",
1672
+ "target": "has_item",
1673
+ "targetHandle": "exec-in"
1674
+ },
1675
+ {
1676
+ "id": "e-has_item-false-stop-exec-in",
1677
+ "source": "has_item",
1678
+ "sourceHandle": "false",
1679
+ "target": "stop",
1680
+ "targetHandle": "exec-in"
1681
+ },
1682
+ {
1683
+ "id": "e-pick-note_id-process-note_id",
1684
+ "source": "pick",
1685
+ "sourceHandle": "note_id",
1686
+ "target": "process",
1687
+ "targetHandle": "note_id"
1688
+ },
1689
+ {
1690
+ "id": "e-start-provider-process-provider",
1691
+ "source": "start",
1692
+ "sourceHandle": "provider",
1693
+ "target": "process",
1694
+ "targetHandle": "provider"
1695
+ },
1696
+ {
1697
+ "id": "e-start-model-process-model",
1698
+ "source": "start",
1699
+ "sourceHandle": "model",
1700
+ "target": "process",
1701
+ "targetHandle": "model"
1702
+ },
1703
+ {
1704
+ "id": "e-has_item-true-process-exec-in",
1705
+ "source": "has_item",
1706
+ "sourceHandle": "true",
1707
+ "target": "process",
1708
+ "targetHandle": "exec-in"
1709
+ },
1710
+ {
1711
+ "id": "e-process-output-outcome-output",
1712
+ "source": "process",
1713
+ "sourceHandle": "output",
1714
+ "target": "outcome",
1715
+ "targetHandle": "output"
1716
+ },
1717
+ {
1718
+ "id": "e-process-child_output-outcome-child_output",
1719
+ "source": "process",
1720
+ "sourceHandle": "child_output",
1721
+ "target": "outcome",
1722
+ "targetHandle": "child_output"
1723
+ },
1724
+ {
1725
+ "id": "e-process-exec-out-outcome-exec-in",
1726
+ "source": "process",
1727
+ "sourceHandle": "exec-out",
1728
+ "target": "outcome",
1729
+ "targetHandle": "exec-in"
1730
+ },
1731
+ {
1732
+ "id": "e-pick-note_id-ack_args-note_id",
1733
+ "source": "pick",
1734
+ "sourceHandle": "note_id",
1735
+ "target": "ack_args",
1736
+ "targetHandle": "note_id"
1737
+ },
1738
+ {
1739
+ "id": "e-outcome-outcome-ack_args-outcome",
1740
+ "source": "outcome",
1741
+ "sourceHandle": "outcome",
1742
+ "target": "ack_args",
1743
+ "targetHandle": "outcome"
1744
+ },
1745
+ {
1746
+ "id": "e-outcome-failure-ack_args-error",
1747
+ "source": "outcome",
1748
+ "sourceHandle": "failure",
1749
+ "target": "ack_args",
1750
+ "targetHandle": "error"
1751
+ },
1752
+ {
1753
+ "id": "e-outcome-revision_id-ack_args-revision_id",
1754
+ "source": "outcome",
1755
+ "sourceHandle": "revision_id",
1756
+ "target": "ack_args",
1757
+ "targetHandle": "revision_id"
1758
+ },
1759
+ {
1760
+ "id": "e-outcome-exec-out-ack_args-exec-in",
1761
+ "source": "outcome",
1762
+ "sourceHandle": "exec-out",
1763
+ "target": "ack_args",
1764
+ "targetHandle": "exec-in"
1765
+ },
1766
+ {
1767
+ "id": "e-ack_args-tool_calls-ack-tool_calls",
1768
+ "source": "ack_args",
1769
+ "sourceHandle": "tool_calls",
1770
+ "target": "ack",
1771
+ "targetHandle": "tool_calls"
1772
+ },
1773
+ {
1774
+ "id": "e-ack_args-exec-out-ack-exec-in",
1775
+ "source": "ack_args",
1776
+ "sourceHandle": "exec-out",
1777
+ "target": "ack",
1778
+ "targetHandle": "exec-in"
1779
+ },
1780
+ {
1781
+ "id": "e-ack-results-ack_out-results",
1782
+ "source": "ack",
1783
+ "sourceHandle": "results",
1784
+ "target": "ack_out",
1785
+ "targetHandle": "results"
1786
+ },
1787
+ {
1788
+ "id": "e-ack-exec-out-ack_out-exec-in",
1789
+ "source": "ack",
1790
+ "sourceHandle": "exec-out",
1791
+ "target": "ack_out",
1792
+ "targetHandle": "exec-in"
1793
+ },
1794
+ {
1795
+ "id": "e-ack_out-failed-ack_failed-condition",
1796
+ "source": "ack_out",
1797
+ "sourceHandle": "failed",
1798
+ "target": "ack_failed",
1799
+ "targetHandle": "condition"
1800
+ },
1801
+ {
1802
+ "id": "e-ack_out-exec-out-ack_failed-exec-in",
1803
+ "source": "ack_out",
1804
+ "sourceHandle": "exec-out",
1805
+ "target": "ack_failed",
1806
+ "targetHandle": "exec-in"
1807
+ },
1808
+ {
1809
+ "id": "e-ack_out-failure-ack_stopped-response",
1810
+ "source": "ack_out",
1811
+ "sourceHandle": "failure",
1812
+ "target": "ack_stopped",
1813
+ "targetHandle": "response"
1814
+ },
1815
+ {
1816
+ "id": "e-ack_out-failure-ack_stopped-error",
1817
+ "source": "ack_out",
1818
+ "sourceHandle": "failure",
1819
+ "target": "ack_stopped",
1820
+ "targetHandle": "error"
1821
+ },
1822
+ {
1823
+ "id": "e-ack_failed-true-ack_stopped-exec-in",
1824
+ "source": "ack_failed",
1825
+ "sourceHandle": "true",
1826
+ "target": "ack_stopped",
1827
+ "targetHandle": "exec-in"
1828
+ },
1829
+ {
1830
+ "id": "e-outcome-outcome-budget-outcome",
1831
+ "source": "outcome",
1832
+ "sourceHandle": "outcome",
1833
+ "target": "budget",
1834
+ "targetHandle": "outcome"
1835
+ },
1836
+ {
1837
+ "id": "e-outcome-failure-budget-failure",
1838
+ "source": "outcome",
1839
+ "sourceHandle": "failure",
1840
+ "target": "budget",
1841
+ "targetHandle": "failure"
1842
+ },
1843
+ {
1844
+ "id": "e-pick-note_id-budget-note_id",
1845
+ "source": "pick",
1846
+ "sourceHandle": "note_id",
1847
+ "target": "budget",
1848
+ "targetHandle": "note_id"
1849
+ },
1850
+ {
1851
+ "id": "e-left-value-budget-left",
1852
+ "source": "left",
1853
+ "sourceHandle": "value",
1854
+ "target": "budget",
1855
+ "targetHandle": "left"
1856
+ },
1857
+ {
1858
+ "id": "e-deadline-value-budget-deadline",
1859
+ "source": "deadline",
1860
+ "sourceHandle": "value",
1861
+ "target": "budget",
1862
+ "targetHandle": "deadline"
1863
+ },
1864
+ {
1865
+ "id": "e-processed-value-budget-processed",
1866
+ "source": "processed",
1867
+ "sourceHandle": "value",
1868
+ "target": "budget",
1869
+ "targetHandle": "processed"
1870
+ },
1871
+ {
1872
+ "id": "e-failed-value-budget-failed",
1873
+ "source": "failed",
1874
+ "sourceHandle": "value",
1875
+ "target": "budget",
1876
+ "targetHandle": "failed"
1877
+ },
1878
+ {
1879
+ "id": "e-errors-value-budget-errors",
1880
+ "source": "errors",
1881
+ "sourceHandle": "value",
1882
+ "target": "budget",
1883
+ "targetHandle": "errors"
1884
+ },
1885
+ {
1886
+ "id": "e-ack_failed-false-budget-exec-in",
1887
+ "source": "ack_failed",
1888
+ "sourceHandle": "false",
1889
+ "target": "budget",
1890
+ "targetHandle": "exec-in"
1891
+ },
1892
+ {
1893
+ "id": "e-budget-updates-budget_vars-updates",
1894
+ "source": "budget",
1895
+ "sourceHandle": "updates",
1896
+ "target": "budget_vars",
1897
+ "targetHandle": "updates"
1898
+ },
1899
+ {
1900
+ "id": "e-budget-exec-out-budget_vars-exec-in",
1901
+ "source": "budget",
1902
+ "sourceHandle": "exec-out",
1903
+ "target": "budget_vars",
1904
+ "targetHandle": "exec-in"
1905
+ },
1906
+ {
1907
+ "id": "e-r_processed-value-report-processed",
1908
+ "source": "r_processed",
1909
+ "sourceHandle": "value",
1910
+ "target": "report",
1911
+ "targetHandle": "processed"
1912
+ },
1913
+ {
1914
+ "id": "e-r_failed-value-report-failed",
1915
+ "source": "r_failed",
1916
+ "sourceHandle": "value",
1917
+ "target": "report",
1918
+ "targetHandle": "failed"
1919
+ },
1920
+ {
1921
+ "id": "e-r_errors-value-report-errors",
1922
+ "source": "r_errors",
1923
+ "sourceHandle": "value",
1924
+ "target": "report",
1925
+ "targetHandle": "errors"
1926
+ },
1927
+ {
1928
+ "id": "e-drain_loop-done-report-exec-in",
1929
+ "source": "drain_loop",
1930
+ "sourceHandle": "done",
1931
+ "target": "report",
1932
+ "targetHandle": "exec-in"
1933
+ },
1934
+ {
1935
+ "id": "e-report-message-end-response",
1936
+ "source": "report",
1937
+ "sourceHandle": "message",
1938
+ "target": "end",
1939
+ "targetHandle": "response"
1940
+ },
1941
+ {
1942
+ "id": "e-report-processed-end-processed",
1943
+ "source": "report",
1944
+ "sourceHandle": "processed",
1945
+ "target": "end",
1946
+ "targetHandle": "processed"
1947
+ },
1948
+ {
1949
+ "id": "e-report-failed-end-failed",
1950
+ "source": "report",
1951
+ "sourceHandle": "failed",
1952
+ "target": "end",
1953
+ "targetHandle": "failed"
1954
+ },
1955
+ {
1956
+ "id": "e-report-errors-end-errors",
1957
+ "source": "report",
1958
+ "sourceHandle": "errors",
1959
+ "target": "end",
1960
+ "targetHandle": "errors"
1961
+ },
1962
+ {
1963
+ "id": "e-report-exec-out-end-exec-in",
1964
+ "source": "report",
1965
+ "sourceHandle": "exec-out",
1966
+ "target": "end",
1967
+ "targetHandle": "exec-in"
1968
+ }
1969
+ ],
1970
+ "entryNode": "start",
1971
+ "automation_defaults": {
1972
+ "schema_version": 1,
1973
+ "title": "Note processor",
1974
+ "trigger": {
1975
+ "source_id": "schedule",
1976
+ "source_version": 2,
1977
+ "config": {
1978
+ "kind": "every",
1979
+ "every": "2m"
1980
+ }
1981
+ },
1982
+ "context": {
1983
+ "mode": "independent"
1984
+ },
1985
+ "input_data": {
1986
+ "max_items": 20,
1987
+ "budget_s": 90,
1988
+ "_runtime": {
1989
+ "allowed_tools": [
1990
+ "note_capture",
1991
+ "note_file",
1992
+ "note_context",
1993
+ "note_resolve_candidates",
1994
+ "note_apply_revision",
1995
+ "note_queue_lease",
1996
+ "note_queue_ack",
1997
+ "note_queue_stats",
1998
+ "note_search",
1999
+ "note_expand",
2000
+ "note_changes",
2001
+ "note_entity",
2002
+ "note_timeline",
2003
+ "note_open_loops",
2004
+ "note_contradictions",
2005
+ "note_resurface",
2006
+ "note_anniversaries",
2007
+ "note_insight_write"
2008
+ ]
2009
+ }
2010
+ }
2011
+ }
2012
+ }