@dxos/assistant-toolkit 0.8.4-main.fcc0d83b33 → 0.8.4-staging.60fe92afc8
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/LICENSE +102 -5
- package/dist/lib/neutral/add-artifact-54DVWE53.mjs +24 -0
- package/dist/lib/neutral/add-artifact-54DVWE53.mjs.map +7 -0
- package/dist/lib/neutral/{agent-6OHUAIA2.mjs → agent-LCBDWP74.mjs} +13 -13
- package/dist/lib/neutral/agent-LCBDWP74.mjs.map +7 -0
- package/dist/lib/neutral/{project-rules-FLUQQRPB.mjs → agent-rules-3TBAIVTS.mjs} +8 -8
- package/dist/lib/neutral/{project-rules-FLUQQRPB.mjs.map → agent-rules-3TBAIVTS.mjs.map} +2 -2
- package/dist/lib/neutral/{chunk-WIV7ZVRS.mjs → chunk-24L572PJ.mjs} +27 -16
- package/dist/lib/neutral/chunk-24L572PJ.mjs.map +7 -0
- package/dist/lib/neutral/{chunk-4T3LJGXI.mjs → chunk-3YH7MWSD.mjs} +27 -16
- package/dist/lib/neutral/chunk-3YH7MWSD.mjs.map +7 -0
- package/dist/lib/neutral/{chunk-CVUA23QI.mjs → chunk-4LFE5PQ3.mjs} +67 -32
- package/dist/lib/neutral/chunk-4LFE5PQ3.mjs.map +7 -0
- package/dist/lib/neutral/{chunk-JN4GARRQ.mjs → chunk-BOB6M2YM.mjs} +20 -11
- package/dist/lib/neutral/chunk-BOB6M2YM.mjs.map +7 -0
- package/dist/lib/neutral/{chunk-EJAQUAKM.mjs → chunk-DLVIJSH6.mjs} +24 -10
- package/dist/lib/neutral/chunk-DLVIJSH6.mjs.map +7 -0
- package/dist/lib/neutral/{chunk-WLR3BGO4.mjs → chunk-FQNZX2SH.mjs} +15 -4
- package/dist/lib/neutral/chunk-FQNZX2SH.mjs.map +7 -0
- package/dist/lib/neutral/{chunk-YXOVSRFU.mjs → chunk-JRUTUKPS.mjs} +11 -13
- package/dist/lib/neutral/chunk-JRUTUKPS.mjs.map +7 -0
- package/dist/lib/neutral/chunk-KC2LPECT.mjs +76 -0
- package/dist/lib/neutral/chunk-KC2LPECT.mjs.map +7 -0
- package/dist/lib/neutral/chunk-NSAUN2IX.mjs +66 -0
- package/dist/lib/neutral/chunk-NSAUN2IX.mjs.map +7 -0
- package/dist/lib/neutral/{chunk-GSG4JGIY.mjs → chunk-RNIUE4LK.mjs} +38 -23
- package/dist/lib/neutral/chunk-RNIUE4LK.mjs.map +7 -0
- package/dist/lib/neutral/{chunk-KGU725LW.mjs → chunk-SYUTQPSB.mjs} +4 -7
- package/dist/lib/neutral/chunk-SYUTQPSB.mjs.map +7 -0
- package/dist/lib/neutral/chunk-U5FCQXA2.mjs +69 -0
- package/dist/lib/neutral/chunk-U5FCQXA2.mjs.map +7 -0
- package/dist/lib/neutral/{chunk-SVI25Z2Y.mjs → chunk-URUJQGI6.mjs} +72 -58
- package/dist/lib/neutral/chunk-URUJQGI6.mjs.map +7 -0
- package/dist/lib/neutral/{chunk-NR3GTWRC.mjs → chunk-Z3KITY4U.mjs} +9 -14
- package/dist/lib/neutral/chunk-Z3KITY4U.mjs.map +7 -0
- package/dist/lib/neutral/{chunk-VSDP6SRY.mjs → chunk-ZQDWSV26.mjs} +19 -8
- package/dist/lib/neutral/chunk-ZQDWSV26.mjs.map +7 -0
- package/dist/lib/neutral/{context-add-IIDPRRVB.mjs → context-add-KWEKPGMI.mjs} +5 -5
- package/dist/lib/neutral/context-add-KWEKPGMI.mjs.map +7 -0
- package/dist/lib/neutral/{context-remove-RDYV4PD4.mjs → context-remove-HIQFSVHW.mjs} +5 -5
- package/dist/lib/neutral/context-remove-HIQFSVHW.mjs.map +7 -0
- package/dist/lib/neutral/{create-project-MPAMKQ3T.mjs → create-agent-KUTBEXLJ.mjs} +13 -14
- package/dist/lib/neutral/create-agent-KUTBEXLJ.mjs.map +7 -0
- package/dist/lib/neutral/definitions-6HU2P7R7.mjs +17 -0
- package/dist/lib/neutral/delegate-task-E7WLHT6S.mjs +13 -0
- package/dist/lib/neutral/delegate-task-E7WLHT6S.mjs.map +7 -0
- package/dist/lib/neutral/{delete-J3PMWP7Z.mjs → delete-QHGM7N23.mjs} +4 -4
- package/dist/lib/neutral/{delete-J3PMWP7Z.mjs.map → delete-QHGM7N23.mjs.map} +1 -1
- package/dist/lib/neutral/{enable-blueprints-LELPQHY5.mjs → enable-blueprints-OGYSQ7HD.mjs} +14 -15
- package/dist/lib/neutral/enable-blueprints-OGYSQ7HD.mjs.map +7 -0
- package/dist/lib/neutral/fetch-O6G46HJH.mjs +24 -0
- package/dist/lib/neutral/fetch-O6G46HJH.mjs.map +7 -0
- package/dist/lib/neutral/{fetch-messages-OS74FP76.mjs → fetch-messages-4EVGVEQK.mjs} +8 -9
- package/dist/lib/neutral/fetch-messages-4EVGVEQK.mjs.map +7 -0
- package/dist/lib/neutral/{get-context-JRTOOA5O.mjs → get-context-X4FCUMLK.mjs} +26 -12
- package/dist/lib/neutral/get-context-X4FCUMLK.mjs.map +7 -0
- package/dist/lib/neutral/index.mjs +640 -479
- package/dist/lib/neutral/index.mjs.map +4 -4
- package/dist/lib/neutral/{load-LI7HHVD6.mjs → load-C4OPO7RD.mjs} +3 -3
- package/dist/lib/neutral/{load-LI7HHVD6.mjs.map → load-C4OPO7RD.mjs.map} +1 -1
- package/dist/lib/neutral/meta.json +1 -1
- package/dist/lib/neutral/object-create-F7R7IRW5.mjs +32 -0
- package/dist/lib/neutral/object-create-F7R7IRW5.mjs.map +7 -0
- package/dist/lib/neutral/{object-delete-I266YAXI.mjs → object-delete-3TJ3XMLN.mjs} +3 -3
- package/dist/lib/neutral/{object-delete-I266YAXI.mjs.map → object-delete-3TJ3XMLN.mjs.map} +1 -1
- package/dist/lib/neutral/{object-update-HY4GI7LA.mjs → object-update-EBRM5AKN.mjs} +4 -4
- package/dist/lib/neutral/{object-update-HY4GI7LA.mjs.map → object-update-EBRM5AKN.mjs.map} +3 -3
- package/dist/lib/neutral/{prompt-4UMXX6QU.mjs → prompt-QL7TTLM3.mjs} +22 -24
- package/dist/lib/neutral/prompt-QL7TTLM3.mjs.map +7 -0
- package/dist/lib/neutral/{qualifier-7BUCOEKK.mjs → qualifier-QAW6LSYF.mjs} +18 -17
- package/dist/lib/neutral/qualifier-QAW6LSYF.mjs.map +7 -0
- package/dist/lib/neutral/{query-U56GNEV6.mjs → query-6XCQIIZC.mjs} +5 -5
- package/dist/lib/neutral/{query-U56GNEV6.mjs.map → query-6XCQIIZC.mjs.map} +4 -4
- package/dist/lib/neutral/{query-B3NOYFCK.mjs → query-QGSHZMCD.mjs} +14 -25
- package/dist/lib/neutral/query-QGSHZMCD.mjs.map +7 -0
- package/dist/lib/neutral/query-blueprints-7NDHHM7U.mjs +17 -0
- package/dist/lib/neutral/query-blueprints-7NDHHM7U.mjs.map +7 -0
- package/dist/lib/neutral/relation-create-WA2DM76W.mjs +31 -0
- package/dist/lib/neutral/relation-create-WA2DM76W.mjs.map +7 -0
- package/dist/lib/neutral/{relation-delete-LXY7W2YO.mjs → relation-delete-66XP7KL7.mjs} +3 -3
- package/dist/lib/neutral/{relation-delete-LXY7W2YO.mjs.map → relation-delete-66XP7KL7.mjs.map} +1 -1
- package/dist/lib/neutral/{save-GWAPLT3Z.mjs → save-HQY35ACW.mjs} +4 -4
- package/dist/lib/neutral/{save-GWAPLT3Z.mjs.map → save-HQY35ACW.mjs.map} +1 -1
- package/dist/lib/neutral/schema-add-2AWYVGOC.mjs +25 -0
- package/dist/lib/neutral/schema-add-2AWYVGOC.mjs.map +7 -0
- package/dist/lib/neutral/schema-list-74CQW2N3.mjs +37 -0
- package/dist/lib/neutral/schema-list-74CQW2N3.mjs.map +7 -0
- package/dist/lib/neutral/{sync-issues-A2RJNPEF.mjs → sync-issues-VUX4OWPO.mjs} +13 -14
- package/dist/lib/neutral/sync-issues-VUX4OWPO.mjs.map +7 -0
- package/dist/lib/neutral/{sync-triggers-NV4JCRN5.mjs → sync-triggers-JEVTYIGU.mjs} +45 -44
- package/dist/lib/neutral/sync-triggers-JEVTYIGU.mjs.map +7 -0
- package/dist/lib/neutral/{tag-add-5NOHUTIE.mjs → tag-add-6EGIY2CC.mjs} +5 -6
- package/dist/lib/neutral/tag-add-6EGIY2CC.mjs.map +7 -0
- package/dist/lib/neutral/{tag-remove-QTKYDJAW.mjs → tag-remove-XVTYJRI7.mjs} +5 -6
- package/dist/lib/neutral/tag-remove-XVTYJRI7.mjs.map +7 -0
- package/dist/lib/neutral/testing/index.mjs +10 -13
- package/dist/lib/neutral/testing/index.mjs.map +3 -3
- package/dist/lib/neutral/update-tasks-N65UQUHS.mjs +13 -0
- package/dist/lib/neutral/update-tasks-N65UQUHS.mjs.map +7 -0
- package/dist/types/src/blueprints/agent/blueprint.d.ts.map +1 -0
- package/dist/types/src/blueprints/agent/blueprint.test.d.ts.map +1 -0
- package/dist/types/src/blueprints/agent/index.d.ts +3 -0
- package/dist/types/src/blueprints/agent/index.d.ts.map +1 -0
- package/dist/types/src/blueprints/agent/operations/add-artifact.d.ts +4 -0
- package/dist/types/src/blueprints/agent/operations/add-artifact.d.ts.map +1 -0
- package/dist/types/src/blueprints/agent/operations/agent.d.ts.map +1 -0
- package/dist/types/src/blueprints/{project/functions → agent/operations}/definitions.d.ts +68 -51
- package/dist/types/src/blueprints/agent/operations/definitions.d.ts.map +1 -0
- package/dist/types/src/blueprints/agent/operations/get-context.d.ts +4 -0
- package/dist/types/src/blueprints/agent/operations/get-context.d.ts.map +1 -0
- package/dist/types/src/blueprints/{project/functions → agent/operations}/index.d.ts +1 -1
- package/dist/types/src/blueprints/agent/operations/index.d.ts.map +1 -0
- package/dist/types/src/blueprints/agent/operations/qualifier.d.ts +5 -0
- package/dist/types/src/blueprints/agent/operations/qualifier.d.ts.map +1 -0
- package/dist/types/src/blueprints/agent-wizard/blueprint.d.ts.map +1 -0
- package/dist/types/src/blueprints/agent-wizard/index.d.ts +3 -0
- package/dist/types/src/blueprints/agent-wizard/index.d.ts.map +1 -0
- package/dist/types/src/blueprints/{project-wizard/functions/project-rules.d.ts → agent-wizard/operations/agent-rules.d.ts} +1 -1
- package/dist/types/src/blueprints/agent-wizard/operations/agent-rules.d.ts.map +1 -0
- package/dist/types/src/blueprints/agent-wizard/operations/create-agent.d.ts +56 -0
- package/dist/types/src/blueprints/agent-wizard/operations/create-agent.d.ts.map +1 -0
- package/dist/types/src/blueprints/agent-wizard/operations/definitions.d.ts +105 -0
- package/dist/types/src/blueprints/agent-wizard/operations/definitions.d.ts.map +1 -0
- package/dist/types/src/blueprints/{project-wizard/functions → agent-wizard/operations}/index.d.ts +1 -1
- package/dist/types/src/blueprints/agent-wizard/operations/index.d.ts.map +1 -0
- package/dist/types/src/blueprints/{project-wizard/functions → agent-wizard/operations}/sync-triggers.d.ts +24 -19
- package/dist/types/src/blueprints/agent-wizard/operations/sync-triggers.d.ts.map +1 -0
- package/dist/types/src/blueprints/automation/blueprint.d.ts.map +1 -1
- package/dist/types/src/blueprints/blueprint-manager/index.d.ts +1 -1
- package/dist/types/src/blueprints/blueprint-manager/index.d.ts.map +1 -1
- package/dist/types/src/blueprints/blueprint-manager/{functions → operations}/definitions.d.ts +19 -19
- package/dist/types/src/blueprints/blueprint-manager/operations/definitions.d.ts.map +1 -0
- package/dist/types/src/blueprints/blueprint-manager/{functions → operations}/enable-blueprints.d.ts +10 -10
- package/dist/types/src/blueprints/blueprint-manager/operations/enable-blueprints.d.ts.map +1 -0
- package/dist/types/src/blueprints/blueprint-manager/{functions → operations}/index.d.ts +1 -1
- package/dist/types/src/blueprints/blueprint-manager/operations/index.d.ts.map +1 -0
- package/dist/types/src/blueprints/blueprint-manager/{functions → operations}/query-blueprints.d.ts +9 -8
- package/dist/types/src/blueprints/blueprint-manager/operations/query-blueprints.d.ts.map +1 -0
- package/dist/types/src/blueprints/database/index.d.ts +1 -1
- package/dist/types/src/blueprints/database/index.d.ts.map +1 -1
- package/dist/types/src/blueprints/database/operations/context-add.d.ts +7 -0
- package/dist/types/src/blueprints/database/operations/context-add.d.ts.map +1 -0
- package/dist/types/src/blueprints/database/operations/context-remove.d.ts +7 -0
- package/dist/types/src/blueprints/database/operations/context-remove.d.ts.map +1 -0
- package/dist/types/src/blueprints/database/operations/definitions.d.ts +65 -0
- package/dist/types/src/blueprints/database/operations/definitions.d.ts.map +1 -0
- package/dist/types/src/blueprints/database/{functions → operations}/index.d.ts +1 -1
- package/dist/types/src/blueprints/database/operations/index.d.ts.map +1 -0
- package/dist/types/src/blueprints/database/operations/load.d.ts +7 -0
- package/dist/types/src/blueprints/database/operations/load.d.ts.map +1 -0
- package/dist/types/src/blueprints/database/operations/object-create.d.ts.map +1 -0
- package/dist/types/src/blueprints/database/{functions → operations}/object-delete.d.ts +1 -1
- package/dist/types/src/blueprints/database/operations/object-delete.d.ts.map +1 -0
- package/dist/types/src/blueprints/database/operations/object-update.d.ts +10 -0
- package/dist/types/src/blueprints/database/operations/object-update.d.ts.map +1 -0
- package/dist/types/src/blueprints/database/{functions → operations}/query.d.ts +2 -3
- package/dist/types/src/blueprints/database/operations/query.d.ts.map +1 -0
- package/dist/types/src/blueprints/database/operations/relation-create.d.ts +10 -0
- package/dist/types/src/blueprints/database/operations/relation-create.d.ts.map +1 -0
- package/dist/types/src/blueprints/database/operations/relation-delete.d.ts +7 -0
- package/dist/types/src/blueprints/database/operations/relation-delete.d.ts.map +1 -0
- package/dist/types/src/blueprints/database/operations/schema-add.d.ts.map +1 -0
- package/dist/types/src/blueprints/database/operations/schema-list.d.ts.map +1 -0
- package/dist/types/src/blueprints/database/operations/tag-add.d.ts +11 -0
- package/dist/types/src/blueprints/database/operations/tag-add.d.ts.map +1 -0
- package/dist/types/src/blueprints/database/operations/tag-remove.d.ts +11 -0
- package/dist/types/src/blueprints/database/operations/tag-remove.d.ts.map +1 -0
- package/dist/types/src/blueprints/delegation/blueprint.d.ts +4 -0
- package/dist/types/src/blueprints/delegation/blueprint.d.ts.map +1 -0
- package/dist/types/src/blueprints/delegation/index.d.ts +3 -0
- package/dist/types/src/blueprints/delegation/index.d.ts.map +1 -0
- package/dist/types/src/blueprints/delegation/operations/delegate-task.d.ts +14 -0
- package/dist/types/src/blueprints/delegation/operations/delegate-task.d.ts.map +1 -0
- package/dist/types/src/blueprints/delegation/operations/delegate-task.test.d.ts +2 -0
- package/dist/types/src/blueprints/delegation/operations/delegate-task.test.d.ts.map +1 -0
- package/dist/types/src/blueprints/delegation/operations/index.d.ts +4 -0
- package/dist/types/src/blueprints/delegation/operations/index.d.ts.map +1 -0
- package/dist/types/src/blueprints/discord/index.d.ts +1 -1
- package/dist/types/src/blueprints/discord/index.d.ts.map +1 -1
- package/dist/types/src/blueprints/discord/{functions → operations}/definitions.d.ts +2 -3
- package/dist/types/src/blueprints/discord/operations/definitions.d.ts.map +1 -0
- package/dist/types/src/blueprints/discord/{functions → operations}/fetch-messages.d.ts +2 -3
- package/dist/types/src/blueprints/discord/operations/fetch-messages.d.ts.map +1 -0
- package/dist/types/src/blueprints/discord/operations/fetch-messages.test.d.ts.map +1 -0
- package/dist/types/src/blueprints/discord/{functions → operations}/index.d.ts +1 -1
- package/dist/types/src/blueprints/discord/operations/index.d.ts.map +1 -0
- package/dist/types/src/blueprints/github/index.d.ts +1 -1
- package/dist/types/src/blueprints/github/index.d.ts.map +1 -1
- package/dist/types/src/blueprints/github/operations/definitions.d.ts +7 -0
- package/dist/types/src/blueprints/github/operations/definitions.d.ts.map +1 -0
- package/dist/types/src/blueprints/github/{functions → operations}/fetch-prs.d.ts +2 -3
- package/dist/types/src/blueprints/github/operations/fetch-prs.d.ts.map +1 -0
- package/dist/types/src/blueprints/github/{functions → operations}/index.d.ts +1 -1
- package/dist/types/src/blueprints/github/operations/index.d.ts.map +1 -0
- package/dist/types/src/blueprints/index.d.ts +8 -7
- package/dist/types/src/blueprints/index.d.ts.map +1 -1
- package/dist/types/src/blueprints/linear/index.d.ts +1 -1
- package/dist/types/src/blueprints/linear/index.d.ts.map +1 -1
- package/dist/types/src/blueprints/linear/operations/definitions.d.ts +6 -0
- package/dist/types/src/blueprints/linear/operations/definitions.d.ts.map +1 -0
- package/dist/types/src/blueprints/linear/{functions → operations}/index.d.ts +1 -1
- package/dist/types/src/blueprints/linear/operations/index.d.ts.map +1 -0
- package/dist/types/src/blueprints/linear/operations/linear.test.d.ts.map +1 -0
- package/dist/types/src/blueprints/linear/{functions → operations}/sync-issues.d.ts +2 -3
- package/dist/types/src/blueprints/linear/operations/sync-issues.d.ts.map +1 -0
- package/dist/types/src/blueprints/memory/index.d.ts +1 -1
- package/dist/types/src/blueprints/memory/index.d.ts.map +1 -1
- package/dist/types/src/blueprints/memory/{functions → operations}/definitions.d.ts +2 -2
- package/dist/types/src/blueprints/memory/operations/definitions.d.ts.map +1 -0
- package/dist/types/src/blueprints/memory/{functions → operations}/delete.d.ts +2 -2
- package/dist/types/src/blueprints/memory/operations/delete.d.ts.map +1 -0
- package/dist/types/src/blueprints/memory/{functions → operations}/index.d.ts +1 -1
- package/dist/types/src/blueprints/memory/operations/index.d.ts.map +1 -0
- package/dist/types/src/blueprints/memory/operations/query.d.ts.map +1 -0
- package/dist/types/src/blueprints/memory/operations/save.d.ts.map +1 -0
- package/dist/types/src/blueprints/planning/index.d.ts +1 -1
- package/dist/types/src/blueprints/planning/index.d.ts.map +1 -1
- package/dist/types/src/blueprints/planning/{functions → operations}/index.d.ts +1 -1
- package/dist/types/src/blueprints/planning/operations/index.d.ts.map +1 -0
- package/dist/types/src/blueprints/planning/operations/update-tasks.d.ts +24 -0
- package/dist/types/src/blueprints/planning/operations/update-tasks.d.ts.map +1 -0
- package/dist/types/src/blueprints/planning/operations/update-tasks.test.d.ts +2 -0
- package/dist/types/src/blueprints/planning/operations/update-tasks.test.d.ts.map +1 -0
- package/dist/types/src/blueprints/testing.d.ts +5 -5
- package/dist/types/src/blueprints/testing.d.ts.map +1 -1
- package/dist/types/src/blueprints/websearch/index.d.ts +1 -1
- package/dist/types/src/blueprints/websearch/index.d.ts.map +1 -1
- package/dist/types/src/blueprints/websearch/operations/definitions.d.ts.map +1 -0
- package/dist/types/src/blueprints/websearch/operations/fetch.d.ts.map +1 -0
- package/dist/types/src/blueprints/websearch/{functions → operations}/index.d.ts +1 -1
- package/dist/types/src/blueprints/websearch/operations/index.d.ts.map +1 -0
- package/dist/types/src/blueprints/websearch/toolkit.d.ts +1 -1
- package/dist/types/src/crud/graph.d.ts +8 -11
- package/dist/types/src/crud/graph.d.ts.map +1 -1
- package/dist/types/src/errors.d.ts +3 -3
- package/dist/types/src/errors.d.ts.map +1 -1
- package/dist/types/src/functions/agent/blueprint-resolution.test.d.ts +2 -0
- package/dist/types/src/functions/agent/blueprint-resolution.test.d.ts.map +1 -0
- package/dist/types/src/functions/agent/definitions.d.ts +22 -30
- package/dist/types/src/functions/agent/definitions.d.ts.map +1 -1
- package/dist/types/src/functions/agent/prompt.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -0
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/supervisor/delegation-strategy.d.ts +9 -0
- package/dist/types/src/supervisor/delegation-strategy.d.ts.map +1 -0
- package/dist/types/src/supervisor/index.d.ts +2 -0
- package/dist/types/src/supervisor/index.d.ts.map +1 -0
- package/dist/types/src/sync/sync.d.ts +1 -2
- package/dist/types/src/sync/sync.d.ts.map +1 -1
- package/dist/types/src/testing/plugins.d.ts +1 -1
- package/dist/types/src/testing/plugins.d.ts.map +1 -1
- package/dist/types/src/toolkits/WebToolkit.d.ts +1 -1
- package/dist/types/src/toolkits/WebToolkit.d.ts.map +1 -1
- package/dist/types/src/types/Agent.d.ts +47 -30
- package/dist/types/src/types/Agent.d.ts.map +1 -1
- package/dist/types/src/types/Agent.test.d.ts +2 -0
- package/dist/types/src/types/Agent.test.d.ts.map +1 -0
- package/dist/types/src/types/Chat.d.ts +17 -20
- package/dist/types/src/types/Chat.d.ts.map +1 -1
- package/dist/types/src/types/McpServer.d.ts +5 -3
- package/dist/types/src/types/McpServer.d.ts.map +1 -1
- package/dist/types/src/types/Memory.d.ts +1 -2
- package/dist/types/src/types/Memory.d.ts.map +1 -1
- package/dist/types/src/types/Plan.d.ts +28 -25
- package/dist/types/src/types/Plan.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +32 -30
- package/src/blueprints/AGENTS.md +13 -0
- package/src/blueprints/agent/blueprint.conversations.json +1 -0
- package/src/blueprints/{project → agent}/blueprint.test.ts +40 -36
- package/src/blueprints/{project → agent}/blueprint.ts +3 -3
- package/src/blueprints/agent/index.ts +6 -0
- package/src/blueprints/{project/functions → agent/operations}/add-artifact.ts +3 -13
- package/src/blueprints/{project/functions → agent/operations}/agent.ts +6 -6
- package/src/blueprints/{project/functions → agent/operations}/definitions.ts +19 -15
- package/src/blueprints/{project/functions → agent/operations}/get-context.ts +17 -5
- package/src/blueprints/{project/functions → agent/operations}/index.ts +1 -1
- package/src/blueprints/{project/functions → agent/operations}/qualifier.ts +9 -8
- package/src/blueprints/{project-wizard → agent-wizard}/blueprint.ts +2 -2
- package/src/blueprints/{project-wizard → agent-wizard}/index.ts +1 -1
- package/src/blueprints/{project-wizard/functions/create-project.ts → agent-wizard/operations/create-agent.ts} +2 -3
- package/src/blueprints/{project-wizard/functions → agent-wizard/operations}/definitions.ts +10 -8
- package/src/blueprints/{project-wizard/functions → agent-wizard/operations}/index.ts +3 -3
- package/src/blueprints/{project-wizard/functions → agent-wizard/operations}/sync-triggers.ts +51 -41
- package/src/blueprints/automation/blueprint.ts +12 -14
- package/src/blueprints/blueprint-manager/blueprint.conversations.json +1 -1
- package/src/blueprints/blueprint-manager/blueprint.test.ts +27 -70
- package/src/blueprints/blueprint-manager/blueprint.ts +6 -6
- package/src/blueprints/blueprint-manager/index.ts +1 -1
- package/src/blueprints/blueprint-manager/operations/definitions.ts +48 -0
- package/src/blueprints/blueprint-manager/{functions → operations}/enable-blueprints.ts +11 -9
- package/src/blueprints/blueprint-manager/{functions → operations}/index.ts +1 -2
- package/src/blueprints/blueprint-manager/operations/query-blueprints.ts +19 -0
- package/src/blueprints/browser/blueprint.conversations.json +1 -0
- package/src/blueprints/browser/blueprint.test.ts +10 -10
- package/src/blueprints/browser/blueprint.ts +1 -1
- package/src/blueprints/database/blueprint.conversations.json +1 -1
- package/src/blueprints/database/blueprint.test.ts +38 -39
- package/src/blueprints/database/blueprint.ts +2 -2
- package/src/blueprints/database/index.ts +1 -16
- package/src/blueprints/database/{functions → operations}/context-add.ts +2 -2
- package/src/blueprints/database/{functions → operations}/context-remove.ts +2 -2
- package/src/blueprints/database/{functions → operations}/definitions.ts +41 -27
- package/src/blueprints/database/{functions → operations}/index.ts +1 -1
- package/src/blueprints/database/{functions → operations}/object-create.ts +8 -6
- package/src/blueprints/database/{functions → operations}/object-update.ts +1 -1
- package/src/blueprints/database/{functions → operations}/query.ts +17 -12
- package/src/blueprints/database/{functions → operations}/relation-create.ts +7 -5
- package/src/blueprints/database/operations/schema-add.ts +23 -0
- package/src/blueprints/database/{functions → operations}/schema-list.ts +12 -9
- package/src/blueprints/database/{functions → operations}/tag-add.ts +2 -3
- package/src/blueprints/database/{functions → operations}/tag-remove.ts +2 -3
- package/src/blueprints/delegation/blueprint.ts +24 -0
- package/src/blueprints/delegation/index.ts +6 -0
- package/src/blueprints/delegation/operations/delegate-task.test.ts +55 -0
- package/src/blueprints/delegation/operations/delegate-task.ts +57 -0
- package/src/blueprints/delegation/operations/index.ts +9 -0
- package/src/blueprints/discord/blueprint.ts +2 -2
- package/src/blueprints/discord/index.ts +1 -1
- package/src/blueprints/discord/{functions → operations}/definitions.ts +5 -4
- package/src/blueprints/discord/{functions → operations}/fetch-messages.test.ts +8 -3
- package/src/blueprints/discord/{functions → operations}/fetch-messages.ts +2 -3
- package/src/blueprints/discord/{functions → operations}/index.ts +1 -1
- package/src/blueprints/github/index.ts +1 -1
- package/src/blueprints/github/{functions → operations}/definitions.ts +5 -4
- package/src/blueprints/github/{functions → operations}/fetch-prs.ts +3 -3
- package/src/blueprints/github/{functions → operations}/index.ts +1 -1
- package/src/blueprints/index.ts +8 -7
- package/src/blueprints/linear/blueprint.ts +2 -2
- package/src/blueprints/linear/index.ts +1 -1
- package/src/blueprints/linear/{functions → operations}/definitions.ts +5 -4
- package/src/blueprints/linear/{functions → operations}/index.ts +1 -1
- package/src/blueprints/linear/{functions → operations}/linear.test.ts +5 -7
- package/src/blueprints/linear/{functions → operations}/sync-issues.ts +6 -7
- package/src/blueprints/memory/blueprint.conversations.json +1 -1
- package/src/blueprints/memory/blueprint.test.ts +11 -12
- package/src/blueprints/memory/blueprint.ts +2 -2
- package/src/blueprints/memory/index.ts +1 -1
- package/src/blueprints/memory/{functions → operations}/definitions.ts +7 -3
- package/src/blueprints/memory/{functions → operations}/index.ts +1 -1
- package/src/blueprints/memory/{functions → operations}/query.ts +1 -1
- package/src/blueprints/planning/blueprint.ts +2 -2
- package/src/blueprints/planning/index.ts +1 -1
- package/src/blueprints/planning/{functions → operations}/index.ts +1 -1
- package/src/blueprints/planning/{functions/definitions.ts → operations/update-tasks.md} +29 -50
- package/src/blueprints/planning/operations/update-tasks.test.ts +55 -0
- package/src/blueprints/planning/operations/update-tasks.ts +71 -0
- package/src/blueprints/testing.ts +12 -6
- package/src/blueprints/websearch/blueprint.conversations.json +1 -1
- package/src/blueprints/websearch/blueprint.test.ts +3 -2
- package/src/blueprints/websearch/blueprint.ts +3 -3
- package/src/blueprints/websearch/index.ts +1 -1
- package/src/blueprints/websearch/{functions → operations}/definitions.ts +3 -1
- package/src/blueprints/websearch/operations/fetch.ts +26 -0
- package/src/blueprints/websearch/{functions → operations}/index.ts +1 -1
- package/src/crud/graph.test.ts +1 -1
- package/src/crud/graph.ts +149 -165
- package/src/errors.ts +3 -3
- package/src/functions/agent/blueprint-resolution.test.ts +131 -0
- package/src/functions/agent/definitions.ts +14 -9
- package/src/functions/agent/prompt.conversations.json +1 -1
- package/src/functions/agent/prompt.test.ts +11 -16
- package/src/functions/agent/prompt.ts +27 -24
- package/src/index.ts +1 -0
- package/src/supervisor/delegation-strategy.ts +188 -0
- package/src/supervisor/index.ts +5 -0
- package/src/sync/sync.ts +9 -8
- package/src/testing/plugins.tsx +10 -15
- package/src/toolkits/WebToolkit.ts +13 -2
- package/src/types/Agent.test.ts +93 -0
- package/src/types/Agent.ts +97 -62
- package/src/types/Chat.ts +11 -21
- package/src/types/McpServer.ts +10 -16
- package/src/types/Memory.ts +5 -7
- package/src/types/Plan.ts +14 -17
- package/dist/lib/neutral/add-artifact-XDFUXRY5.mjs +0 -30
- package/dist/lib/neutral/add-artifact-XDFUXRY5.mjs.map +0 -7
- package/dist/lib/neutral/agent-6OHUAIA2.mjs.map +0 -7
- package/dist/lib/neutral/chunk-4T3LJGXI.mjs.map +0 -7
- package/dist/lib/neutral/chunk-CVUA23QI.mjs.map +0 -7
- package/dist/lib/neutral/chunk-EJAQUAKM.mjs.map +0 -7
- package/dist/lib/neutral/chunk-GSG4JGIY.mjs.map +0 -7
- package/dist/lib/neutral/chunk-JN4GARRQ.mjs.map +0 -7
- package/dist/lib/neutral/chunk-KGU725LW.mjs.map +0 -7
- package/dist/lib/neutral/chunk-NR3GTWRC.mjs.map +0 -7
- package/dist/lib/neutral/chunk-P5LAPHCG.mjs +0 -140
- package/dist/lib/neutral/chunk-P5LAPHCG.mjs.map +0 -7
- package/dist/lib/neutral/chunk-SVI25Z2Y.mjs.map +0 -7
- package/dist/lib/neutral/chunk-VSDP6SRY.mjs.map +0 -7
- package/dist/lib/neutral/chunk-WIV7ZVRS.mjs.map +0 -7
- package/dist/lib/neutral/chunk-WLR3BGO4.mjs.map +0 -7
- package/dist/lib/neutral/chunk-YSYNXOZA.mjs +0 -68
- package/dist/lib/neutral/chunk-YSYNXOZA.mjs.map +0 -7
- package/dist/lib/neutral/chunk-YXOVSRFU.mjs.map +0 -7
- package/dist/lib/neutral/context-add-IIDPRRVB.mjs.map +0 -7
- package/dist/lib/neutral/context-remove-RDYV4PD4.mjs.map +0 -7
- package/dist/lib/neutral/create-project-MPAMKQ3T.mjs.map +0 -7
- package/dist/lib/neutral/enable-blueprints-LELPQHY5.mjs.map +0 -7
- package/dist/lib/neutral/fetch-KHMHV7JR.mjs +0 -16
- package/dist/lib/neutral/fetch-KHMHV7JR.mjs.map +0 -7
- package/dist/lib/neutral/fetch-messages-OS74FP76.mjs.map +0 -7
- package/dist/lib/neutral/get-context-JRTOOA5O.mjs.map +0 -7
- package/dist/lib/neutral/object-create-52Z7YKIA.mjs +0 -35
- package/dist/lib/neutral/object-create-52Z7YKIA.mjs.map +0 -7
- package/dist/lib/neutral/project-JAU3A7AX.mjs +0 -23
- package/dist/lib/neutral/prompt-4UMXX6QU.mjs.map +0 -7
- package/dist/lib/neutral/qualifier-7BUCOEKK.mjs.map +0 -7
- package/dist/lib/neutral/query-B3NOYFCK.mjs.map +0 -7
- package/dist/lib/neutral/query-blueprints-Z576ABT5.mjs +0 -17
- package/dist/lib/neutral/query-blueprints-Z576ABT5.mjs.map +0 -7
- package/dist/lib/neutral/relation-create-Z3NGW4VU.mjs +0 -34
- package/dist/lib/neutral/relation-create-Z3NGW4VU.mjs.map +0 -7
- package/dist/lib/neutral/schema-add-4TXJO2V7.mjs +0 -24
- package/dist/lib/neutral/schema-add-4TXJO2V7.mjs.map +0 -7
- package/dist/lib/neutral/schema-list-Q7HRRKGR.mjs +0 -39
- package/dist/lib/neutral/schema-list-Q7HRRKGR.mjs.map +0 -7
- package/dist/lib/neutral/sync-issues-A2RJNPEF.mjs.map +0 -7
- package/dist/lib/neutral/sync-triggers-NV4JCRN5.mjs.map +0 -7
- package/dist/lib/neutral/tag-add-5NOHUTIE.mjs.map +0 -7
- package/dist/lib/neutral/tag-remove-QTKYDJAW.mjs.map +0 -7
- package/dist/lib/neutral/update-blueprints-K7A5SHBZ.mjs +0 -17
- package/dist/lib/neutral/update-blueprints-K7A5SHBZ.mjs.map +0 -7
- package/dist/lib/neutral/update-tasks-UGGHWXT5.mjs +0 -46
- package/dist/lib/neutral/update-tasks-UGGHWXT5.mjs.map +0 -7
- package/dist/types/src/blueprints/blueprint-manager/functions/definitions.d.ts.map +0 -1
- package/dist/types/src/blueprints/blueprint-manager/functions/enable-blueprints.d.ts.map +0 -1
- package/dist/types/src/blueprints/blueprint-manager/functions/index.d.ts.map +0 -1
- package/dist/types/src/blueprints/blueprint-manager/functions/query-blueprints.d.ts.map +0 -1
- package/dist/types/src/blueprints/blueprint-manager/functions/update-blueprints.d.ts +0 -5
- package/dist/types/src/blueprints/blueprint-manager/functions/update-blueprints.d.ts.map +0 -1
- package/dist/types/src/blueprints/database/functions/context-add.d.ts +0 -7
- package/dist/types/src/blueprints/database/functions/context-add.d.ts.map +0 -1
- package/dist/types/src/blueprints/database/functions/context-remove.d.ts +0 -7
- package/dist/types/src/blueprints/database/functions/context-remove.d.ts.map +0 -1
- package/dist/types/src/blueprints/database/functions/definitions.d.ts +0 -59
- package/dist/types/src/blueprints/database/functions/definitions.d.ts.map +0 -1
- package/dist/types/src/blueprints/database/functions/index.d.ts.map +0 -1
- package/dist/types/src/blueprints/database/functions/load.d.ts +0 -7
- package/dist/types/src/blueprints/database/functions/load.d.ts.map +0 -1
- package/dist/types/src/blueprints/database/functions/object-create.d.ts.map +0 -1
- package/dist/types/src/blueprints/database/functions/object-delete.d.ts.map +0 -1
- package/dist/types/src/blueprints/database/functions/object-update.d.ts +0 -10
- package/dist/types/src/blueprints/database/functions/object-update.d.ts.map +0 -1
- package/dist/types/src/blueprints/database/functions/query.d.ts.map +0 -1
- package/dist/types/src/blueprints/database/functions/relation-create.d.ts +0 -10
- package/dist/types/src/blueprints/database/functions/relation-create.d.ts.map +0 -1
- package/dist/types/src/blueprints/database/functions/relation-delete.d.ts +0 -7
- package/dist/types/src/blueprints/database/functions/relation-delete.d.ts.map +0 -1
- package/dist/types/src/blueprints/database/functions/schema-add.d.ts.map +0 -1
- package/dist/types/src/blueprints/database/functions/schema-list.d.ts.map +0 -1
- package/dist/types/src/blueprints/database/functions/tag-add.d.ts +0 -8
- package/dist/types/src/blueprints/database/functions/tag-add.d.ts.map +0 -1
- package/dist/types/src/blueprints/database/functions/tag-remove.d.ts +0 -8
- package/dist/types/src/blueprints/database/functions/tag-remove.d.ts.map +0 -1
- package/dist/types/src/blueprints/discord/functions/definitions.d.ts.map +0 -1
- package/dist/types/src/blueprints/discord/functions/fetch-messages.d.ts.map +0 -1
- package/dist/types/src/blueprints/discord/functions/fetch-messages.test.d.ts.map +0 -1
- package/dist/types/src/blueprints/discord/functions/index.d.ts.map +0 -1
- package/dist/types/src/blueprints/github/functions/definitions.d.ts +0 -8
- package/dist/types/src/blueprints/github/functions/definitions.d.ts.map +0 -1
- package/dist/types/src/blueprints/github/functions/fetch-prs.d.ts.map +0 -1
- package/dist/types/src/blueprints/github/functions/index.d.ts.map +0 -1
- package/dist/types/src/blueprints/linear/functions/definitions.d.ts +0 -7
- package/dist/types/src/blueprints/linear/functions/definitions.d.ts.map +0 -1
- package/dist/types/src/blueprints/linear/functions/index.d.ts.map +0 -1
- package/dist/types/src/blueprints/linear/functions/linear.test.d.ts.map +0 -1
- package/dist/types/src/blueprints/linear/functions/sync-issues.d.ts.map +0 -1
- package/dist/types/src/blueprints/memory/functions/definitions.d.ts.map +0 -1
- package/dist/types/src/blueprints/memory/functions/delete.d.ts.map +0 -1
- package/dist/types/src/blueprints/memory/functions/index.d.ts.map +0 -1
- package/dist/types/src/blueprints/memory/functions/query.d.ts.map +0 -1
- package/dist/types/src/blueprints/memory/functions/save.d.ts.map +0 -1
- package/dist/types/src/blueprints/planning/functions/definitions.d.ts +0 -11
- package/dist/types/src/blueprints/planning/functions/definitions.d.ts.map +0 -1
- package/dist/types/src/blueprints/planning/functions/index.d.ts.map +0 -1
- package/dist/types/src/blueprints/planning/functions/update-tasks.d.ts +0 -11
- package/dist/types/src/blueprints/planning/functions/update-tasks.d.ts.map +0 -1
- package/dist/types/src/blueprints/project/blueprint.d.ts.map +0 -1
- package/dist/types/src/blueprints/project/blueprint.test.d.ts.map +0 -1
- package/dist/types/src/blueprints/project/functions/add-artifact.d.ts +0 -8
- package/dist/types/src/blueprints/project/functions/add-artifact.d.ts.map +0 -1
- package/dist/types/src/blueprints/project/functions/agent.d.ts.map +0 -1
- package/dist/types/src/blueprints/project/functions/definitions.d.ts.map +0 -1
- package/dist/types/src/blueprints/project/functions/get-context.d.ts +0 -15
- package/dist/types/src/blueprints/project/functions/get-context.d.ts.map +0 -1
- package/dist/types/src/blueprints/project/functions/index.d.ts.map +0 -1
- package/dist/types/src/blueprints/project/functions/qualifier.d.ts +0 -73
- package/dist/types/src/blueprints/project/functions/qualifier.d.ts.map +0 -1
- package/dist/types/src/blueprints/project/index.d.ts +0 -3
- package/dist/types/src/blueprints/project/index.d.ts.map +0 -1
- package/dist/types/src/blueprints/project-wizard/blueprint.d.ts.map +0 -1
- package/dist/types/src/blueprints/project-wizard/functions/create-project.d.ts +0 -52
- package/dist/types/src/blueprints/project-wizard/functions/create-project.d.ts.map +0 -1
- package/dist/types/src/blueprints/project-wizard/functions/definitions.d.ts +0 -97
- package/dist/types/src/blueprints/project-wizard/functions/definitions.d.ts.map +0 -1
- package/dist/types/src/blueprints/project-wizard/functions/index.d.ts.map +0 -1
- package/dist/types/src/blueprints/project-wizard/functions/project-rules.d.ts.map +0 -1
- package/dist/types/src/blueprints/project-wizard/functions/sync-triggers.d.ts.map +0 -1
- package/dist/types/src/blueprints/project-wizard/index.d.ts +0 -3
- package/dist/types/src/blueprints/project-wizard/index.d.ts.map +0 -1
- package/dist/types/src/blueprints/websearch/functions/definitions.d.ts.map +0 -1
- package/dist/types/src/blueprints/websearch/functions/fetch.d.ts.map +0 -1
- package/dist/types/src/blueprints/websearch/functions/index.d.ts.map +0 -1
- package/src/blueprints/blueprint-manager/functions/definitions.ts +0 -58
- package/src/blueprints/blueprint-manager/functions/query-blueprints.ts +0 -19
- package/src/blueprints/blueprint-manager/functions/update-blueprints.ts +0 -19
- package/src/blueprints/database/functions/schema-add.ts +0 -28
- package/src/blueprints/planning/functions/update-tasks.ts +0 -45
- package/src/blueprints/project/blueprint.conversations.json +0 -1
- package/src/blueprints/project/index.ts +0 -6
- package/src/blueprints/websearch/functions/fetch.ts +0 -18
- /package/dist/lib/neutral/{project-JAU3A7AX.mjs.map → definitions-6HU2P7R7.mjs.map} +0 -0
- /package/dist/types/src/blueprints/{project → agent}/blueprint.d.ts +0 -0
- /package/dist/types/src/blueprints/{project → agent}/blueprint.test.d.ts +0 -0
- /package/dist/types/src/blueprints/{project/functions → agent/operations}/agent.d.ts +0 -0
- /package/dist/types/src/blueprints/{project-wizard → agent-wizard}/blueprint.d.ts +0 -0
- /package/dist/types/src/blueprints/database/{functions → operations}/object-create.d.ts +0 -0
- /package/dist/types/src/blueprints/database/{functions → operations}/schema-add.d.ts +0 -0
- /package/dist/types/src/blueprints/database/{functions → operations}/schema-list.d.ts +0 -0
- /package/dist/types/src/blueprints/discord/{functions → operations}/fetch-messages.test.d.ts +0 -0
- /package/dist/types/src/blueprints/linear/{functions → operations}/linear.test.d.ts +0 -0
- /package/dist/types/src/blueprints/memory/{functions → operations}/query.d.ts +0 -0
- /package/dist/types/src/blueprints/memory/{functions → operations}/save.d.ts +0 -0
- /package/dist/types/src/blueprints/websearch/{functions → operations}/definitions.d.ts +0 -0
- /package/dist/types/src/blueprints/websearch/{functions → operations}/fetch.d.ts +0 -0
- /package/src/blueprints/{project-wizard/functions/project-rules.ts → agent-wizard/operations/agent-rules.ts} +0 -0
- /package/src/blueprints/database/{functions → operations}/load.ts +0 -0
- /package/src/blueprints/database/{functions → operations}/object-delete.ts +0 -0
- /package/src/blueprints/database/{functions → operations}/relation-delete.ts +0 -0
- /package/src/blueprints/memory/{functions → operations}/delete.ts +0 -0
- /package/src/blueprints/memory/{functions → operations}/save.ts +0 -0
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { describe, it } from '@effect/vitest';
|
|
6
|
+
import * as Duration from 'effect/Duration';
|
|
7
|
+
import * as Effect from 'effect/Effect';
|
|
8
|
+
|
|
9
|
+
import { AiContext } from '@dxos/assistant';
|
|
10
|
+
import { Blueprint, Routine } from '@dxos/compute';
|
|
11
|
+
import { Database, Feed, Ref } from '@dxos/echo';
|
|
12
|
+
import { TestHelpers } from '@dxos/effect/testing';
|
|
13
|
+
import { AssistantTestLayer } from '@dxos/functions-runtime/testing';
|
|
14
|
+
import { Text } from '@dxos/schema';
|
|
15
|
+
|
|
16
|
+
import { WebSearchBlueprint } from '../../blueprints';
|
|
17
|
+
|
|
18
|
+
// Regression coverage for the CRM-routine failure: blueprints live only in the registry
|
|
19
|
+
// (referenced via `Ref.fromURI(Blueprint.registryURI(key))`), never forked into the space DB.
|
|
20
|
+
//
|
|
21
|
+
// `AiContext.Binder.bind` persists each bound blueprint ref to the conversation feed. A later
|
|
22
|
+
// turn (or spawned process) re-reads that ref with an empty in-memory cache and must resolve it
|
|
23
|
+
// on its own. If the routine's registry blueprint is bound by its registry DXN ref, resolution
|
|
24
|
+
// stays in the registry and succeeds. If it is re-wrapped with `Ref.make` first (minting an
|
|
25
|
+
// EID ref to an object that only exists in the registry, never in the DB), the persisted ref
|
|
26
|
+
// dangles — in production the DB query blocks for its full 30s timeout; with a fresh binder here
|
|
27
|
+
// it simply resolves to nothing.
|
|
28
|
+
|
|
29
|
+
const TestLayer = AssistantTestLayer({
|
|
30
|
+
types: [Text.Text],
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
const blueprintKey = 'org.dxos.blueprint.webSearch';
|
|
34
|
+
|
|
35
|
+
describe('Blueprint binding resolution (registry refs)', () => {
|
|
36
|
+
it.effect(
|
|
37
|
+
'a registry blueprint bound by its registry ref survives a feed round-trip',
|
|
38
|
+
Effect.fnUntraced(
|
|
39
|
+
function* ({ expect }) {
|
|
40
|
+
const { db } = yield* Database.Service;
|
|
41
|
+
|
|
42
|
+
// Register the web-search blueprint in the db registry (the resolver's registry),
|
|
43
|
+
// the same way `plugin-automation/RegistrySync` does in production.
|
|
44
|
+
db.registry.add([WebSearchBlueprint.make()]);
|
|
45
|
+
|
|
46
|
+
// Create a routine referencing the blueprint purely by registry URI. Once added to the
|
|
47
|
+
// DB its blueprint ref is a resolver-backed registry ref — exactly the ref `prompt.ts`
|
|
48
|
+
// binds.
|
|
49
|
+
const routine = yield* Database.add(
|
|
50
|
+
Routine.make({
|
|
51
|
+
name: 'resolution-test',
|
|
52
|
+
instructions: 'noop',
|
|
53
|
+
blueprints: [Ref.fromURI(Blueprint.registryURI(blueprintKey))],
|
|
54
|
+
}),
|
|
55
|
+
);
|
|
56
|
+
yield* Database.flush();
|
|
57
|
+
const registryRef = routine.blueprints[0];
|
|
58
|
+
|
|
59
|
+
const feed = yield* Database.add(Feed.make());
|
|
60
|
+
yield* Database.flush();
|
|
61
|
+
const runtime = yield* Effect.runtime<Feed.FeedService>();
|
|
62
|
+
|
|
63
|
+
// Bind the routine's own registry ref (the fix) and persist it to the feed.
|
|
64
|
+
const writer = new AiContext.Binder({ feed, runtime });
|
|
65
|
+
yield* Effect.promise(() => writer.open());
|
|
66
|
+
yield* Effect.promise(() => writer.bind({ blueprints: [registryRef], objects: [] }));
|
|
67
|
+
|
|
68
|
+
// A fresh binder on the same feed models the next agent turn / spawned process: no
|
|
69
|
+
// in-memory cache, so the persisted binding ref must resolve on its own.
|
|
70
|
+
const reader = new AiContext.Binder({ feed, runtime });
|
|
71
|
+
yield* Effect.promise(() => reader.open()).pipe(
|
|
72
|
+
Effect.timeoutFail({
|
|
73
|
+
duration: Duration.seconds(3),
|
|
74
|
+
onTimeout: () => new Error('TIMED OUT resolving bound blueprint on feed re-read'),
|
|
75
|
+
}),
|
|
76
|
+
);
|
|
77
|
+
|
|
78
|
+
const resolved = reader.getBlueprints();
|
|
79
|
+
expect(resolved.map((bp) => Blueprint.getKey(bp))).toContain(blueprintKey);
|
|
80
|
+
},
|
|
81
|
+
Effect.provide(TestLayer),
|
|
82
|
+
TestHelpers.provideTestContext,
|
|
83
|
+
),
|
|
84
|
+
{ timeout: 20_000 },
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
it.effect(
|
|
88
|
+
'a registry blueprint re-wrapped with Ref.make (EID ref) dangles on feed re-read',
|
|
89
|
+
Effect.fnUntraced(
|
|
90
|
+
function* ({ expect }) {
|
|
91
|
+
const { db } = yield* Database.Service;
|
|
92
|
+
db.registry.add([WebSearchBlueprint.make()]);
|
|
93
|
+
|
|
94
|
+
const routine = yield* Database.add(
|
|
95
|
+
Routine.make({
|
|
96
|
+
name: 'resolution-test',
|
|
97
|
+
instructions: 'noop',
|
|
98
|
+
blueprints: [Ref.fromURI(Blueprint.registryURI(blueprintKey))],
|
|
99
|
+
}),
|
|
100
|
+
);
|
|
101
|
+
yield* Database.flush();
|
|
102
|
+
const blueprint = yield* Database.load(routine.blueprints[0]);
|
|
103
|
+
|
|
104
|
+
const feed = yield* Database.add(Feed.make());
|
|
105
|
+
yield* Database.flush();
|
|
106
|
+
const runtime = yield* Effect.runtime<Feed.FeedService>();
|
|
107
|
+
|
|
108
|
+
// The pre-fix behaviour: re-wrap the resolved blueprint with `Ref.make`, minting an
|
|
109
|
+
// EID ref that addresses a blueprint which only exists in the registry.
|
|
110
|
+
const writer = new AiContext.Binder({ feed, runtime });
|
|
111
|
+
yield* Effect.promise(() => writer.open());
|
|
112
|
+
yield* Effect.promise(() => writer.bind({ blueprints: [Ref.make(blueprint)], objects: [] }));
|
|
113
|
+
|
|
114
|
+
const reader = new AiContext.Binder({ feed, runtime });
|
|
115
|
+
yield* Effect.promise(() => reader.open()).pipe(
|
|
116
|
+
Effect.timeoutFail({
|
|
117
|
+
duration: Duration.seconds(3),
|
|
118
|
+
onTimeout: () => new Error('TIMED OUT resolving bound blueprint on feed re-read'),
|
|
119
|
+
}),
|
|
120
|
+
);
|
|
121
|
+
|
|
122
|
+
// The EID ref cannot be recovered from the registry, so the fresh binder resolves nothing.
|
|
123
|
+
const resolved = reader.getBlueprints();
|
|
124
|
+
expect(resolved.map((bp) => Blueprint.getKey(bp))).not.toContain(blueprintKey);
|
|
125
|
+
},
|
|
126
|
+
Effect.provide(TestLayer),
|
|
127
|
+
TestHelpers.provideTestContext,
|
|
128
|
+
),
|
|
129
|
+
{ timeout: 20_000 },
|
|
130
|
+
);
|
|
131
|
+
});
|
|
@@ -5,18 +5,20 @@
|
|
|
5
5
|
import * as Schema from 'effect/Schema';
|
|
6
6
|
|
|
7
7
|
import { AiService, OpaqueToolkit, ModelName } from '@dxos/ai';
|
|
8
|
-
import { Routine } from '@dxos/compute';
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
8
|
+
import { Routine, Trace, Operation } from '@dxos/compute';
|
|
9
|
+
import { Database, Feed, Ref, Registry } from '@dxos/echo';
|
|
10
|
+
import { DXN } from '@dxos/keys';
|
|
11
|
+
import { Text } from '@dxos/schema';
|
|
12
12
|
|
|
13
13
|
import * as Chat from '../../types/Chat';
|
|
14
14
|
|
|
15
|
+
// TODO(dmaretskyi): Rename to RunRoutine.
|
|
15
16
|
export const AgentPrompt = Operation.make({
|
|
16
17
|
meta: {
|
|
17
|
-
key: 'org.dxos.function.prompt',
|
|
18
|
-
name: '
|
|
18
|
+
key: DXN.make('org.dxos.function.prompt'),
|
|
19
|
+
name: 'Run Routine',
|
|
19
20
|
description: 'Agentic worker that executes a provided prompt using blueprints and tools.',
|
|
21
|
+
icon: 'ph--brain--regular',
|
|
20
22
|
},
|
|
21
23
|
input: Schema.Struct({
|
|
22
24
|
prompt: Ref.Ref(Routine.Routine),
|
|
@@ -27,10 +29,10 @@ export const AgentPrompt = Operation.make({
|
|
|
27
29
|
chat: Schema.optional(Ref.Ref(Chat.Chat)),
|
|
28
30
|
|
|
29
31
|
/**
|
|
30
|
-
* @default
|
|
32
|
+
* @default ai.claude.model.claude-opus-4-6
|
|
31
33
|
*/
|
|
32
|
-
|
|
33
34
|
model: Schema.optional(ModelName),
|
|
35
|
+
|
|
34
36
|
/**
|
|
35
37
|
* Input object or data.
|
|
36
38
|
* References get auto-resolved.
|
|
@@ -42,12 +44,15 @@ export const AgentPrompt = Operation.make({
|
|
|
42
44
|
}),
|
|
43
45
|
}),
|
|
44
46
|
output: Schema.Any,
|
|
47
|
+
// ECHO types that the handler loads via Database.load(). Declaring them here ensures the
|
|
48
|
+
// runtime registers their schema before remote invocation (e.g. via the EDGE function service).
|
|
49
|
+
types: [Routine.Routine, Text.Text, Feed.Feed, Chat.Chat],
|
|
45
50
|
services: [
|
|
46
51
|
AiService.AiService,
|
|
47
52
|
Database.Service,
|
|
48
53
|
Feed.FeedService,
|
|
49
54
|
OpaqueToolkit.OpaqueToolkitProvider,
|
|
50
|
-
|
|
55
|
+
Registry.Service,
|
|
51
56
|
Trace.TraceService,
|
|
52
57
|
],
|
|
53
58
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"conversations":[{"parameters":{"model":"
|
|
1
|
+
{"conversations":[{"parameters":{"model":"ai.claude.model.claude-opus-4-6","stream":true,"tools":[{"name":"completeJob","inputSchema":{"type":"object","required":[],"properties":{"success":{"$id":"/schemas/any","title":"any"},"failure":{"type":"object","required":["message"],"properties":{"message":{"type":"string","description":"Short message describing the error."},"description":{"type":"string","description":"Optional longer message describing in detail what went wrong"}},"additionalProperties":false}},"additionalProperties":false}}]},"prompt":{"content":[{"role":"system","content":"You are an agent running in the non-interactive mode.\nThe user is unable to see what you are doing, and cannot answer any questions.\nDo not ask questions.\nComplete the task before you, and at the end call [completeJob] with the output.\nIf you are unable to complete the task, call [completeJob] with the failure reason.\nIf no output is required, call [completeJob] with an empty object: {}\nDo not stop until you call [completeJob].","options":{}},{"role":"user","content":"Reply with a single word: ack.\n<input>{}</input>","options":{"anthropic":{"cacheControl":{"ttl":"5m","type":"ephemeral"}}}}]},"response":[{"type":"response-metadata","id":"msg_01JstbpndWJDAhVwAppVJz2H","modelId":"claude-opus-4-6","timestamp":"1970-01-01T00:00:00.000Z","metadata":{}},{"type":"reasoning-start","id":"0","metadata":{}},{"type":"reasoning-delta","id":"0","delta":"The user wants me to reply with a single word: \"ack\".","metadata":{}},{"type":"reasoning-delta","id":"0","delta":"","metadata":{"anthropic":{"type":"thinking","signature":"EvsBCmMIDhgCKkDoETBa+lesagv7ixB9LGrYHpBYfS/DCnRnegAetRGGWDl0kkFyqVQI7oDc+ZWbyk9tB+4ePqoqNXQXwE3240/HMg9jbGF1ZGUtb3B1cy00LTY4AEIIdGhpbmtpbmcSDFVIZlew/AFp1rmNoxoMPw+kyp+9hoNL5WyHIjDdm7hZK7hOH93slrwJoeXIuYMlv70L5mOQbDviNfFQyGfbuluo3tzWampRVGtohCgqRtiIkY7cWA700K9SVqH4mMfq1sjQ7yYuCRMv2lT7PrbCp3IRJmncUU6avNwBVX6E/hMO7ml/pORVNgsnB8Tn6FrYKqMFENAYAQ=="}}},{"type":"reasoning-end","id":"0","metadata":{}},{"type":"tool-params-start","id":"toolu_01KDviPNKjzY2nh9cGmo4oKm","name":"completeJob","providerExecuted":false,"metadata":{}},{"type":"tool-params-delta","id":"toolu_01KDviPNKjzY2nh9cGmo4oKm","delta":"","metadata":{}},{"type":"tool-params-delta","id":"toolu_01KDviPNKjzY2nh9cGmo4oKm","delta":"{\"success\"","metadata":{}},{"type":"tool-params-delta","id":"toolu_01KDviPNKjzY2nh9cGmo4oKm","delta":": ","metadata":{}},{"type":"tool-params-delta","id":"toolu_01KDviPNKjzY2nh9cGmo4oKm","delta":"\"ack\"}","metadata":{}},{"type":"tool-params-end","id":"toolu_01KDviPNKjzY2nh9cGmo4oKm","metadata":{}},{"type":"finish","reason":"tool-calls","usage":{"inputTokens":757,"outputTokens":85,"totalTokens":842},"metadata":{"anthropic":{"usage":{"cache_creation":{"ephemeral_1h_input_tokens":0,"ephemeral_5m_input_tokens":0},"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"input_tokens":757,"output_tokens":60,"server_tool_use":null,"service_tier":"standard"}}}}]},{"parameters":{"model":"ai.claude.model.claude-opus-4-6","stream":true,"tools":[{"name":"completeJob","inputSchema":{"type":"object","required":[],"properties":{"success":{"$id":"/schemas/any","title":"any"},"failure":{"type":"object","required":["message"],"properties":{"message":{"type":"string","description":"Short message describing the error."},"description":{"type":"string","description":"Optional longer message describing in detail what went wrong"}},"additionalProperties":false}},"additionalProperties":false}}]},"prompt":{"content":[{"role":"system","content":"You are an agent running in the non-interactive mode.\nThe user is unable to see what you are doing, and cannot answer any questions.\nDo not ask questions.\nComplete the task before you, and at the end call [completeJob] with the output.\nIf you are unable to complete the task, call [completeJob] with the failure reason.\nIf no output is required, call [completeJob] with an empty object: {}\nDo not stop until you call [completeJob].","options":{}},{"role":"user","content":"Reply with a single word: ack.\n<input>{}</input>","options":{}},{"role":"assistant","content":[{"type":"reasoning","text":"The user wants me to reply with a single word: \"ack\".","options":{}},{"type":"tool-call","id":"toolu_01KDviPNKjzY2nh9cGmo4oKm","name":"completeJob","params":{"success":"ack"},"providerExecuted":false,"options":{}}],"options":{}},{"role":"tool","content":[{"type":"tool-result","id":"toolu_01KDviPNKjzY2nh9cGmo4oKm","name":"completeJob","isFailure":false,"result":{},"providerExecuted":false,"options":{}}],"options":{"anthropic":{"cacheControl":{"ttl":"5m","type":"ephemeral"}}}}]},"response":[{"type":"response-metadata","id":"msg_01Pz14sZtxk8PRuR9CKbe7Fy","modelId":"claude-opus-4-6","timestamp":"1970-01-01T00:00:00.000Z","metadata":{}},{"type":"finish","reason":"stop","usage":{"inputTokens":824,"outputTokens":2,"totalTokens":826},"metadata":{"anthropic":{"usage":{"cache_creation":{"ephemeral_1h_input_tokens":0,"ephemeral_5m_input_tokens":0},"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"input_tokens":824,"output_tokens":2,"server_tool_use":null,"service_tier":"standard"}}}}]}]}
|
|
@@ -5,15 +5,12 @@
|
|
|
5
5
|
import { describe, expect, it } from '@effect/vitest';
|
|
6
6
|
import * as Effect from 'effect/Effect';
|
|
7
7
|
|
|
8
|
-
import {
|
|
9
|
-
import { Routine } from '@dxos/compute';
|
|
10
|
-
import {
|
|
11
|
-
import { Operation } from '@dxos/compute';
|
|
12
|
-
import { OperationHandlerSet } from '@dxos/compute';
|
|
13
|
-
import { Database, Feed, Obj, Ref } from '@dxos/echo';
|
|
8
|
+
import { AiContext } from '@dxos/assistant';
|
|
9
|
+
import { Routine, Operation, OperationHandlerSet } from '@dxos/compute';
|
|
10
|
+
import { Database, Feed, Filter, Obj, Ref } from '@dxos/echo';
|
|
14
11
|
import { TestHelpers } from '@dxos/effect/testing';
|
|
15
12
|
import { AssistantTestLayer } from '@dxos/functions-runtime/testing';
|
|
16
|
-
import {
|
|
13
|
+
import { EntityId } from '@dxos/keys';
|
|
17
14
|
import { Text } from '@dxos/schema';
|
|
18
15
|
import { Message } from '@dxos/types';
|
|
19
16
|
|
|
@@ -21,19 +18,19 @@ import * as Chat from '../../types/Chat';
|
|
|
21
18
|
import { AgentPrompt } from './definitions';
|
|
22
19
|
import defaultAgentPrompt from './prompt';
|
|
23
20
|
|
|
24
|
-
|
|
21
|
+
EntityId.dangerouslyDisableRandomness();
|
|
25
22
|
|
|
26
23
|
const operationHandlerSet = OperationHandlerSet.make(defaultAgentPrompt);
|
|
27
24
|
|
|
28
25
|
const TestLayer = AssistantTestLayer({
|
|
29
26
|
operationHandlers: operationHandlerSet,
|
|
30
|
-
types: [Chat.Chat, Message.Message,
|
|
27
|
+
types: [Chat.Chat, Message.Message, AiContext.Binding, Text.Text],
|
|
31
28
|
aiServicePreset: 'edge-remote',
|
|
32
29
|
});
|
|
33
30
|
|
|
34
|
-
const
|
|
35
|
-
Effect.
|
|
36
|
-
const items =
|
|
31
|
+
const countFeedMessages = (feed: Feed.Feed) =>
|
|
32
|
+
Effect.gen(function* () {
|
|
33
|
+
const items = yield* Feed.runQuery(feed, Filter.everything());
|
|
37
34
|
return items.filter(Obj.instanceOf(Message.Message)).length;
|
|
38
35
|
});
|
|
39
36
|
|
|
@@ -43,9 +40,7 @@ describe('Agent prompt', () => {
|
|
|
43
40
|
Effect.fnUntraced(
|
|
44
41
|
function* (_) {
|
|
45
42
|
const feed = yield* Database.add(Feed.make());
|
|
46
|
-
const
|
|
47
|
-
const queue = yield* QueueService.getQueue<Message.Message | ContextBinding>(queueDxn);
|
|
48
|
-
const messageCountBefore = yield* countQueueMessages(queue);
|
|
43
|
+
const messageCountBefore = yield* countFeedMessages(feed);
|
|
49
44
|
|
|
50
45
|
const chat = yield* Database.add(
|
|
51
46
|
Chat.make({
|
|
@@ -70,7 +65,7 @@ describe('Agent prompt', () => {
|
|
|
70
65
|
chat: Ref.make(chat),
|
|
71
66
|
});
|
|
72
67
|
|
|
73
|
-
const messageCountAfter = yield*
|
|
68
|
+
const messageCountAfter = yield* countFeedMessages(feed);
|
|
74
69
|
|
|
75
70
|
expect(messageCountAfter).toBeGreaterThan(messageCountBefore);
|
|
76
71
|
expect(result).toBe('ack');
|
|
@@ -4,10 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
import * as Tool from '@effect/ai/Tool';
|
|
6
6
|
import * as Toolkit from '@effect/ai/Toolkit';
|
|
7
|
-
import * as Array from 'effect/Array';
|
|
8
7
|
import * as Deferred from 'effect/Deferred';
|
|
9
8
|
import * as Effect from 'effect/Effect';
|
|
10
|
-
import * as Function from 'effect/Function';
|
|
11
9
|
import * as Layer from 'effect/Layer';
|
|
12
10
|
import * as Option from 'effect/Option';
|
|
13
11
|
import * as Schema from 'effect/Schema';
|
|
@@ -19,11 +17,9 @@ import {
|
|
|
19
17
|
makeToolExecutionService,
|
|
20
18
|
makeToolResolverFromOperations,
|
|
21
19
|
} from '@dxos/assistant';
|
|
22
|
-
import { Template } from '@dxos/compute';
|
|
23
|
-
import { Trace } from '@dxos/compute';
|
|
24
|
-
import { Operation } from '@dxos/compute';
|
|
20
|
+
import { Template, Trace, Operation } from '@dxos/compute';
|
|
25
21
|
import { Database, Feed, Obj, Ref } from '@dxos/echo';
|
|
26
|
-
import {
|
|
22
|
+
import { EffectEx } from '@dxos/effect';
|
|
27
23
|
import { invariant } from '@dxos/invariant';
|
|
28
24
|
import { log } from '@dxos/log';
|
|
29
25
|
import { trim } from '@dxos/util';
|
|
@@ -32,7 +28,7 @@ import { PromptError } from '../../errors';
|
|
|
32
28
|
import * as Chat from '../../types/Chat';
|
|
33
29
|
import { AgentPrompt } from './definitions';
|
|
34
30
|
|
|
35
|
-
const DEFAULT_MODEL: ModelName = '
|
|
31
|
+
const DEFAULT_MODEL: ModelName = 'ai.claude.model.claude-opus-4-6';
|
|
36
32
|
|
|
37
33
|
export default AgentPrompt.pipe(
|
|
38
34
|
Operation.withHandler(
|
|
@@ -50,21 +46,25 @@ export default AgentPrompt.pipe(
|
|
|
50
46
|
|
|
51
47
|
log.info('starting agent', { prompt: prompt.id, input });
|
|
52
48
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
49
|
+
// Bind the routine's own refs, dropping any that no longer resolve. The refs must be
|
|
50
|
+
// bound as-is (not re-wrapped via `Ref.make`) to preserve their registry DXN: bindings
|
|
51
|
+
// are persisted to the conversation feed, and registry-only blueprints have no space-DB
|
|
52
|
+
// identity, so an EID ref would not resolve when the binding is re-read.
|
|
53
|
+
const blueprintRefs = yield* Effect.filter(prompt.blueprints, (ref) =>
|
|
54
|
+
Database.load(ref).pipe(
|
|
55
|
+
Effect.as(true),
|
|
56
|
+
Effect.catchTag('EntityNotFoundError', () => Effect.succeed(false)),
|
|
57
|
+
),
|
|
58
58
|
);
|
|
59
59
|
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
60
|
+
const objectRefs = yield* Effect.filter(prompt.context, (ref) =>
|
|
61
|
+
Database.load(ref).pipe(
|
|
62
|
+
Effect.as(true),
|
|
63
|
+
Effect.catchTag('EntityNotFoundError', () => Effect.succeed(false)),
|
|
64
|
+
),
|
|
65
65
|
);
|
|
66
66
|
|
|
67
|
-
const promptInstructions = yield* Database.load(prompt.instructions
|
|
67
|
+
const promptInstructions = yield* Database.load(prompt.instructions);
|
|
68
68
|
let promptText = Template.process(promptInstructions.content, input);
|
|
69
69
|
|
|
70
70
|
if (input !== undefined) {
|
|
@@ -81,7 +81,7 @@ export default AgentPrompt.pipe(
|
|
|
81
81
|
Do not stop until you call [completeJob].
|
|
82
82
|
`;
|
|
83
83
|
if (data.systemInstructions) {
|
|
84
|
-
systemText += `\n
|
|
84
|
+
systemText += `\n${data.systemInstructions}`;
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
const modelLayer = AiService.model(data.model ?? DEFAULT_MODEL);
|
|
@@ -102,12 +102,12 @@ export default AgentPrompt.pipe(
|
|
|
102
102
|
});
|
|
103
103
|
|
|
104
104
|
const runtime = yield* Effect.runtime<Feed.FeedService>();
|
|
105
|
-
const session = yield* acquireReleaseResource(() => new AiSession({ feed, runtime }));
|
|
105
|
+
const session = yield* EffectEx.acquireReleaseResource(() => new AiSession.Session({ feed, runtime }));
|
|
106
106
|
|
|
107
107
|
yield* Effect.promise(() =>
|
|
108
108
|
session.context.bind({
|
|
109
|
-
blueprints:
|
|
110
|
-
objects:
|
|
109
|
+
blueprints: blueprintRefs,
|
|
110
|
+
objects: objectRefs,
|
|
111
111
|
}),
|
|
112
112
|
);
|
|
113
113
|
|
|
@@ -151,8 +151,11 @@ export default AgentPrompt.pipe(
|
|
|
151
151
|
),
|
|
152
152
|
);
|
|
153
153
|
},
|
|
154
|
+
Effect.tapBoth({
|
|
155
|
+
onSuccess: () => Database.flush(),
|
|
156
|
+
onFailure: () => Database.flush(),
|
|
157
|
+
}),
|
|
154
158
|
Effect.scoped,
|
|
155
|
-
Effect.provide(Trace.writerLayerNoop),
|
|
156
159
|
),
|
|
157
160
|
),
|
|
158
161
|
Operation.opaqueHandler,
|
|
@@ -212,7 +215,7 @@ const ToolExecutionService = ({ feed }: ToolExecutionServiceOptions) =>
|
|
|
212
215
|
log('invoking operation', { operationDef, input });
|
|
213
216
|
const result = yield* operationInvoker
|
|
214
217
|
.invoke(operationDef, input, {
|
|
215
|
-
conversation: Obj.
|
|
218
|
+
conversation: Obj.getURI(feed),
|
|
216
219
|
})
|
|
217
220
|
.pipe(Effect.orDie);
|
|
218
221
|
log('result', { result });
|
package/src/index.ts
CHANGED
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Cause from 'effect/Cause';
|
|
6
|
+
import * as Effect from 'effect/Effect';
|
|
7
|
+
import * as Exit from 'effect/Exit';
|
|
8
|
+
|
|
9
|
+
import { AiContext } from '@dxos/assistant';
|
|
10
|
+
import { Routine } from '@dxos/compute';
|
|
11
|
+
import { ProcessManager } from '@dxos/compute-runtime';
|
|
12
|
+
import { Database, Feed, Filter, Obj, Ref } from '@dxos/echo';
|
|
13
|
+
import { EffectEx } from '@dxos/effect';
|
|
14
|
+
import { type Delegation, type DelegationStrategy } from '@dxos/functions-runtime';
|
|
15
|
+
import { log } from '@dxos/log';
|
|
16
|
+
import { Message } from '@dxos/types';
|
|
17
|
+
import { trim } from '@dxos/util';
|
|
18
|
+
|
|
19
|
+
import { DelegationBlueprint } from '../blueprints';
|
|
20
|
+
import { AgentPrompt } from '../functions';
|
|
21
|
+
import { Agent } from '../types';
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Resolves the agent whose chat is backed by the given conversation feed, if any. Plain (agentless)
|
|
25
|
+
* chats yield `undefined`, so the strategy is a no-op for them.
|
|
26
|
+
*/
|
|
27
|
+
const findAgentForFeed = (feed: Feed.Feed): Effect.Effect<Agent.Agent | undefined, never, Database.Service> =>
|
|
28
|
+
Effect.gen(function* () {
|
|
29
|
+
const agents = yield* Database.query(Filter.type(Agent.Agent)).run;
|
|
30
|
+
for (const agent of agents) {
|
|
31
|
+
if (!agent.chat) {
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
const matches = yield* Effect.gen(function* () {
|
|
35
|
+
const chat = yield* Database.load(agent.chat!);
|
|
36
|
+
const chatFeed = yield* Database.load(chat.feed);
|
|
37
|
+
return chatFeed.id === feed.id;
|
|
38
|
+
}).pipe(Effect.orElseSucceed(() => false));
|
|
39
|
+
if (matches) {
|
|
40
|
+
return agent;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return undefined;
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Renders a sub-agent result for inclusion in a notification message.
|
|
48
|
+
*/
|
|
49
|
+
const formatResult = (value: unknown): string => (typeof value === 'string' ? value : JSON.stringify(value));
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Extracts artifact ids a sub-agent reported in its result (see the synthesized routine
|
|
53
|
+
* instructions). Tolerates the result being a string, or an object with `artifactIds`/`artifactId`.
|
|
54
|
+
*/
|
|
55
|
+
const extractArtifactIds = (value: unknown): string[] => {
|
|
56
|
+
if (typeof value !== 'object' || value === null) {
|
|
57
|
+
return [];
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const record = value as { artifactIds?: unknown; artifactId?: unknown };
|
|
61
|
+
const ids = Array.isArray(record.artifactIds)
|
|
62
|
+
? record.artifactIds
|
|
63
|
+
: typeof record.artifactId === 'string'
|
|
64
|
+
? [record.artifactId]
|
|
65
|
+
: [];
|
|
66
|
+
return ids.filter((id): id is string => typeof id === 'string');
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Supervisor behaviour for the conversational agent: after each turn, every in-progress plan task
|
|
71
|
+
* not already delegated is run by a sub-agent (a synthesized minimal `Routine` executed via
|
|
72
|
+
* `AgentPrompt`); on completion the task status is updated and a templated message is posted back to
|
|
73
|
+
* the conversation.
|
|
74
|
+
*/
|
|
75
|
+
export const makeDelegationStrategy = (): DelegationStrategy => ({
|
|
76
|
+
reconcile: (feed, activeIds) =>
|
|
77
|
+
Effect.gen(function* () {
|
|
78
|
+
const agent = yield* findAgentForFeed(feed);
|
|
79
|
+
if (!agent) {
|
|
80
|
+
return [];
|
|
81
|
+
}
|
|
82
|
+
const plan = yield* Database.load(agent.plan).pipe(Effect.orElseSucceed(() => undefined));
|
|
83
|
+
if (!plan) {
|
|
84
|
+
return [];
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// Only delegated tasks are spawned as sub-agents — a task created via ordinary planning
|
|
88
|
+
// (`update-tasks`) stays in the plan but is not double-delegated.
|
|
89
|
+
const pending = plan.tasks.filter(
|
|
90
|
+
(task) => task.delegated === true && task.status === 'in-progress' && !activeIds.has(task.id),
|
|
91
|
+
);
|
|
92
|
+
if (pending.length === 0) {
|
|
93
|
+
return [];
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// Sub-agents inherit the supervisor's bound blueprints (so they have the same tools/
|
|
97
|
+
// capabilities), minus the delegation blueprint itself — otherwise a sub-agent could
|
|
98
|
+
// recursively delegate. Resolved from the conversation's AiContext bindings.
|
|
99
|
+
const inheritedBlueprints = yield* Effect.gen(function* () {
|
|
100
|
+
const runtime = yield* Effect.runtime<Feed.FeedService>();
|
|
101
|
+
const binder = yield* EffectEx.acquireReleaseResource(() => new AiContext.Binder({ feed, runtime }));
|
|
102
|
+
return binder.getBlueprints().filter((blueprint) => Obj.getMeta(blueprint).key !== DelegationBlueprint.key);
|
|
103
|
+
}).pipe(Effect.scoped);
|
|
104
|
+
const blueprints = inheritedBlueprints.map((blueprint) => Ref.make(blueprint));
|
|
105
|
+
|
|
106
|
+
const delegations: Delegation[] = [];
|
|
107
|
+
for (const task of pending) {
|
|
108
|
+
// Synthesize a minimal routine whose goal is the task; the sub-agent runs it via AgentPrompt
|
|
109
|
+
// with the inherited blueprints bound.
|
|
110
|
+
const routine = yield* Database.add(
|
|
111
|
+
Routine.make({
|
|
112
|
+
name: task.title,
|
|
113
|
+
instructions: trim`
|
|
114
|
+
Complete the following task and report the result concisely.
|
|
115
|
+
|
|
116
|
+
If you create any documents or artifacts, call completeJob with a JSON object of the
|
|
117
|
+
form { "summary": string, "artifactIds": string[] }, where artifactIds are the exact
|
|
118
|
+
ids returned by the tools that created them. Otherwise return a short summary string.
|
|
119
|
+
|
|
120
|
+
Task: ${task.title}
|
|
121
|
+
`,
|
|
122
|
+
blueprints,
|
|
123
|
+
}),
|
|
124
|
+
);
|
|
125
|
+
|
|
126
|
+
delegations.push({
|
|
127
|
+
id: task.id,
|
|
128
|
+
spawn: Effect.gen(function* () {
|
|
129
|
+
const invoker = yield* ProcessManager.ProcessOperationInvoker.Service;
|
|
130
|
+
const fiber = yield* invoker.invokeFiber(AgentPrompt, { prompt: Ref.make(routine), input: {} });
|
|
131
|
+
return fiber.pid;
|
|
132
|
+
}),
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
return delegations;
|
|
136
|
+
}),
|
|
137
|
+
|
|
138
|
+
onComplete: (feed, id, exit) =>
|
|
139
|
+
Effect.gen(function* () {
|
|
140
|
+
const agent = yield* findAgentForFeed(feed);
|
|
141
|
+
const plan = agent ? yield* Database.load(agent.plan).pipe(Effect.orElseSucceed(() => undefined)) : undefined;
|
|
142
|
+
|
|
143
|
+
let title = id;
|
|
144
|
+
if (plan) {
|
|
145
|
+
Obj.update(plan, (plan) => {
|
|
146
|
+
const task = plan.tasks.find((task) => task.id === id);
|
|
147
|
+
if (task) {
|
|
148
|
+
task.status = Exit.isSuccess(exit) ? 'done' : 'failed';
|
|
149
|
+
title = task.title;
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// Fold any artifacts the sub-agent produced into the supervisor agent's context, so follow-up
|
|
155
|
+
// turns can reference them. The sub-agent runs in its own session but in the same space, so
|
|
156
|
+
// the artifacts resolve by id. Keep the stored refs to embed as inline reference blocks below.
|
|
157
|
+
const artifactRefs: Ref.Ref<Obj.Unknown>[] = [];
|
|
158
|
+
if (agent && Exit.isSuccess(exit)) {
|
|
159
|
+
for (const artifactId of extractArtifactIds(exit.value)) {
|
|
160
|
+
const ref = yield* Agent.addArtifact(agent, { name: title, id: artifactId }).pipe(
|
|
161
|
+
Effect.orElseSucceed(() => undefined),
|
|
162
|
+
);
|
|
163
|
+
if (ref) {
|
|
164
|
+
artifactRefs.push(ref);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// Surface the actual failure cause (not just "failed") so delegation errors are debuggable.
|
|
170
|
+
const failureCause = Exit.isFailure(exit) ? Cause.pretty(exit.cause) : undefined;
|
|
171
|
+
if (failureCause) {
|
|
172
|
+
log.warn('sub-agent failed', { taskId: id, title, cause: failureCause });
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
const text = Exit.isSuccess(exit)
|
|
176
|
+
? `The sub-agent completed "${title}".${artifactRefs.length === 0 ? ` ${formatResult(exit.value)}` : ''}`
|
|
177
|
+
: `The sub-agent failed to complete "${title}": ${failureCause ?? 'unknown error'}`;
|
|
178
|
+
|
|
179
|
+
// Embed each produced artifact as a `reference` block — the chat renders these as a dx-anchor
|
|
180
|
+
// tag with an inline object preview, rather than a raw `echo://` URI in the text.
|
|
181
|
+
const blocks = [
|
|
182
|
+
{ _tag: 'text' as const, text },
|
|
183
|
+
...artifactRefs.map((reference) => ({ _tag: 'reference' as const, reference })),
|
|
184
|
+
];
|
|
185
|
+
|
|
186
|
+
yield* Feed.append(feed, [Message.make({ sender: 'assistant', blocks })]);
|
|
187
|
+
}),
|
|
188
|
+
});
|
package/src/sync/sync.ts
CHANGED
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
import * as Effect from 'effect/Effect';
|
|
6
6
|
|
|
7
|
-
import { Filter, Obj, Query, Ref } from '@dxos/echo';
|
|
8
|
-
import { Database } from '@dxos/echo';
|
|
7
|
+
import { Database, Filter, Obj, Query, Ref } from '@dxos/echo';
|
|
9
8
|
import { failedInvariant } from '@dxos/invariant';
|
|
9
|
+
import { EID } from '@dxos/keys';
|
|
10
10
|
import { log } from '@dxos/log';
|
|
11
11
|
|
|
12
12
|
/**
|
|
@@ -39,22 +39,23 @@ export const syncObjects: (
|
|
|
39
39
|
if (!ref.target) {
|
|
40
40
|
continue;
|
|
41
41
|
}
|
|
42
|
-
|
|
42
|
+
const targetUri = EID.tryParse(Obj.getURI(ref.target));
|
|
43
|
+
if (targetUri && EID.isLocal(targetUri)) {
|
|
43
44
|
// obj not persisted to db.
|
|
44
45
|
const [target] = yield* syncObjects([ref.target], { foreignKeyId });
|
|
45
46
|
(obj as any)[key] = Ref.make(target);
|
|
46
47
|
}
|
|
47
48
|
}
|
|
48
49
|
|
|
49
|
-
const
|
|
50
|
+
const type = Obj.getType(obj) ?? failedInvariant('No type.');
|
|
50
51
|
const foreignId = Obj.getKeys(obj, foreignKeyId)[0]?.id ?? failedInvariant('No foreign key.');
|
|
51
|
-
const [existing] = yield* Database.
|
|
52
|
-
Query.select(Filter.foreignKeys(
|
|
53
|
-
);
|
|
52
|
+
const [existing] = yield* Database.query(
|
|
53
|
+
Query.select(Filter.foreignKeys(type, [{ source: foreignKeyId, id: foreignId }])),
|
|
54
|
+
).run;
|
|
54
55
|
log('sync object', {
|
|
55
56
|
type: Obj.getTypename(obj),
|
|
56
57
|
foreignId,
|
|
57
|
-
existing: existing ? Obj.
|
|
58
|
+
existing: existing ? Obj.getURI(existing) : undefined,
|
|
58
59
|
});
|
|
59
60
|
if (!existing) {
|
|
60
61
|
yield* Database.add(obj);
|