@dinoxx/dinox-cli 2.19.0 → 2.20.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +15 -0
- package/README.md +24 -27
- package/dist/chunks/applePodcast-V4FSJOC5.js +169 -0
- package/dist/chunks/bbc-NTMRPYRF.js +570 -0
- package/dist/chunks/bilibili-UA3MBSPH.js +835 -0
- package/dist/chunks/bohaishibei-B7UVXH4Y.js +246 -0
- package/dist/chunks/chunk-224ML7QC.js +21 -0
- package/dist/chunks/chunk-2LW76QIL.js +32 -0
- package/dist/chunks/chunk-2M7RJATW.js +60 -0
- package/dist/chunks/chunk-3EKNTO6G.js +61 -0
- package/dist/chunks/chunk-3VZNZWDG.js +437 -0
- package/dist/chunks/chunk-53CT7DJ3.js +39 -0
- package/dist/chunks/chunk-5JF7J5MP.js +114 -0
- package/dist/chunks/chunk-5KU25TMX.js +26 -0
- package/dist/chunks/chunk-67RXND3H.js +65 -0
- package/dist/chunks/chunk-6AZT4ARG.js +1491 -0
- package/dist/chunks/chunk-6D3QLMRM.js +421 -0
- package/dist/chunks/chunk-6VMHHE5Y.js +235 -0
- package/dist/chunks/chunk-77UP745T.js +143 -0
- package/dist/chunks/chunk-7A5QISPG.js +19 -0
- package/dist/chunks/chunk-7ODU7LXP.js +31 -0
- package/dist/chunks/chunk-ABYPGMDC.js +100 -0
- package/dist/chunks/chunk-AHRCI2RW.js +141 -0
- package/dist/chunks/chunk-BDLS5EEP.js +49 -0
- package/dist/chunks/chunk-BKCNERPB.js +246 -0
- package/dist/chunks/chunk-BZQYECIH.js +54 -0
- package/dist/chunks/chunk-D5SBKLDX.js +71 -0
- package/dist/chunks/chunk-F7BDWXBG.js +57 -0
- package/dist/chunks/chunk-FGQRYB7F.js +34 -0
- package/dist/chunks/chunk-FIQYJ6KZ.js +19 -0
- package/dist/chunks/chunk-FKLZZGEX.js +116 -0
- package/dist/chunks/chunk-FZGEWY5L.js +37 -0
- package/dist/chunks/chunk-G6JSWE66.js +865 -0
- package/dist/chunks/chunk-GTDX2LIJ.js +265 -0
- package/dist/chunks/chunk-HIJXC3RT.js +194 -0
- package/dist/chunks/chunk-HQJUJYUM.js +36 -0
- package/dist/chunks/chunk-IAEJG5NI.js +50 -0
- package/dist/chunks/chunk-KCHHY6QB.js +65 -0
- package/dist/chunks/chunk-KL75BFYJ.js +71 -0
- package/dist/chunks/chunk-KOAKG2QU.js +45 -0
- package/dist/chunks/chunk-MCFXD2LS.js +66 -0
- package/dist/chunks/chunk-MLOITAK6.js +29 -0
- package/dist/chunks/chunk-N44NRKDJ.js +101 -0
- package/dist/chunks/chunk-NGIIELO4.js +61 -0
- package/dist/chunks/chunk-OG6MBAGC.js +95 -0
- package/dist/chunks/chunk-P4LG4DIO.js +108 -0
- package/dist/chunks/chunk-PGR7R2HI.js +904 -0
- package/dist/chunks/chunk-PJDD4R46.js +77 -0
- package/dist/chunks/chunk-PK5AOVLU.js +107 -0
- package/dist/chunks/chunk-PTFGE4KS.js +66 -0
- package/dist/chunks/chunk-Q6G7VO5G.js +67 -0
- package/dist/chunks/chunk-QFSMFANX.js +1219 -0
- package/dist/chunks/chunk-QFUD3I7W.js +185 -0
- package/dist/chunks/chunk-QZQRG3JY.js +86 -0
- package/dist/chunks/chunk-RKJYKUQD.js +91 -0
- package/dist/chunks/chunk-TILRKKRN.js +20481 -0
- package/dist/chunks/chunk-TIXOORAP.js +60 -0
- package/dist/chunks/chunk-ULKGDBAJ.js +80 -0
- package/dist/chunks/chunk-URYABAYN.js +72 -0
- package/dist/chunks/chunk-VI7C4BBS.js +160 -0
- package/dist/chunks/chunk-VNB4ZFLN.js +86 -0
- package/dist/chunks/chunk-W7R5JTSA.js +42 -0
- package/dist/chunks/chunk-WMJXAF3X.js +55 -0
- package/dist/chunks/chunk-X36EIV25.js +93 -0
- package/dist/chunks/chunk-X7IZXCSL.js +60 -0
- package/dist/chunks/chunk-X7JXCHLI.js +25699 -0
- package/dist/chunks/chunk-XEPDFQYD.js +215 -0
- package/dist/chunks/chunk-XFVLNCOW.js +171 -0
- package/dist/chunks/chunk-XMMTGPZ6.js +1332 -0
- package/dist/chunks/chunk-XQZUX7OT.js +39 -0
- package/dist/chunks/chunk-XZLFMJOG.js +72 -0
- package/dist/chunks/chunk-YDIE7QBM.js +14115 -0
- package/dist/chunks/chunk-ZGF3OEWR.js +84 -0
- package/dist/chunks/cookies-6QQHSM26.js +34 -0
- package/dist/chunks/dedaoNote-KJ32ZQLS.js +418 -0
- package/dist/chunks/doubanGroup-HR4K2KMY.js +429 -0
- package/dist/chunks/doubao-MXUHPLUB.js +462 -0
- package/dist/chunks/douyin-UU2FSQPS.js +566 -0
- package/dist/chunks/ensure-CHJ5YTBX.js +18 -0
- package/dist/chunks/execute-RXJ4AO2Z.js +17 -0
- package/dist/chunks/facebook-SZFOVE7R.js +878 -0
- package/dist/chunks/feishu-ISWRJ7HI.js +877 -0
- package/dist/chunks/ima-D7CX5WR4.js +202 -0
- package/dist/chunks/instagram-HNDPO37H.js +939 -0
- package/dist/chunks/install-IIMVFNAT.js +303 -0
- package/dist/chunks/jike-H7L4LJTN.js +445 -0
- package/dist/chunks/mcp-NMKVOSVN.js +297 -0
- package/dist/chunks/mcpServer-NYJAKMVH.js +436 -0
- package/dist/chunks/metaso-ZVZW5UBB.js +194 -0
- package/dist/chunks/run-ETPFUFB6.js +1464 -0
- package/dist/chunks/runCli-GJRY73UA.js +464 -0
- package/dist/chunks/setup-EEU6GSWX.js +378 -0
- package/dist/chunks/threads-ADW6IANQ.js +657 -0
- package/dist/chunks/twitter-NAGCB3NI.js +1148 -0
- package/dist/chunks/web-QFKZCM4F.js +31 -0
- package/dist/chunks/wechat-OXNNLT4J.js +1551 -0
- package/dist/chunks/weibo-PMVGDNQU.js +641 -0
- package/dist/chunks/workbuddy-NNAXIIIZ.js +426 -0
- package/dist/chunks/xiaoheihe-WFQJRBAD.js +316 -0
- package/dist/chunks/xiaohongshu-5CXBELGW.js +1833 -0
- package/dist/chunks/xiaoyuzhou-6L6IB46Y.js +322 -0
- package/dist/chunks/youtube-52NGBTQC.js +58 -0
- package/dist/chunks/zcool-HDSWK4KD.js +755 -0
- package/dist/chunks/zhihu-EX2VRJYY.js +1024 -0
- package/dist/dinox.js +137 -51
- package/dist/dsh-plugin/lib/client.js +265 -252
- package/dist/dsh-plugin/package.json +1 -1
- package/dist/dsh-plugin/runtime.json +3 -3
- package/dist/editor-ui/mcp-app.html +293 -280
- package/package.json +82 -64
- package/dist/ai/ragxClient.d.ts +0 -15
- package/dist/ai/ragxClient.js +0 -71
- package/dist/auth/devicePair.d.ts +0 -62
- package/dist/auth/devicePair.js +0 -377
- package/dist/auth/userInfo.d.ts +0 -26
- package/dist/auth/userInfo.js +0 -224
- package/dist/cli.d.ts +0 -2
- package/dist/cli.js +0 -130
- package/dist/cliTypes.d.ts +0 -7
- package/dist/cliTypes.js +0 -1
- package/dist/commands/auth/index.d.ts +0 -34
- package/dist/commands/auth/index.js +0 -605
- package/dist/commands/batch.d.ts +0 -35
- package/dist/commands/batch.js +0 -202
- package/dist/commands/boxes/index.d.ts +0 -4
- package/dist/commands/boxes/index.js +0 -382
- package/dist/commands/boxes/model.d.ts +0 -37
- package/dist/commands/boxes/model.js +0 -93
- package/dist/commands/boxes/operations.d.ts +0 -86
- package/dist/commands/boxes/operations.js +0 -448
- package/dist/commands/boxes/repo.d.ts +0 -36
- package/dist/commands/boxes/repo.js +0 -320
- package/dist/commands/boxes/store.d.ts +0 -22
- package/dist/commands/boxes/store.js +0 -143
- package/dist/commands/config/index.d.ts +0 -5
- package/dist/commands/config/index.js +0 -105
- package/dist/commands/descriptor/register.d.ts +0 -8
- package/dist/commands/descriptor/register.js +0 -122
- package/dist/commands/descriptor/types.d.ts +0 -37
- package/dist/commands/descriptor/types.js +0 -17
- package/dist/commands/doctor.d.ts +0 -126
- package/dist/commands/doctor.js +0 -558
- package/dist/commands/domain/options.d.ts +0 -10
- package/dist/commands/domain/options.js +0 -75
- package/dist/commands/domain/run.d.ts +0 -24
- package/dist/commands/domain/run.js +0 -137
- package/dist/commands/editor/index.d.ts +0 -4
- package/dist/commands/editor/index.js +0 -155
- package/dist/commands/gateway/index.d.ts +0 -4
- package/dist/commands/gateway/index.js +0 -340
- package/dist/commands/graph/index.d.ts +0 -4
- package/dist/commands/graph/index.js +0 -173
- package/dist/commands/graph/repo.d.ts +0 -40
- package/dist/commands/graph/repo.js +0 -201
- package/dist/commands/info/index.d.ts +0 -4
- package/dist/commands/info/index.js +0 -75
- package/dist/commands/mcp.d.ts +0 -6
- package/dist/commands/mcp.js +0 -47
- package/dist/commands/meta/index.d.ts +0 -4
- package/dist/commands/meta/index.js +0 -60
- package/dist/commands/meta/repo.d.ts +0 -30
- package/dist/commands/meta/repo.js +0 -76
- package/dist/commands/notes/actions.d.ts +0 -12
- package/dist/commands/notes/actions.js +0 -591
- package/dist/commands/notes/bulk.d.ts +0 -35
- package/dist/commands/notes/bulk.js +0 -195
- package/dist/commands/notes/contentEngine.d.ts +0 -95
- package/dist/commands/notes/contentEngine.js +0 -714
- package/dist/commands/notes/contentPatch.d.ts +0 -114
- package/dist/commands/notes/contentPatch.js +0 -450
- package/dist/commands/notes/contentPatchCommand.d.ts +0 -6
- package/dist/commands/notes/contentPatchCommand.js +0 -164
- package/dist/commands/notes/createFromTemplate.d.ts +0 -35
- package/dist/commands/notes/createFromTemplate.js +0 -58
- package/dist/commands/notes/descriptors.d.ts +0 -4
- package/dist/commands/notes/descriptors.js +0 -548
- package/dist/commands/notes/detailContent.d.ts +0 -19
- package/dist/commands/notes/detailContent.js +0 -62
- package/dist/commands/notes/dryRun.d.ts +0 -33
- package/dist/commands/notes/dryRun.js +0 -133
- package/dist/commands/notes/export.d.ts +0 -27
- package/dist/commands/notes/export.js +0 -252
- package/dist/commands/notes/index.d.ts +0 -2
- package/dist/commands/notes/index.js +0 -2
- package/dist/commands/notes/metadataMutation.d.ts +0 -29
- package/dist/commands/notes/metadataMutation.js +0 -138
- package/dist/commands/notes/repo/read.d.ts +0 -8
- package/dist/commands/notes/repo/read.js +0 -302
- package/dist/commands/notes/repo/resolve.d.ts +0 -8
- package/dist/commands/notes/repo/resolve.js +0 -187
- package/dist/commands/notes/repo/search.d.ts +0 -43
- package/dist/commands/notes/repo/search.js +0 -513
- package/dist/commands/notes/repo/semantic.d.ts +0 -14
- package/dist/commands/notes/repo/semantic.js +0 -31
- package/dist/commands/notes/repo/shared.d.ts +0 -192
- package/dist/commands/notes/repo/shared.js +0 -102
- package/dist/commands/notes/repo/write.d.ts +0 -27
- package/dist/commands/notes/repo/write.js +0 -262
- package/dist/commands/notes/repo.d.ts +0 -7
- package/dist/commands/notes/repo.js +0 -7
- package/dist/commands/notes/runtime.d.ts +0 -20
- package/dist/commands/notes/runtime.js +0 -175
- package/dist/commands/notes/searchOutput.d.ts +0 -15
- package/dist/commands/notes/searchOutput.js +0 -54
- package/dist/commands/notes/searchResponse.d.ts +0 -54
- package/dist/commands/notes/searchResponse.js +0 -57
- package/dist/commands/notes/searchSql.d.ts +0 -11
- package/dist/commands/notes/searchSql.js +0 -614
- package/dist/commands/notes/searchTime.d.ts +0 -9
- package/dist/commands/notes/searchTime.js +0 -85
- package/dist/commands/notes/semantic.d.ts +0 -116
- package/dist/commands/notes/semantic.js +0 -332
- package/dist/commands/notes/writeReceipt.d.ts +0 -20
- package/dist/commands/notes/writeReceipt.js +0 -82
- package/dist/commands/prompt/index.d.ts +0 -5
- package/dist/commands/prompt/index.js +0 -132
- package/dist/commands/prompt/repo.d.ts +0 -28
- package/dist/commands/prompt/repo.js +0 -220
- package/dist/commands/properties/index.d.ts +0 -16
- package/dist/commands/properties/index.js +0 -640
- package/dist/commands/properties/repo.d.ts +0 -150
- package/dist/commands/properties/repo.js +0 -272
- package/dist/commands/runtime.d.ts +0 -54
- package/dist/commands/runtime.js +0 -228
- package/dist/commands/savedViews/fields.d.ts +0 -28
- package/dist/commands/savedViews/fields.js +0 -87
- package/dist/commands/savedViews/index.d.ts +0 -7
- package/dist/commands/savedViews/index.js +0 -506
- package/dist/commands/savedViews/model.d.ts +0 -45
- package/dist/commands/savedViews/model.js +0 -90
- package/dist/commands/savedViews/repo.d.ts +0 -125
- package/dist/commands/savedViews/repo.js +0 -393
- package/dist/commands/schema/commandMetadata.d.ts +0 -2
- package/dist/commands/schema/commandMetadata.js +0 -18
- package/dist/commands/schema/globalOptions.d.ts +0 -11
- package/dist/commands/schema/globalOptions.js +0 -11
- package/dist/commands/schema/index.d.ts +0 -5
- package/dist/commands/schema/index.js +0 -130
- package/dist/commands/schema/renderSkills.d.ts +0 -12
- package/dist/commands/schema/renderSkills.js +0 -366
- package/dist/commands/schema/spec.d.ts +0 -5
- package/dist/commands/schema/spec.js +0 -74
- package/dist/commands/schema/types.d.ts +0 -34
- package/dist/commands/schema/types.js +0 -1
- package/dist/commands/skills/index.d.ts +0 -80
- package/dist/commands/skills/index.js +0 -572
- package/dist/commands/storage/index.d.ts +0 -4
- package/dist/commands/storage/index.js +0 -270
- package/dist/commands/storage/repo/configs.d.ts +0 -30
- package/dist/commands/storage/repo/configs.js +0 -259
- package/dist/commands/storage/repo/operations.d.ts +0 -25
- package/dist/commands/storage/repo/operations.js +0 -339
- package/dist/commands/storage/repo/remote.d.ts +0 -32
- package/dist/commands/storage/repo/remote.js +0 -132
- package/dist/commands/storage/repo/resources.d.ts +0 -12
- package/dist/commands/storage/repo/resources.js +0 -134
- package/dist/commands/storage/repo/shared.d.ts +0 -181
- package/dist/commands/storage/repo/shared.js +0 -36
- package/dist/commands/storage/repo/targets.d.ts +0 -12
- package/dist/commands/storage/repo/targets.js +0 -178
- package/dist/commands/storage/repo.d.ts +0 -3
- package/dist/commands/storage/repo.js +0 -4
- package/dist/commands/sync.d.ts +0 -27
- package/dist/commands/sync.js +0 -153
- package/dist/commands/tags/content.d.ts +0 -32
- package/dist/commands/tags/content.js +0 -252
- package/dist/commands/tags/index.d.ts +0 -4
- package/dist/commands/tags/index.js +0 -404
- package/dist/commands/tags/model.d.ts +0 -38
- package/dist/commands/tags/model.js +0 -100
- package/dist/commands/tags/operations.d.ts +0 -105
- package/dist/commands/tags/operations.js +0 -468
- package/dist/commands/tags/repo.d.ts +0 -27
- package/dist/commands/tags/repo.js +0 -236
- package/dist/commands/tags/store.d.ts +0 -28
- package/dist/commands/tags/store.js +0 -166
- package/dist/commands/templates/index.d.ts +0 -4
- package/dist/commands/templates/index.js +0 -290
- package/dist/commands/templates/model.d.ts +0 -28
- package/dist/commands/templates/model.js +0 -195
- package/dist/commands/templates/repo.d.ts +0 -53
- package/dist/commands/templates/repo.js +0 -78
- package/dist/commands/todo/contentModel.d.ts +0 -33
- package/dist/commands/todo/contentModel.js +0 -377
- package/dist/commands/todo/dryRun.d.ts +0 -26
- package/dist/commands/todo/dryRun.js +0 -150
- package/dist/commands/todo/index.d.ts +0 -10
- package/dist/commands/todo/index.js +0 -631
- package/dist/commands/todo/repo.d.ts +0 -257
- package/dist/commands/todo/repo.js +0 -772
- package/dist/commands/todo/taskIdentity.d.ts +0 -2
- package/dist/commands/todo/taskIdentity.js +0 -64
- package/dist/commands/todo/taskModel.d.ts +0 -56
- package/dist/commands/todo/taskModel.js +0 -492
- package/dist/commands/todo/taskPatch.d.ts +0 -119
- package/dist/commands/todo/taskPatch.js +0 -502
- package/dist/commands/todo/taskText.d.ts +0 -26
- package/dist/commands/todo/taskText.js +0 -221
- package/dist/commands/update.d.ts +0 -46
- package/dist/commands/update.js +0 -326
- package/dist/commands/writeConfirmation.d.ts +0 -13
- package/dist/commands/writeConfirmation.js +0 -54
- package/dist/commands/writeDryRun.d.ts +0 -88
- package/dist/commands/writeDryRun.js +0 -162
- package/dist/commands/writeDurability.d.ts +0 -5
- package/dist/commands/writeDurability.js +0 -22
- package/dist/commands/writeReceipt.d.ts +0 -13
- package/dist/commands/writeReceipt.js +0 -12
- package/dist/config/keys.d.ts +0 -9
- package/dist/config/keys.js +0 -14
- package/dist/config/paths.d.ts +0 -6
- package/dist/config/paths.js +0 -55
- package/dist/config/resolve.d.ts +0 -4
- package/dist/config/resolve.js +0 -68
- package/dist/config/serviceEndpoints.d.ts +0 -5
- package/dist/config/serviceEndpoints.js +0 -5
- package/dist/config/store.d.ts +0 -8
- package/dist/config/store.js +0 -149
- package/dist/config/types.d.ts +0 -55
- package/dist/config/types.js +0 -1
- package/dist/constants/links.d.ts +0 -18
- package/dist/constants/links.js +0 -26
- package/dist/contract/snapshot.d.ts +0 -30
- package/dist/contract/snapshot.js +0 -114
- package/dist/daemon/autoInstall.d.ts +0 -32
- package/dist/daemon/autoInstall.js +0 -106
- package/dist/daemon/client.d.ts +0 -29
- package/dist/daemon/client.js +0 -418
- package/dist/daemon/connectivity.d.ts +0 -20
- package/dist/daemon/connectivity.js +0 -42
- package/dist/daemon/ensure.d.ts +0 -1
- package/dist/daemon/ensure.js +0 -120
- package/dist/daemon/env.d.ts +0 -8
- package/dist/daemon/env.js +0 -81
- package/dist/daemon/forward.d.ts +0 -37
- package/dist/daemon/forward.js +0 -155
- package/dist/daemon/fresh.d.ts +0 -4
- package/dist/daemon/fresh.js +0 -10
- package/dist/daemon/index.d.ts +0 -80
- package/dist/daemon/index.js +0 -727
- package/dist/daemon/launch.d.ts +0 -43
- package/dist/daemon/launch.js +0 -124
- package/dist/daemon/lifecycle.d.ts +0 -51
- package/dist/daemon/lifecycle.js +0 -182
- package/dist/daemon/log.d.ts +0 -14
- package/dist/daemon/log.js +0 -57
- package/dist/daemon/pid.d.ts +0 -31
- package/dist/daemon/pid.js +0 -212
- package/dist/daemon/route.d.ts +0 -14
- package/dist/daemon/route.js +0 -43
- package/dist/daemon/server.d.ts +0 -67
- package/dist/daemon/server.js +0 -563
- package/dist/daemon/supervise.d.ts +0 -29
- package/dist/daemon/supervise.js +0 -100
- package/dist/daemon/supervisor.d.ts +0 -91
- package/dist/daemon/supervisor.js +0 -612
- package/dist/daemon/types.d.ts +0 -71
- package/dist/daemon/types.js +0 -2
- package/dist/dinox.d.ts +0 -2
- package/dist/editor/anchor.d.ts +0 -46
- package/dist/editor/anchor.js +0 -129
- package/dist/editor/blockIds.d.ts +0 -21
- package/dist/editor/blockIds.js +0 -51
- package/dist/editor/blocks.d.ts +0 -47
- package/dist/editor/blocks.js +0 -236
- package/dist/editor/compat.d.ts +0 -38
- package/dist/editor/compat.js +0 -410
- package/dist/editor/daemon.d.ts +0 -10
- package/dist/editor/daemon.js +0 -83
- package/dist/editor/document.d.ts +0 -74
- package/dist/editor/document.js +0 -88
- package/dist/editor/i18n.d.ts +0 -23
- package/dist/editor/i18n.js +0 -61
- package/dist/editor/install.d.ts +0 -90
- package/dist/editor/install.js +0 -335
- package/dist/editor/mcp.d.ts +0 -22
- package/dist/editor/mcp.js +0 -319
- package/dist/editor/meta.d.ts +0 -70
- package/dist/editor/meta.js +0 -163
- package/dist/editor/paths.d.ts +0 -2
- package/dist/editor/paths.js +0 -13
- package/dist/editor/persistence.d.ts +0 -4
- package/dist/editor/persistence.js +0 -35
- package/dist/editor/saveGuard.d.ts +0 -9
- package/dist/editor/saveGuard.js +0 -38
- package/dist/editor/schema.d.ts +0 -14
- package/dist/editor/schema.js +0 -38
- package/dist/editor/service.d.ts +0 -382
- package/dist/editor/service.js +0 -1174
- package/dist/editor/todos.d.ts +0 -67
- package/dist/editor/todos.js +0 -293
- package/dist/gateway/adapters/acp.d.ts +0 -75
- package/dist/gateway/adapters/acp.js +0 -431
- package/dist/gateway/adapters/codexImages.d.ts +0 -4
- package/dist/gateway/adapters/codexImages.js +0 -34
- package/dist/gateway/adapters/echo.d.ts +0 -12
- package/dist/gateway/adapters/echo.js +0 -54
- package/dist/gateway/adapters/index.d.ts +0 -13
- package/dist/gateway/adapters/index.js +0 -42
- package/dist/gateway/agentTaskHost.d.ts +0 -135
- package/dist/gateway/agentTaskHost.js +0 -410
- package/dist/gateway/assistantProjection.d.ts +0 -36
- package/dist/gateway/assistantProjection.js +0 -230
- package/dist/gateway/config.d.ts +0 -56
- package/dist/gateway/config.js +0 -312
- package/dist/gateway/conversationContext.d.ts +0 -44
- package/dist/gateway/conversationContext.js +0 -75
- package/dist/gateway/detect.d.ts +0 -63
- package/dist/gateway/detect.js +0 -281
- package/dist/gateway/deviceHost.d.ts +0 -100
- package/dist/gateway/deviceHost.js +0 -735
- package/dist/gateway/fileUpload.d.ts +0 -12
- package/dist/gateway/fileUpload.js +0 -154
- package/dist/gateway/keepAwake.d.ts +0 -24
- package/dist/gateway/keepAwake.js +0 -64
- package/dist/gateway/mcpCommandTools.d.ts +0 -62
- package/dist/gateway/mcpCommandTools.js +0 -220
- package/dist/gateway/mcpEnv.d.ts +0 -11
- package/dist/gateway/mcpEnv.js +0 -11
- package/dist/gateway/mcpGroups.d.ts +0 -3
- package/dist/gateway/mcpGroups.js +0 -4
- package/dist/gateway/mcpServer.d.ts +0 -25
- package/dist/gateway/mcpServer.js +0 -214
- package/dist/gateway/processTree.d.ts +0 -15
- package/dist/gateway/processTree.js +0 -60
- package/dist/gateway/protocol.d.ts +0 -145
- package/dist/gateway/protocol.js +0 -195
- package/dist/gateway/runExecutor.d.ts +0 -104
- package/dist/gateway/runExecutor.js +0 -480
- package/dist/gateway/service.d.ts +0 -35
- package/dist/gateway/service.js +0 -147
- package/dist/gateway/spawnAgent.d.ts +0 -12
- package/dist/gateway/spawnAgent.js +0 -32
- package/dist/gateway/streamPublisher.d.ts +0 -33
- package/dist/gateway/streamPublisher.js +0 -93
- package/dist/gateway/taskJournal.d.ts +0 -14
- package/dist/gateway/taskJournal.js +0 -47
- package/dist/gateway/threadStore.d.ts +0 -230
- package/dist/gateway/threadStore.js +0 -621
- package/dist/gateway/types.d.ts +0 -168
- package/dist/gateway/types.js +0 -12
- package/dist/gateway/workspace.d.ts +0 -5
- package/dist/gateway/workspace.js +0 -30
- package/dist/gateway/workspaceFolders.d.ts +0 -35
- package/dist/gateway/workspaceFolders.js +0 -142
- package/dist/gateway/workspaceListing.d.ts +0 -5
- package/dist/gateway/workspaceListing.js +0 -78
- package/dist/integrations/dsh/host.d.ts +0 -53
- package/dist/integrations/dsh/host.js +0 -245
- package/dist/integrations/dsh/mcpClient.d.ts +0 -66
- package/dist/integrations/dsh/mcpClient.js +0 -192
- package/dist/powersync/connector.d.ts +0 -22
- package/dist/powersync/connector.js +0 -91
- package/dist/powersync/exclusiveRuntime.d.ts +0 -21
- package/dist/powersync/exclusiveRuntime.js +0 -66
- package/dist/powersync/runtime.d.ts +0 -62
- package/dist/powersync/runtime.js +0 -358
- package/dist/powersync/schema/content.d.ts +0 -1
- package/dist/powersync/schema/content.js +0 -1
- package/dist/powersync/schema/electronCanonical.d.ts +0 -1561
- package/dist/powersync/schema/electronCanonical.js +0 -1154
- package/dist/powersync/schema/index.d.ts +0 -844
- package/dist/powersync/schema/index.js +0 -8
- package/dist/powersync/schema/local.d.ts +0 -13
- package/dist/powersync/schema/local.js +0 -24
- package/dist/powersync/schema/note.d.ts +0 -1
- package/dist/powersync/schema/note.js +0 -1
- package/dist/powersync/schema/notesExtras.d.ts +0 -1
- package/dist/powersync/schema/notesExtras.js +0 -1
- package/dist/powersync/schema/projects.d.ts +0 -1
- package/dist/powersync/schema/projects.js +0 -1
- package/dist/powersync/schema/savedViews.d.ts +0 -1
- package/dist/powersync/schema/savedViews.js +0 -1
- package/dist/powersync/schema/storage.d.ts +0 -1
- package/dist/powersync/schema/storage.js +0 -1
- package/dist/powersync/schema/tags.d.ts +0 -1
- package/dist/powersync/schema/tags.js +0 -1
- package/dist/powersync/syncGate.d.ts +0 -45
- package/dist/powersync/syncGate.js +0 -45
- package/dist/powersync/syncPass.d.ts +0 -9
- package/dist/powersync/syncPass.js +0 -33
- package/dist/powersync/tokenIndex.d.ts +0 -32
- package/dist/powersync/tokenIndex.js +0 -382
- package/dist/powersync/uploader.d.ts +0 -22
- package/dist/powersync/uploader.js +0 -231
- package/dist/requests/execute.d.ts +0 -11
- package/dist/requests/execute.js +0 -26
- package/dist/requests/store.d.ts +0 -10
- package/dist/requests/store.js +0 -190
- package/dist/runCli.d.ts +0 -2
- package/dist/runCli.js +0 -64
- package/dist/skills/check.d.ts +0 -7
- package/dist/skills/check.js +0 -747
- package/dist/skills/commandRefs.d.ts +0 -21
- package/dist/skills/commandRefs.js +0 -124
- package/dist/skills/generate.d.ts +0 -13
- package/dist/skills/generate.js +0 -80
- package/dist/skills/registry.d.ts +0 -13
- package/dist/skills/registry.js +0 -65
- package/dist/skills/retired.d.ts +0 -60
- package/dist/skills/retired.js +0 -58
- package/dist/utils/abort.d.ts +0 -6
- package/dist/utils/abort.js +0 -19
- package/dist/utils/argValue.d.ts +0 -1
- package/dist/utils/argValue.js +0 -18
- package/dist/utils/asyncRelease.d.ts +0 -2
- package/dist/utils/asyncRelease.js +0 -25
- package/dist/utils/authToken.d.ts +0 -4
- package/dist/utils/authToken.js +0 -28
- package/dist/utils/bidlinkCanonicalization.d.ts +0 -2
- package/dist/utils/bidlinkCanonicalization.js +0 -164
- package/dist/utils/consoleEncoding.d.ts +0 -5
- package/dist/utils/consoleEncoding.js +0 -27
- package/dist/utils/cursor.d.ts +0 -9
- package/dist/utils/cursor.js +0 -61
- package/dist/utils/deadline.d.ts +0 -8
- package/dist/utils/deadline.js +0 -31
- package/dist/utils/defaultFormat.d.ts +0 -8
- package/dist/utils/defaultFormat.js +0 -38
- package/dist/utils/dryRun.d.ts +0 -32
- package/dist/utils/dryRun.js +0 -88
- package/dist/utils/errorCodes.d.ts +0 -595
- package/dist/utils/errorCodes.js +0 -163
- package/dist/utils/errors.d.ts +0 -54
- package/dist/utils/errors.js +0 -277
- package/dist/utils/id.d.ts +0 -1
- package/dist/utils/id.js +0 -4
- package/dist/utils/nodeRuntime.d.ts +0 -4
- package/dist/utils/nodeRuntime.js +0 -12
- package/dist/utils/output.d.ts +0 -26
- package/dist/utils/output.js +0 -262
- package/dist/utils/processExit.d.ts +0 -1
- package/dist/utils/processExit.js +0 -33
- package/dist/utils/progress.d.ts +0 -25
- package/dist/utils/progress.js +0 -59
- package/dist/utils/redact.d.ts +0 -1
- package/dist/utils/redact.js +0 -10
- package/dist/utils/requestContext.d.ts +0 -32
- package/dist/utils/requestContext.js +0 -13
- package/dist/utils/select.d.ts +0 -20
- package/dist/utils/select.js +0 -92
- package/dist/utils/sqliteLease.d.ts +0 -8
- package/dist/utils/sqliteLease.js +0 -59
- package/dist/utils/syncTimeout.d.ts +0 -7
- package/dist/utils/syncTimeout.js +0 -20
- package/dist/utils/terminalSanitization.d.ts +0 -2
- package/dist/utils/terminalSanitization.js +0 -37
- package/dist/utils/text.d.ts +0 -1
- package/dist/utils/text.js +0 -35
- package/dist/utils/time.d.ts +0 -1
- package/dist/utils/time.js +0 -3
- package/dist/utils/tiptapMarkdown.d.ts +0 -9
- package/dist/utils/tiptapMarkdown.js +0 -381
- package/dist/utils/tiptapMarkdownSchema.d.ts +0 -37
- package/dist/utils/tiptapMarkdownSchema.js +0 -608
- package/dist/utils/tiptapMarkdownSchemaUtils.d.ts +0 -74
- package/dist/utils/tiptapMarkdownSchemaUtils.js +0 -394
- package/dist/utils/tiptapMarkdownSyntax.d.ts +0 -9
- package/dist/utils/tiptapMarkdownSyntax.js +0 -249
- package/dist/utils/tokenize.d.ts +0 -1
- package/dist/utils/tokenize.js +0 -67
- package/dist/utils/updateNotice.d.ts +0 -8
- package/dist/utils/updateNotice.js +0 -112
- package/dist/utils/usageError.d.ts +0 -37
- package/dist/utils/usageError.js +0 -127
- package/dist/utils/version.d.ts +0 -1
- package/dist/utils/version.js +0 -21
- package/dist/vendor/electron/domain/note-templates.d.ts +0 -3
- package/dist/vendor/electron/domain/note-templates.js +0 -232
- package/dist/vendor/electron/domain/properties.d.ts +0 -10
- package/dist/vendor/electron/domain/properties.js +0 -1549
- package/dist/vendor/electron/domain/saved-view-analytics.d.ts +0 -45
- package/dist/vendor/electron/domain/saved-view-analytics.js +0 -365
- package/dist/vendor/electron/domain/saved-view-relative-date.d.ts +0 -21
- package/dist/vendor/electron/domain/saved-view-relative-date.js +0 -153
- package/dist/vendor/electron/domain/saved-views.d.ts +0 -61
- package/dist/vendor/electron/domain/saved-views.js +0 -1120
- package/dist/vendor/electron/rpc.d.ts +0 -22
- package/dist/vendor/electron/rpc.js +0 -27
- package/dist/vendor/electron/shared/ai-errors.d.ts +0 -11
- package/dist/vendor/electron/shared/ai-errors.js +0 -107
- package/dist/vendor/electron/shared/external-types.d.ts +0 -20
- package/dist/vendor/electron/shared/external-types.js +0 -1
- package/dist/vendor/electron/shared/index.d.ts +0 -9
- package/dist/vendor/electron/shared/index.js +0 -7
- package/dist/vendor/electron/shared/note-properties.d.ts +0 -328
- package/dist/vendor/electron/shared/note-properties.js +0 -1027
- package/dist/vendor/electron/shared/note-templates.d.ts +0 -82
- package/dist/vendor/electron/shared/note-templates.js +0 -84
- package/dist/vendor/electron/shared/powersync-read-models.d.ts +0 -1716
- package/dist/vendor/electron/shared/powersync-read-models.js +0 -1
- package/dist/vendor/electron/shared/remote-device-agent.d.ts +0 -375
- package/dist/vendor/electron/shared/remote-device-agent.js +0 -191
- package/dist/vendor/electron/shared/saved-views.d.ts +0 -394
- package/dist/vendor/electron/shared/saved-views.js +0 -981
- package/dist/vendor/electron/shared/task-priority.d.ts +0 -42
- package/dist/vendor/electron/shared/task-priority.js +0 -186
- package/dist/vendor/electron/sql-utils.d.ts +0 -5
- package/dist/vendor/electron/sql-utils.js +0 -32
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import type { AbstractPowerSyncDatabase } from '@powersync/common';
|
|
2
|
-
import type { RemoteDeviceRunRequest, RemoteDeviceToolApprovalAckCode } from '../vendor/electron/shared/remote-device-agent.js';
|
|
3
|
-
import type { RunSnapshot } from './streamPublisher.js';
|
|
4
|
-
import type { GatewayAdapter, GatewayDefinition, GatewayFileSource, GatewaySentFile } from './types.js';
|
|
5
|
-
/** Turns waiting behind a thread's active one; more are refused as `busy`. */
|
|
6
|
-
export declare const MAX_QUEUED_TURNS = 10;
|
|
7
|
-
/** Files one reply may carry, like the attachments of one message. */
|
|
8
|
-
export declare const MAX_SENT_FILES_PER_TURN = 16;
|
|
9
|
-
/** How long a turn waits for the client's latest messages to sync to this machine. */
|
|
10
|
-
export declare const CLIENT_TAIL_SYNC_TIMEOUT_MS = 5000;
|
|
11
|
-
type Logger = (message: string, details?: Record<string, unknown>) => void;
|
|
12
|
-
type Emit = (snapshot: RunSnapshot) => void;
|
|
13
|
-
export declare class QueueFullError extends Error {
|
|
14
|
-
constructor();
|
|
15
|
-
}
|
|
16
|
-
export type RunExecutorDeps = {
|
|
17
|
-
db: AbstractPowerSyncDatabase;
|
|
18
|
-
userId: string;
|
|
19
|
-
gateway: GatewayDefinition;
|
|
20
|
-
adapter: GatewayAdapter;
|
|
21
|
-
log: Logger;
|
|
22
|
-
/** Overrides CLIENT_TAIL_SYNC_TIMEOUT_MS (tests). */
|
|
23
|
-
clientTailSyncTimeoutMs?: number;
|
|
24
|
-
/** Keeps the computer awake while a turn runs; returns the release. */
|
|
25
|
-
keepAwake?: () => () => void;
|
|
26
|
-
/** Uploads a file the agent sends to the user; absent, sending files fails. */
|
|
27
|
-
uploadFile?: (file: GatewayFileSource) => Promise<GatewaySentFile>;
|
|
28
|
-
};
|
|
29
|
-
/** The user's instructions for the agent, as the start of a new session. */
|
|
30
|
-
export declare function agentInstructionsPreamble(instructions: string): string | undefined;
|
|
31
|
-
/** How the user sees this conversation, so the agent hands over files instead of printing their paths. */
|
|
32
|
-
export declare const SESSION_DELIVERY_NOTE: string;
|
|
33
|
-
/** The knowledge tools available to the agent in Dinox. */
|
|
34
|
-
export declare const DINOX_KNOWLEDGE_NOTE: string;
|
|
35
|
-
/** What a new session starts with: available tools, then the user's instructions. */
|
|
36
|
-
export declare function sessionPreamble(instructions: string, options: {
|
|
37
|
-
delivery: boolean;
|
|
38
|
-
knowledge: boolean;
|
|
39
|
-
}): string | undefined;
|
|
40
|
-
/**
|
|
41
|
-
* Runs accepted turns on one gateway. A thread has at most one active run;
|
|
42
|
-
* turns sent meanwhile wait in a per-thread FIFO and, when it ends, run
|
|
43
|
-
* together as one turn (each keeps its own message; the reply follows the
|
|
44
|
-
* last). The agent session is scoped to the thread's current topic: a "new
|
|
45
|
-
* topic" marker in Dinox starts a fresh agent session, everything else continues it.
|
|
46
|
-
* The thread may have been answered by other agents meanwhile, so each turn
|
|
47
|
-
* also carries the messages this gateway's session has not seen.
|
|
48
|
-
*/
|
|
49
|
-
export declare class GatewayRunExecutor {
|
|
50
|
-
private readonly deps;
|
|
51
|
-
private readonly activeByThread;
|
|
52
|
-
/** The request each active run answers, for parenting turns queued behind it. */
|
|
53
|
-
private readonly activeRequests;
|
|
54
|
-
private readonly queuedByThread;
|
|
55
|
-
private queueIndex;
|
|
56
|
-
/** Accepts of one thread run one at a time, so two can never both start a turn. */
|
|
57
|
-
private readonly acceptChains;
|
|
58
|
-
private readonly missingTails;
|
|
59
|
-
constructor(deps: RunExecutorDeps);
|
|
60
|
-
/** Threads with an active or waiting turn. */
|
|
61
|
-
busyThreadIds(): string[];
|
|
62
|
-
isBusy(threadId: string): boolean;
|
|
63
|
-
/** Persists the turn, then runs it now or queues it behind the thread's active turn. */
|
|
64
|
-
accept(request: RemoteDeviceRunRequest, emit: Emit): Promise<{
|
|
65
|
-
threadCreated: boolean;
|
|
66
|
-
queued: boolean;
|
|
67
|
-
}>;
|
|
68
|
-
private acceptInOrder;
|
|
69
|
-
/** Stops the active turn, or withdraws a waiting one. */
|
|
70
|
-
cancel(runId: string, threadId: string): boolean;
|
|
71
|
-
cancelAll(): void;
|
|
72
|
-
/** A queued turn follows the last one waiting, else the reply being written. */
|
|
73
|
-
private queuedParentFor;
|
|
74
|
-
private setQueue;
|
|
75
|
-
private start;
|
|
76
|
-
/**
|
|
77
|
-
* Runs everything that waited as one turn: the agent reads the messages
|
|
78
|
-
* together, as the user meant them, instead of answering each in isolation.
|
|
79
|
-
* Earlier turns end as merged into the last, which carries the reply.
|
|
80
|
-
*/
|
|
81
|
-
private drain;
|
|
82
|
-
respondApproval(input: {
|
|
83
|
-
runId: string;
|
|
84
|
-
threadId: string;
|
|
85
|
-
approvalId: string;
|
|
86
|
-
approved: boolean;
|
|
87
|
-
}): RemoteDeviceToolApprovalAckCode;
|
|
88
|
-
private execute;
|
|
89
|
-
/**
|
|
90
|
-
* The client sends the last message it saw; a turn reads the transcript only
|
|
91
|
-
* once that message has synced here (its upload may still be in flight), or
|
|
92
|
-
* gives up after a short wait. A tail that never arrived is not waited for again.
|
|
93
|
-
*/
|
|
94
|
-
private clientTailSynced;
|
|
95
|
-
/**
|
|
96
|
-
* Messages before this turn that the session has not seen: the whole topic
|
|
97
|
-
* for a new session, those after the session's mark for a continued one,
|
|
98
|
-
* leaving out the turns the session answered itself. A session bound before
|
|
99
|
-
* seen messages were tracked is assumed to be up to date.
|
|
100
|
-
*/
|
|
101
|
-
private unseenContext;
|
|
102
|
-
private resolveResources;
|
|
103
|
-
}
|
|
104
|
-
export {};
|
|
@@ -1,480 +0,0 @@
|
|
|
1
|
-
import { AssistantProjection, projectPendingApprovals, toTranscriptMessage } from './assistantProjection.js';
|
|
2
|
-
import { CONTEXT_MESSAGE_LIMIT, withConversationContext } from './conversationContext.js';
|
|
3
|
-
import { commitRunTerminal, enqueueRun, finishMergedRun, startQueuedRuns, TERMINAL_RUN_STATUSES, withdrawQueuedRun, readAgentInstructions, readCurrentTopic, readSessionBinding, readTranscriptPage, resolveTrustedResource, updateRunSnapshot, waitForMessage, withGatewaySession, writeSessionBinding, } from './threadStore.js';
|
|
4
|
-
import { AGENT_CWD_CONFIG_KEY, readAgentConfig } from './protocol.js';
|
|
5
|
-
import { resolveTurnWorkspace, queuedTurnPrompt } from './workspace.js';
|
|
6
|
-
const SNAPSHOT_PERSIST_INTERVAL_MS = 1_000;
|
|
7
|
-
/** Turns waiting behind a thread's active one; more are refused as `busy`. */
|
|
8
|
-
export const MAX_QUEUED_TURNS = 10;
|
|
9
|
-
const APPROVAL_TIMEOUT_MS = 30 * 60 * 1000;
|
|
10
|
-
/** The agent's instructions travel with a new session's first prompt; longer ones are cut. */
|
|
11
|
-
const MAX_INSTRUCTIONS_CHARS = 8_000;
|
|
12
|
-
/** Files one reply may carry, like the attachments of one message. */
|
|
13
|
-
export const MAX_SENT_FILES_PER_TURN = 16;
|
|
14
|
-
/** How long a turn waits for the client's latest messages to sync to this machine. */
|
|
15
|
-
export const CLIENT_TAIL_SYNC_TIMEOUT_MS = 5_000;
|
|
16
|
-
/** Client tails that never synced, so later turns of their thread do not wait for them again. */
|
|
17
|
-
const MAX_REMEMBERED_MISSING_TAILS = 200;
|
|
18
|
-
export class QueueFullError extends Error {
|
|
19
|
-
constructor() {
|
|
20
|
-
super(`At most ${MAX_QUEUED_TURNS} messages can wait in one conversation`);
|
|
21
|
-
this.name = 'QueueFullError';
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
function statusForStop(stopReason) {
|
|
25
|
-
if (stopReason === 'cancelled')
|
|
26
|
-
return 'cancelled';
|
|
27
|
-
if (stopReason === 'error')
|
|
28
|
-
return 'failed';
|
|
29
|
-
return 'succeeded';
|
|
30
|
-
}
|
|
31
|
-
/** The user's instructions for the agent, as the start of a new session. */
|
|
32
|
-
export function agentInstructionsPreamble(instructions) {
|
|
33
|
-
const text = instructions.trim();
|
|
34
|
-
if (!text)
|
|
35
|
-
return undefined;
|
|
36
|
-
const clipped = text.length > MAX_INSTRUCTIONS_CHARS ? `${text.slice(0, MAX_INSTRUCTIONS_CHARS)}…` : text;
|
|
37
|
-
return [
|
|
38
|
-
'<dinox_agent_instructions>',
|
|
39
|
-
'Instructions the user set for you in Dinox. Follow them throughout this conversation.',
|
|
40
|
-
'',
|
|
41
|
-
clipped.replaceAll('</dinox_agent_instructions>', '<\\/dinox_agent_instructions>'),
|
|
42
|
-
'</dinox_agent_instructions>',
|
|
43
|
-
].join('\n');
|
|
44
|
-
}
|
|
45
|
-
/** How the user sees this conversation, so the agent hands over files instead of printing their paths. */
|
|
46
|
-
export const SESSION_DELIVERY_NOTE = [
|
|
47
|
-
'<dinox_delivery>',
|
|
48
|
-
'The user reads your replies in the Dinox app, usually on another device, and cannot open files on this computer.',
|
|
49
|
-
'To show them a file you made or found (an image, a document, a chart, ...), call the Dinox send_file tool with its path.',
|
|
50
|
-
'</dinox_delivery>',
|
|
51
|
-
].join('\n');
|
|
52
|
-
/** The knowledge tools available to the agent in Dinox. */
|
|
53
|
-
export const DINOX_KNOWLEDGE_NOTE = [
|
|
54
|
-
'<dinox_knowledge>',
|
|
55
|
-
"The Dinox tools can search and read the user's Dinox notes, todos and conversations (search_notes, read_note, search_todos, related_notes, read_conversation). The dinox_* tools can also create, update and organize Dinox data. Confirm with the user before writes they did not request, and dry-run high-risk actions first. Use them when the request may involve what the user has written down in Dinox.",
|
|
56
|
-
'</dinox_knowledge>',
|
|
57
|
-
].join('\n');
|
|
58
|
-
/** What a new session starts with: available tools, then the user's instructions. */
|
|
59
|
-
export function sessionPreamble(instructions, options) {
|
|
60
|
-
return [options.delivery && SESSION_DELIVERY_NOTE, options.knowledge && DINOX_KNOWLEDGE_NOTE, agentInstructionsPreamble(instructions)].filter(Boolean).join('\n\n') || undefined;
|
|
61
|
-
}
|
|
62
|
-
function withErrorText(message, error) {
|
|
63
|
-
return { ...message, metadata: { ...(message.metadata ?? {}), error } };
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Runs accepted turns on one gateway. A thread has at most one active run;
|
|
67
|
-
* turns sent meanwhile wait in a per-thread FIFO and, when it ends, run
|
|
68
|
-
* together as one turn (each keeps its own message; the reply follows the
|
|
69
|
-
* last). The agent session is scoped to the thread's current topic: a "new
|
|
70
|
-
* topic" marker in Dinox starts a fresh agent session, everything else continues it.
|
|
71
|
-
* The thread may have been answered by other agents meanwhile, so each turn
|
|
72
|
-
* also carries the messages this gateway's session has not seen.
|
|
73
|
-
*/
|
|
74
|
-
export class GatewayRunExecutor {
|
|
75
|
-
deps;
|
|
76
|
-
activeByThread = new Map();
|
|
77
|
-
/** The request each active run answers, for parenting turns queued behind it. */
|
|
78
|
-
activeRequests = new Map();
|
|
79
|
-
queuedByThread = new Map();
|
|
80
|
-
queueIndex = 0;
|
|
81
|
-
/** Accepts of one thread run one at a time, so two can never both start a turn. */
|
|
82
|
-
acceptChains = new Map();
|
|
83
|
-
missingTails = new Set();
|
|
84
|
-
constructor(deps) {
|
|
85
|
-
this.deps = deps;
|
|
86
|
-
}
|
|
87
|
-
/** Threads with an active or waiting turn. */
|
|
88
|
-
busyThreadIds() {
|
|
89
|
-
return [...new Set([...this.activeByThread.keys(), ...this.queuedByThread.keys()])];
|
|
90
|
-
}
|
|
91
|
-
isBusy(threadId) {
|
|
92
|
-
return this.activeByThread.has(threadId) || this.queuedByThread.has(threadId);
|
|
93
|
-
}
|
|
94
|
-
/** Persists the turn, then runs it now or queues it behind the thread's active turn. */
|
|
95
|
-
accept(request, emit) {
|
|
96
|
-
const previous = this.acceptChains.get(request.threadId) ?? Promise.resolve();
|
|
97
|
-
const next = previous.catch(() => undefined).then(() => this.acceptInOrder(request, emit));
|
|
98
|
-
this.acceptChains.set(request.threadId, next);
|
|
99
|
-
void next
|
|
100
|
-
.catch(() => undefined)
|
|
101
|
-
.finally(() => {
|
|
102
|
-
if (this.acceptChains.get(request.threadId) === next)
|
|
103
|
-
this.acceptChains.delete(request.threadId);
|
|
104
|
-
});
|
|
105
|
-
return next;
|
|
106
|
-
}
|
|
107
|
-
async acceptInOrder(request, emit) {
|
|
108
|
-
const waiting = this.queuedByThread.get(request.threadId) ?? [];
|
|
109
|
-
const queued = this.isBusy(request.threadId);
|
|
110
|
-
if (queued && waiting.length >= MAX_QUEUED_TURNS)
|
|
111
|
-
throw new QueueFullError();
|
|
112
|
-
// Strictly increasing within this process, like the desktop's queue index.
|
|
113
|
-
this.queueIndex = Math.max(Date.now(), this.queueIndex + 1);
|
|
114
|
-
const { threadCreated } = await enqueueRun(this.deps.db, {
|
|
115
|
-
runId: request.runId,
|
|
116
|
-
threadId: request.threadId,
|
|
117
|
-
userId: this.deps.userId,
|
|
118
|
-
requestId: request.requestId,
|
|
119
|
-
userMessage: request.userMessage,
|
|
120
|
-
assistantMessage: request.assistantMessage,
|
|
121
|
-
parentMessageId: request.parentMessageId ?? null,
|
|
122
|
-
createThread: request.createThread ?? null,
|
|
123
|
-
requestPayload: { trigger: 'submit-message', gatewayId: this.deps.gateway.id, prompt: request.prompt },
|
|
124
|
-
queued,
|
|
125
|
-
queueIndex: this.queueIndex,
|
|
126
|
-
...(queued ? { queuedAfterMessageId: this.queuedParentFor(request.threadId) } : {}),
|
|
127
|
-
});
|
|
128
|
-
// The active turn may have ended while this one was being persisted.
|
|
129
|
-
if (queued && this.isBusy(request.threadId)) {
|
|
130
|
-
this.queuedByThread.set(request.threadId, [...(this.queuedByThread.get(request.threadId) ?? []), { request, emit }]);
|
|
131
|
-
emit({ revision: 0, status: 'queued', assistant: request.assistantMessage, pendingApprovals: [] });
|
|
132
|
-
return { threadCreated, queued: true };
|
|
133
|
-
}
|
|
134
|
-
if (queued) {
|
|
135
|
-
// Persisted as queued but nothing is ahead any more: start it, dropping the marker.
|
|
136
|
-
await startQueuedRuns(this.deps.db, [request.userMessage.id]);
|
|
137
|
-
}
|
|
138
|
-
this.start(request, emit, []);
|
|
139
|
-
return { threadCreated, queued: false };
|
|
140
|
-
}
|
|
141
|
-
/** Stops the active turn, or withdraws a waiting one. */
|
|
142
|
-
cancel(runId, threadId) {
|
|
143
|
-
const active = this.activeByThread.get(threadId);
|
|
144
|
-
if (active?.runId === runId) {
|
|
145
|
-
active.controller.abort(new Error('cancelled by user'));
|
|
146
|
-
for (const approval of active.approvals.values())
|
|
147
|
-
approval.resolve(false);
|
|
148
|
-
return true;
|
|
149
|
-
}
|
|
150
|
-
const waiting = this.queuedByThread.get(threadId) ?? [];
|
|
151
|
-
const turn = waiting.find((item) => item.request.runId === runId);
|
|
152
|
-
if (!turn)
|
|
153
|
-
return false;
|
|
154
|
-
this.setQueue(threadId, waiting.filter((item) => item !== turn));
|
|
155
|
-
void withdrawQueuedRun(this.deps.db, {
|
|
156
|
-
runId,
|
|
157
|
-
userMessageId: turn.request.userMessage.id,
|
|
158
|
-
assistant: turn.request.assistantMessage,
|
|
159
|
-
})
|
|
160
|
-
.then((assistant) => turn.emit({ revision: 1, status: 'cancelled', assistant, pendingApprovals: [] }))
|
|
161
|
-
.catch((error) => this.deps.log('withdraw queued turn failed', { runId, error: String(error) }));
|
|
162
|
-
return true;
|
|
163
|
-
}
|
|
164
|
-
cancelAll() {
|
|
165
|
-
// Waiting turns are left to the next start, which marks them interrupted.
|
|
166
|
-
this.queuedByThread.clear();
|
|
167
|
-
for (const active of this.activeByThread.values())
|
|
168
|
-
this.cancel(active.runId, active.threadId);
|
|
169
|
-
}
|
|
170
|
-
/** A queued turn follows the last one waiting, else the reply being written. */
|
|
171
|
-
queuedParentFor(threadId) {
|
|
172
|
-
const waiting = this.queuedByThread.get(threadId);
|
|
173
|
-
return (waiting?.at(-1)?.request.userMessage.id ?? this.activeRequests.get(threadId)?.assistantMessage.id);
|
|
174
|
-
}
|
|
175
|
-
setQueue(threadId, turns) {
|
|
176
|
-
if (turns.length > 0)
|
|
177
|
-
this.queuedByThread.set(threadId, turns);
|
|
178
|
-
else
|
|
179
|
-
this.queuedByThread.delete(threadId);
|
|
180
|
-
}
|
|
181
|
-
start(request, emit, merged) {
|
|
182
|
-
const active = {
|
|
183
|
-
runId: request.runId,
|
|
184
|
-
threadId: request.threadId,
|
|
185
|
-
controller: new AbortController(),
|
|
186
|
-
approvals: new Map(),
|
|
187
|
-
answered: new Set(),
|
|
188
|
-
};
|
|
189
|
-
this.activeByThread.set(request.threadId, active);
|
|
190
|
-
this.activeRequests.set(request.threadId, request);
|
|
191
|
-
const releaseAwake = this.deps.keepAwake?.();
|
|
192
|
-
void this.execute(request, active, emit, merged).finally(() => {
|
|
193
|
-
releaseAwake?.();
|
|
194
|
-
if (this.activeByThread.get(request.threadId) === active) {
|
|
195
|
-
this.activeByThread.delete(request.threadId);
|
|
196
|
-
this.activeRequests.delete(request.threadId);
|
|
197
|
-
}
|
|
198
|
-
void this.drain(request.threadId).catch((error) => this.deps.log('start queued turns failed', { threadId: request.threadId, error: String(error) }));
|
|
199
|
-
});
|
|
200
|
-
}
|
|
201
|
-
/**
|
|
202
|
-
* Runs everything that waited as one turn: the agent reads the messages
|
|
203
|
-
* together, as the user meant them, instead of answering each in isolation.
|
|
204
|
-
* Earlier turns end as merged into the last, which carries the reply.
|
|
205
|
-
*/
|
|
206
|
-
async drain(threadId) {
|
|
207
|
-
if (this.activeByThread.has(threadId))
|
|
208
|
-
return;
|
|
209
|
-
const waiting = this.queuedByThread.get(threadId) ?? [];
|
|
210
|
-
this.queuedByThread.delete(threadId);
|
|
211
|
-
const last = waiting.at(-1);
|
|
212
|
-
if (!last)
|
|
213
|
-
return;
|
|
214
|
-
const earlier = waiting.slice(0, -1);
|
|
215
|
-
await startQueuedRuns(this.deps.db, waiting.map((turn) => turn.request.userMessage.id));
|
|
216
|
-
for (const turn of earlier) {
|
|
217
|
-
const assistant = await finishMergedRun(this.deps.db, {
|
|
218
|
-
runId: turn.request.runId,
|
|
219
|
-
mergedIntoRunId: last.request.runId,
|
|
220
|
-
assistant: turn.request.assistantMessage,
|
|
221
|
-
});
|
|
222
|
-
turn.emit({ revision: 1, status: 'succeeded', assistant, pendingApprovals: [] });
|
|
223
|
-
}
|
|
224
|
-
this.start(last.request, last.emit, earlier.map((turn) => turn.request));
|
|
225
|
-
}
|
|
226
|
-
respondApproval(input) {
|
|
227
|
-
const active = this.activeByThread.get(input.threadId);
|
|
228
|
-
if (!active || active.runId !== input.runId)
|
|
229
|
-
return 'stale';
|
|
230
|
-
if (active.answered.has(input.approvalId))
|
|
231
|
-
return 'already_applied';
|
|
232
|
-
const pending = active.approvals.get(input.approvalId);
|
|
233
|
-
if (!pending)
|
|
234
|
-
return 'stale';
|
|
235
|
-
pending.resolve(input.approved);
|
|
236
|
-
return 'applied';
|
|
237
|
-
}
|
|
238
|
-
async execute(request, active, emit,
|
|
239
|
-
/** Earlier queued turns answered together with this one. */
|
|
240
|
-
merged) {
|
|
241
|
-
const { db, gateway, adapter, log } = this.deps;
|
|
242
|
-
const projection = new AssistantProjection(request.assistantMessage);
|
|
243
|
-
let status = 'running';
|
|
244
|
-
let lastPersistedAt = 0;
|
|
245
|
-
const publish = (persist) => {
|
|
246
|
-
const assistant = projection.snapshot();
|
|
247
|
-
emit({
|
|
248
|
-
revision: projection.revision,
|
|
249
|
-
status,
|
|
250
|
-
assistant,
|
|
251
|
-
pendingApprovals: projectPendingApprovals(assistant, { runId: active.runId, threadId: active.threadId }),
|
|
252
|
-
});
|
|
253
|
-
const now = Date.now();
|
|
254
|
-
if (persist || now - lastPersistedAt >= SNAPSHOT_PERSIST_INTERVAL_MS) {
|
|
255
|
-
lastPersistedAt = now;
|
|
256
|
-
void updateRunSnapshot(db, { runId: active.runId, status, assistant }).catch((error) => log('persist run snapshot failed', { runId: active.runId, error: String(error) }));
|
|
257
|
-
}
|
|
258
|
-
};
|
|
259
|
-
// Registered when the approval request is emitted, so a reply that races
|
|
260
|
-
// ahead of the adapter's await is still applied.
|
|
261
|
-
const decisions = new Map();
|
|
262
|
-
const registerApproval = (approvalId) => {
|
|
263
|
-
const existing = decisions.get(approvalId);
|
|
264
|
-
if (existing)
|
|
265
|
-
return existing;
|
|
266
|
-
const decision = new Promise((resolve) => {
|
|
267
|
-
const finish = (approved) => {
|
|
268
|
-
clearTimeout(timer);
|
|
269
|
-
active.approvals.delete(approvalId);
|
|
270
|
-
active.answered.add(approvalId);
|
|
271
|
-
status = active.approvals.size > 0 ? 'waiting_approval' : 'running';
|
|
272
|
-
resolve(approved);
|
|
273
|
-
};
|
|
274
|
-
const timer = setTimeout(() => finish(false), APPROVAL_TIMEOUT_MS);
|
|
275
|
-
active.approvals.set(approvalId, { resolve: finish, timer });
|
|
276
|
-
if (active.controller.signal.aborted)
|
|
277
|
-
finish(false);
|
|
278
|
-
});
|
|
279
|
-
decisions.set(approvalId, decision);
|
|
280
|
-
return decision;
|
|
281
|
-
};
|
|
282
|
-
const awaitApproval = registerApproval;
|
|
283
|
-
// Uploads still running when the agent ends its turn finish before the reply is committed.
|
|
284
|
-
const uploads = new Set();
|
|
285
|
-
let filesSent = 0;
|
|
286
|
-
const sendFile = (file) => {
|
|
287
|
-
const upload = this.deps.uploadFile;
|
|
288
|
-
if (!upload)
|
|
289
|
-
return Promise.reject(new Error('Sending files is not available on this computer'));
|
|
290
|
-
if (filesSent >= MAX_SENT_FILES_PER_TURN) {
|
|
291
|
-
return Promise.reject(new Error(`At most ${MAX_SENT_FILES_PER_TURN} files can be sent in one reply`));
|
|
292
|
-
}
|
|
293
|
-
filesSent += 1;
|
|
294
|
-
const pending = upload(file).then((sent) => {
|
|
295
|
-
projection.addFile(sent);
|
|
296
|
-
// Once the turn has ended, the terminal snapshot carries the file.
|
|
297
|
-
if (!TERMINAL_RUN_STATUSES.has(status))
|
|
298
|
-
publish(true);
|
|
299
|
-
return sent;
|
|
300
|
-
});
|
|
301
|
-
uploads.add(pending);
|
|
302
|
-
void pending
|
|
303
|
-
.catch((error) => log('send file failed', { runId: active.runId, error: String(error) }))
|
|
304
|
-
.finally(() => uploads.delete(pending));
|
|
305
|
-
return pending;
|
|
306
|
-
};
|
|
307
|
-
let errorText = null;
|
|
308
|
-
let nextBinding = null;
|
|
309
|
-
try {
|
|
310
|
-
publish(true);
|
|
311
|
-
const [topic, binding] = await Promise.all([
|
|
312
|
-
readCurrentTopic(db, active.threadId),
|
|
313
|
-
readSessionBinding(db, active.threadId, gateway.id),
|
|
314
|
-
]);
|
|
315
|
-
const topicId = topic?.id ?? null;
|
|
316
|
-
let continued = binding?.topicId === topicId ? binding : null;
|
|
317
|
-
const turns = [...merged, request];
|
|
318
|
-
const tailSynced = this.clientTailSynced(turns[0], active.controller.signal);
|
|
319
|
-
const [resources, initialContext, instructions] = await Promise.all([
|
|
320
|
-
Promise.all(turns.map((turn) => this.resolveResources(turn.userMessage))).then((lists) => lists.flat()),
|
|
321
|
-
tailSynced.then((synced) => this.unseenContext(active.threadId, turns[0].userMessage.id, topic?.createdAt ?? null, continued, synced)),
|
|
322
|
-
readAgentInstructions(db, active.threadId).catch(() => ''),
|
|
323
|
-
]);
|
|
324
|
-
let context = initialContext;
|
|
325
|
-
const requestedConfig = readAgentConfig(request);
|
|
326
|
-
const agentConfig = requestedConfig && requestedConfig !== 'invalid' ? { ...requestedConfig } : undefined;
|
|
327
|
-
const cwd = await resolveTurnWorkspace(gateway, binding, !!continued, agentConfig);
|
|
328
|
-
if (agentConfig)
|
|
329
|
-
delete agentConfig[AGENT_CWD_CONFIG_KEY];
|
|
330
|
-
const prompt = queuedTurnPrompt(turns.map((turn) => turn.prompt));
|
|
331
|
-
const result = await adapter.runTurn({
|
|
332
|
-
sessionId: continued?.sessionId ?? null,
|
|
333
|
-
cwd,
|
|
334
|
-
prompt: async ({ created }) => {
|
|
335
|
-
if (created && continued) {
|
|
336
|
-
continued = null;
|
|
337
|
-
// A failed load has no retained history, including this gateway's own replies.
|
|
338
|
-
const synced = await tailSynced;
|
|
339
|
-
context = await this.unseenContext(active.threadId, turns[0].userMessage.id, topic?.createdAt ?? null, null, synced);
|
|
340
|
-
}
|
|
341
|
-
const text = withConversationContext(prompt, context, { canReadConversation: gateway.dinoxTools !== false });
|
|
342
|
-
const preamble = created && sessionPreamble(instructions, { delivery: !!this.deps.uploadFile, knowledge: gateway.dinoxTools !== false });
|
|
343
|
-
return preamble ? `${preamble}\n\n${text}` : text;
|
|
344
|
-
},
|
|
345
|
-
resources,
|
|
346
|
-
signal: active.controller.signal,
|
|
347
|
-
config: agentConfig,
|
|
348
|
-
awaitApproval,
|
|
349
|
-
sendFile,
|
|
350
|
-
onEvent: (event) => {
|
|
351
|
-
projection.apply(event);
|
|
352
|
-
if (event.type === 'approval-request') {
|
|
353
|
-
void registerApproval(event.approvalId);
|
|
354
|
-
status = 'waiting_approval';
|
|
355
|
-
}
|
|
356
|
-
publish(event.type === 'approval-request' || event.type === 'approval-resolved');
|
|
357
|
-
},
|
|
358
|
-
});
|
|
359
|
-
// Files still uploading belong to this reply: the turn ends once they are in it.
|
|
360
|
-
await Promise.allSettled([...uploads]);
|
|
361
|
-
nextBinding = {
|
|
362
|
-
sessionId: result.sessionId,
|
|
363
|
-
topicId,
|
|
364
|
-
cwd,
|
|
365
|
-
lastSeenMessageId: context?.incomplete
|
|
366
|
-
? // Messages that had not synced yet sort before this turn: keep the mark so the
|
|
367
|
-
// next turn still catches up on them (its own turns are left out by session).
|
|
368
|
-
continued && continued.sessionId === result.sessionId && !continued.legacy
|
|
369
|
-
? continued.lastSeenMessageId
|
|
370
|
-
: null
|
|
371
|
-
: // Its own reply is the newest message the session has seen.
|
|
372
|
-
request.assistantMessage.id,
|
|
373
|
-
};
|
|
374
|
-
status = statusForStop(result.stopReason);
|
|
375
|
-
errorText = result.error ?? null;
|
|
376
|
-
}
|
|
377
|
-
catch (error) {
|
|
378
|
-
status = active.controller.signal.aborted ? 'cancelled' : 'failed';
|
|
379
|
-
errorText = error instanceof Error ? error.message : String(error);
|
|
380
|
-
log('gateway run failed', { runId: active.runId, error: errorText });
|
|
381
|
-
}
|
|
382
|
-
finally {
|
|
383
|
-
for (const approval of active.approvals.values())
|
|
384
|
-
clearTimeout(approval.timer);
|
|
385
|
-
}
|
|
386
|
-
await Promise.allSettled([...uploads]);
|
|
387
|
-
projection.finish();
|
|
388
|
-
const assistant = errorText ? withErrorText(projection.snapshot(), errorText) : projection.snapshot();
|
|
389
|
-
try {
|
|
390
|
-
await commitRunTerminal(db, {
|
|
391
|
-
runId: active.runId,
|
|
392
|
-
threadId: active.threadId,
|
|
393
|
-
userId: this.deps.userId,
|
|
394
|
-
userMessageId: request.userMessage.id,
|
|
395
|
-
status,
|
|
396
|
-
assistant: nextBinding
|
|
397
|
-
? withGatewaySession(toTranscriptMessage(assistant), { gatewayId: gateway.id, sessionId: nextBinding.sessionId })
|
|
398
|
-
: toTranscriptMessage(assistant),
|
|
399
|
-
errorText,
|
|
400
|
-
});
|
|
401
|
-
}
|
|
402
|
-
catch (error) {
|
|
403
|
-
log('commit run terminal failed', { runId: active.runId, error: String(error) });
|
|
404
|
-
}
|
|
405
|
-
if (nextBinding) {
|
|
406
|
-
// After the commit, so the reply it marks as seen is in the transcript.
|
|
407
|
-
await writeSessionBinding(db, active.threadId, gateway.id, nextBinding).catch((error) => log('write session binding failed', { runId: active.runId, error: String(error) }));
|
|
408
|
-
}
|
|
409
|
-
emit({ revision: projection.revision, status, assistant, pendingApprovals: [] });
|
|
410
|
-
}
|
|
411
|
-
/**
|
|
412
|
-
* The client sends the last message it saw; a turn reads the transcript only
|
|
413
|
-
* once that message has synced here (its upload may still be in flight), or
|
|
414
|
-
* gives up after a short wait. A tail that never arrived is not waited for again.
|
|
415
|
-
*/
|
|
416
|
-
async clientTailSynced(request, signal) {
|
|
417
|
-
const tailId = request.parentMessageId;
|
|
418
|
-
if (!tailId)
|
|
419
|
-
return true;
|
|
420
|
-
const key = `${request.threadId}:${tailId}`;
|
|
421
|
-
const synced = await waitForMessage(this.deps.db, tailId, {
|
|
422
|
-
timeoutMs: this.missingTails.has(key) ? 0 : (this.deps.clientTailSyncTimeoutMs ?? CLIENT_TAIL_SYNC_TIMEOUT_MS),
|
|
423
|
-
signal,
|
|
424
|
-
});
|
|
425
|
-
if (synced) {
|
|
426
|
-
this.missingTails.delete(key);
|
|
427
|
-
}
|
|
428
|
-
else {
|
|
429
|
-
if (this.missingTails.size >= MAX_REMEMBERED_MISSING_TAILS)
|
|
430
|
-
this.missingTails.clear();
|
|
431
|
-
this.missingTails.add(key);
|
|
432
|
-
this.deps.log('client messages not synced yet', { threadId: request.threadId, tailId });
|
|
433
|
-
}
|
|
434
|
-
return synced;
|
|
435
|
-
}
|
|
436
|
-
/**
|
|
437
|
-
* Messages before this turn that the session has not seen: the whole topic
|
|
438
|
-
* for a new session, those after the session's mark for a continued one,
|
|
439
|
-
* leaving out the turns the session answered itself. A session bound before
|
|
440
|
-
* seen messages were tracked is assumed to be up to date.
|
|
441
|
-
*/
|
|
442
|
-
async unseenContext(threadId, turnMessageId, topicStartedAt, continued, synced) {
|
|
443
|
-
if (continued?.legacy)
|
|
444
|
-
return synced ? null : { threadId, messages: [], earlier: 0, incomplete: true };
|
|
445
|
-
try {
|
|
446
|
-
const page = await readTranscriptPage(this.deps.db, {
|
|
447
|
-
threadId,
|
|
448
|
-
since: topicStartedAt,
|
|
449
|
-
afterMessageId: continued?.lastSeenMessageId ?? null,
|
|
450
|
-
beforeMessageId: turnMessageId,
|
|
451
|
-
excludeSessionId: continued?.sessionId ?? null,
|
|
452
|
-
limit: CONTEXT_MESSAGE_LIMIT,
|
|
453
|
-
});
|
|
454
|
-
return { threadId, ...page, ...(synced ? {} : { incomplete: true }) };
|
|
455
|
-
}
|
|
456
|
-
catch (error) {
|
|
457
|
-
// Missing context degrades the answer; it must not fail the turn. Marked
|
|
458
|
-
// incomplete so the session's mark stays and the next turn retries.
|
|
459
|
-
this.deps.log('read conversation context failed', { threadId, error: String(error) });
|
|
460
|
-
return { threadId, messages: [], earlier: 0, incomplete: true };
|
|
461
|
-
}
|
|
462
|
-
}
|
|
463
|
-
async resolveResources(message) {
|
|
464
|
-
const resources = [];
|
|
465
|
-
for (const part of message.parts) {
|
|
466
|
-
if (part.type !== 'file')
|
|
467
|
-
continue;
|
|
468
|
-
const dinox = part.providerMetadata?.dinox;
|
|
469
|
-
if (typeof dinox?.resourceId !== 'string')
|
|
470
|
-
continue;
|
|
471
|
-
const resource = await resolveTrustedResource(this.deps.db, {
|
|
472
|
-
resourceId: dinox.resourceId,
|
|
473
|
-
userId: this.deps.userId,
|
|
474
|
-
});
|
|
475
|
-
if (resource)
|
|
476
|
-
resources.push({ uri: resource.url, name: resource.name, mediaType: resource.mediaType });
|
|
477
|
-
}
|
|
478
|
-
return resources;
|
|
479
|
-
}
|
|
480
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import type { AbstractPowerSyncDatabase } from '@powersync/common';
|
|
2
|
-
import { type DeviceHostStatus } from './deviceHost.js';
|
|
3
|
-
import { type GatewayFileSource, type GatewaySentFile } from './types.js';
|
|
4
|
-
type Logger = (message: string, details?: Record<string, unknown>) => void;
|
|
5
|
-
export type GatewayServiceDeps = {
|
|
6
|
-
db: AbstractPowerSyncDatabase;
|
|
7
|
-
userId: string;
|
|
8
|
-
authorization: string;
|
|
9
|
-
log?: Logger;
|
|
10
|
-
credentialsUrl?: string;
|
|
11
|
-
};
|
|
12
|
-
/**
|
|
13
|
-
* Runs every enabled gateway inside the daemon: the daemon owns the PowerSync
|
|
14
|
-
* database, so gateway writes share its connection and upload queue.
|
|
15
|
-
*/
|
|
16
|
-
export declare class GatewayService {
|
|
17
|
-
private readonly deps;
|
|
18
|
-
private readonly definitions;
|
|
19
|
-
private hosts;
|
|
20
|
-
private readonly log;
|
|
21
|
-
private readonly keepAwake;
|
|
22
|
-
constructor(deps: GatewayServiceDeps);
|
|
23
|
-
start(): Promise<void>;
|
|
24
|
-
private reconcile;
|
|
25
|
-
stop(): Promise<void>;
|
|
26
|
-
/** Re-reads the account's gateways (after add/remove) without restarting the daemon. */
|
|
27
|
-
reload(): Promise<DeviceHostStatus[]>;
|
|
28
|
-
/** Saves a change made in the app, applies it to the running gateway and syncs the robot row. */
|
|
29
|
-
private updateSettings;
|
|
30
|
-
private robotRegistration;
|
|
31
|
-
/** Routes a `send_file` from an agent's Dinox tools to the turn of the session that started them. */
|
|
32
|
-
sendFile(token: string, file: GatewayFileSource): Promise<GatewaySentFile>;
|
|
33
|
-
status(): DeviceHostStatus[];
|
|
34
|
-
}
|
|
35
|
-
export {};
|