@dinoxx/dinox-cli 2.18.5 → 2.20.0
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 +17 -17
- 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-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-A6WF7CZL.js +904 -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-DR6BGSZM.js +865 -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-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-N6ALWINB.js +14115 -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-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-QFUD3I7W.js +185 -0
- package/dist/chunks/chunk-QNIYFLJT.js +39 -0
- package/dist/chunks/chunk-QZQRG3JY.js +86 -0
- package/dist/chunks/chunk-RKJYKUQD.js +91 -0
- package/dist/chunks/chunk-TAENC45D.js +160 -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-VNB4ZFLN.js +86 -0
- package/dist/chunks/chunk-W7R5JTSA.js +42 -0
- package/dist/chunks/chunk-WC3GSQBC.js +25699 -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-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-ZGF3OEWR.js +84 -0
- package/dist/chunks/chunk-ZHKS4R4P.js +1215 -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-MLNCD2SD.js +18 -0
- package/dist/chunks/execute-57M65KKK.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-PZBHAYXQ.js +297 -0
- package/dist/chunks/mcpServer-T4DNYR7R.js +436 -0
- package/dist/chunks/metaso-ZVZW5UBB.js +194 -0
- package/dist/chunks/run-GCMWLTIV.js +1464 -0
- package/dist/chunks/runCli-SBQE2VQJ.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 +754 -317
- package/dist/dsh-plugin/lib/index.js +7 -2
- package/dist/dsh-plugin/package.json +1 -1
- package/dist/dsh-plugin/runtime.json +3 -3
- package/dist/editor-ui/mcp-app.html +325 -303
- package/package.json +81 -63
- 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 -710
- 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 -364
- 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 -31
- package/dist/commands/todo/contentModel.js +0 -375
- package/dist/commands/todo/dryRun.d.ts +0 -24
- package/dist/commands/todo/dryRun.js +0 -137
- package/dist/commands/todo/index.d.ts +0 -10
- package/dist/commands/todo/index.js +0 -445
- package/dist/commands/todo/repo.d.ts +0 -136
- package/dist/commands/todo/repo.js +0 -428
- 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 -37
- package/dist/commands/todo/taskModel.js +0 -359
- 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 -32
- package/dist/editor/compat.js +0 -392
- package/dist/editor/daemon.d.ts +0 -10
- package/dist/editor/daemon.js +0 -56
- 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 -222
- 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 -326
- package/dist/editor/service.js +0 -1007
- 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 -237
- 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 -367
- 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/sql-utils.d.ts +0 -5
- package/dist/vendor/electron/sql-utils.js +0 -32
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { type ContentBlock, type McpServer, type SessionConfigOption, type ToolKind } from '@agentclientprotocol/sdk';
|
|
2
|
-
import type { GatewayAdapter, GatewayAdapterInfo, GatewayConfigOption, GatewayDefinition, GatewayFileSource, GatewaySentFile, GatewayTurnInput, GatewayTurnResult } from '../types.js';
|
|
3
|
-
type Logger = (message: string, details?: Record<string, unknown>) => void;
|
|
4
|
-
export declare function withoutTransportNotice(text: string): string;
|
|
5
|
-
/** A file in an agent message (an image, or a resource it attached), as something to send the user. */
|
|
6
|
-
export declare function fileFromContent(content: ContentBlock): GatewayFileSource | null;
|
|
7
|
-
/** Select options only; boolean toggles have no use in the app yet. */
|
|
8
|
-
export declare function normalizeConfigOptions(options: SessionConfigOption[] | null | undefined): GatewayConfigOption[];
|
|
9
|
-
export declare function isReadOnlyToolKind(kind: ToolKind | null | undefined): boolean;
|
|
10
|
-
export declare function mostPermissiveMode(options: GatewayConfigOption[] | undefined): {
|
|
11
|
-
id: string;
|
|
12
|
-
value: string;
|
|
13
|
-
} | null;
|
|
14
|
-
export declare function guardedMode(options: GatewayConfigOption[] | undefined): {
|
|
15
|
-
id: string;
|
|
16
|
-
value: string;
|
|
17
|
-
} | null;
|
|
18
|
-
/**
|
|
19
|
-
* Drives any Agent Client Protocol agent over stdio (`hermes acp`, `openclaw acp`,
|
|
20
|
-
* `claude-code-acp`, `codex-acp`, `pi-acp`, ...). One long-lived process per
|
|
21
|
-
* gateway hosts every thread's session; the agent keeps the conversation, so
|
|
22
|
-
* each turn sends only the new prompt.
|
|
23
|
-
*/
|
|
24
|
-
export declare class AcpGatewayAdapter implements GatewayAdapter {
|
|
25
|
-
/** Live: settings changed from the app (approval, Dinox tools) apply to the next request. */
|
|
26
|
-
private readonly gateway;
|
|
27
|
-
private readonly log;
|
|
28
|
-
/**
|
|
29
|
-
* MCP servers offered to sessions as they are created or loaded, e.g. the
|
|
30
|
-
* Dinox tools; `sessionToken` lets their `send_file` reach this session.
|
|
31
|
-
*/
|
|
32
|
-
private readonly mcpServers;
|
|
33
|
-
readonly kind: "acp";
|
|
34
|
-
private process;
|
|
35
|
-
private starting;
|
|
36
|
-
private readonly turns;
|
|
37
|
-
/** The latest settings any session reported: the agent-wide choices the app lists. */
|
|
38
|
-
private catalog;
|
|
39
|
-
/** Token each session's Dinox tools were started with → that session, for routing `send_file`. */
|
|
40
|
-
private readonly sessionTokens;
|
|
41
|
-
constructor(
|
|
42
|
-
/** Live: settings changed from the app (approval, Dinox tools) apply to the next request. */
|
|
43
|
-
gateway: GatewayDefinition, log?: Logger,
|
|
44
|
-
/**
|
|
45
|
-
* MCP servers offered to sessions as they are created or loaded, e.g. the
|
|
46
|
-
* Dinox tools; `sessionToken` lets their `send_file` reach this session.
|
|
47
|
-
*/
|
|
48
|
-
mcpServers?: (sessionToken: string, cwd: string) => McpServer[]);
|
|
49
|
-
info(): GatewayAdapterInfo;
|
|
50
|
-
runTurn(input: GatewayTurnInput): Promise<GatewayTurnResult>;
|
|
51
|
-
sendFile(token: string, file: GatewayFileSource): Promise<GatewaySentFile> | null;
|
|
52
|
-
private catalogExpiresAt;
|
|
53
|
-
private catalogRevision;
|
|
54
|
-
private probing;
|
|
55
|
-
describeConfig(): Promise<GatewayConfigOption[]>;
|
|
56
|
-
private probeConfig;
|
|
57
|
-
dispose(): Promise<void>;
|
|
58
|
-
/** Codex leaves generated images on disk; send the ones this turn made when it sent nothing itself. */
|
|
59
|
-
private sendGeneratedImages;
|
|
60
|
-
/** Reports a file the agent put in its message to the user, without failing the turn. */
|
|
61
|
-
private sendContentFile;
|
|
62
|
-
/** Continues the session (loading it in `cwd` when this process has not seen it) or starts one there. */
|
|
63
|
-
private resolveSession;
|
|
64
|
-
/**
|
|
65
|
-
* Brings the session to the requested settings before its turn. Entries the
|
|
66
|
-
* agent does not offer are skipped, so a stale choice never fails the run.
|
|
67
|
-
*/
|
|
68
|
-
private applyConfig;
|
|
69
|
-
private rememberConfig;
|
|
70
|
-
private ensureProcess;
|
|
71
|
-
private startProcess;
|
|
72
|
-
private handleSessionUpdate;
|
|
73
|
-
private handlePermission;
|
|
74
|
-
}
|
|
75
|
-
export {};
|
|
@@ -1,431 +0,0 @@
|
|
|
1
|
-
import { spawn } from 'node:child_process';
|
|
2
|
-
import crypto from 'node:crypto';
|
|
3
|
-
import os from 'node:os';
|
|
4
|
-
import { fileURLToPath } from 'node:url';
|
|
5
|
-
import { Readable, Writable } from 'node:stream';
|
|
6
|
-
import { ClientSideConnection, ndJsonStream, PROTOCOL_VERSION, } from '@agentclientprotocol/sdk';
|
|
7
|
-
import { killRecentDescendants } from '../processTree.js';
|
|
8
|
-
import { generateId } from '../../utils/id.js';
|
|
9
|
-
import { getPackageVersion } from '../../utils/version.js';
|
|
10
|
-
import { gatewayApproval } from '../types.js';
|
|
11
|
-
import { codexGeneratedImagesDir, codexImagesSince } from './codexImages.js';
|
|
12
|
-
import { agentLaunch } from '../spawnAgent.js';
|
|
13
|
-
const TOOL_STATUS = {
|
|
14
|
-
pending: 'pending',
|
|
15
|
-
in_progress: 'running',
|
|
16
|
-
completed: 'completed',
|
|
17
|
-
failed: 'failed',
|
|
18
|
-
};
|
|
19
|
-
const STOP_REASON = {
|
|
20
|
-
end_turn: 'end_turn',
|
|
21
|
-
max_tokens: 'max_tokens',
|
|
22
|
-
max_turn_requests: 'max_tokens',
|
|
23
|
-
refusal: 'refusal',
|
|
24
|
-
cancelled: 'cancelled',
|
|
25
|
-
};
|
|
26
|
-
/** Codex reports its transport falling back as message text; it is not part of the answer. */
|
|
27
|
-
const TRANSPORT_NOTICE = /^Warning: Falling back from WebSockets to HTTPS transport\.[^\n]*(\n+|$)/;
|
|
28
|
-
export function withoutTransportNotice(text) {
|
|
29
|
-
return text.replace(TRANSPORT_NOTICE, '');
|
|
30
|
-
}
|
|
31
|
-
/** A file in an agent message (an image, or a resource it attached), as something to send the user. */
|
|
32
|
-
export function fileFromContent(content) {
|
|
33
|
-
switch (content.type) {
|
|
34
|
-
case 'image':
|
|
35
|
-
return content.data ? { kind: 'data', data: content.data, mediaType: content.mimeType } : null;
|
|
36
|
-
case 'resource_link':
|
|
37
|
-
return content.uri.startsWith('file://')
|
|
38
|
-
? { kind: 'path', path: fileURLToPath(content.uri), name: content.name }
|
|
39
|
-
: null;
|
|
40
|
-
case 'resource': {
|
|
41
|
-
const resource = content.resource;
|
|
42
|
-
if (!('blob' in resource))
|
|
43
|
-
return null;
|
|
44
|
-
return { kind: 'data', data: resource.blob, mediaType: resource.mimeType ?? 'application/octet-stream' };
|
|
45
|
-
}
|
|
46
|
-
default:
|
|
47
|
-
return null;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
function toolContentText(content) {
|
|
51
|
-
const text = (content ?? [])
|
|
52
|
-
.map((item) => (item.type === 'content' && item.content.type === 'text' ? item.content.text : ''))
|
|
53
|
-
.filter(Boolean)
|
|
54
|
-
.join('\n');
|
|
55
|
-
return text || undefined;
|
|
56
|
-
}
|
|
57
|
-
/** Select options only; boolean toggles have no use in the app yet. */
|
|
58
|
-
export function normalizeConfigOptions(options) {
|
|
59
|
-
const normalized = [];
|
|
60
|
-
for (const option of options ?? []) {
|
|
61
|
-
if (option.type !== 'select')
|
|
62
|
-
continue;
|
|
63
|
-
const values = [];
|
|
64
|
-
for (const entry of option.options) {
|
|
65
|
-
if ('group' in entry) {
|
|
66
|
-
for (const value of entry.options) {
|
|
67
|
-
values.push({ value: value.value, name: value.name, description: value.description ?? null, group: entry.name });
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
values.push({ value: entry.value, name: entry.name, description: entry.description ?? null, group: null });
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
normalized.push({
|
|
75
|
-
id: option.id,
|
|
76
|
-
name: option.name,
|
|
77
|
-
category: option.category ?? null,
|
|
78
|
-
description: option.description ?? null,
|
|
79
|
-
currentValue: option.currentValue,
|
|
80
|
-
values,
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
return normalized;
|
|
84
|
-
}
|
|
85
|
-
/** Tool kinds that only look at things; `auto_read` lets them run without asking. */
|
|
86
|
-
const READ_ONLY_TOOL_KINDS = new Set(['read', 'search', 'think']);
|
|
87
|
-
export function isReadOnlyToolKind(kind) {
|
|
88
|
-
return kind != null && READ_ONLY_TOOL_KINDS.has(kind);
|
|
89
|
-
}
|
|
90
|
-
/** Agents' "never ask" modes, most permissive first (Codex, Claude Code, Gemini and others). */
|
|
91
|
-
const YOLO_MODE_VALUES = ['agent-full-access', 'bypassPermissions', 'yolo', 'full-access', 'danger-full-access'];
|
|
92
|
-
/** Modes where the agent asks the client before writing or running commands (Codex, Claude Code). */
|
|
93
|
-
const GUARDED_MODE_VALUES = ['read-only', 'default'];
|
|
94
|
-
function pickMode(options, candidates) {
|
|
95
|
-
const mode = options?.find((option) => option.category === 'mode');
|
|
96
|
-
const value = candidates.find((candidate) => mode?.values.some((item) => item.value === candidate));
|
|
97
|
-
return mode && value ? { id: mode.id, value } : null;
|
|
98
|
-
}
|
|
99
|
-
export function mostPermissiveMode(options) {
|
|
100
|
-
return pickMode(options, YOLO_MODE_VALUES);
|
|
101
|
-
}
|
|
102
|
-
export function guardedMode(options) {
|
|
103
|
-
return pickMode(options, GUARDED_MODE_VALUES);
|
|
104
|
-
}
|
|
105
|
-
function pickOption(options, approved) {
|
|
106
|
-
const preferred = approved ? ['allow_once', 'allow_always'] : ['reject_once', 'reject_always'];
|
|
107
|
-
for (const kind of preferred) {
|
|
108
|
-
const option = options.find((item) => item.kind === kind);
|
|
109
|
-
if (option)
|
|
110
|
-
return option;
|
|
111
|
-
}
|
|
112
|
-
return undefined;
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* Drives any Agent Client Protocol agent over stdio (`hermes acp`, `openclaw acp`,
|
|
116
|
-
* `claude-code-acp`, `codex-acp`, `pi-acp`, ...). One long-lived process per
|
|
117
|
-
* gateway hosts every thread's session; the agent keeps the conversation, so
|
|
118
|
-
* each turn sends only the new prompt.
|
|
119
|
-
*/
|
|
120
|
-
export class AcpGatewayAdapter {
|
|
121
|
-
gateway;
|
|
122
|
-
log;
|
|
123
|
-
mcpServers;
|
|
124
|
-
kind = 'acp';
|
|
125
|
-
process = null;
|
|
126
|
-
starting = null;
|
|
127
|
-
turns = new Map();
|
|
128
|
-
/** The latest settings any session reported: the agent-wide choices the app lists. */
|
|
129
|
-
catalog = null;
|
|
130
|
-
/** Token each session's Dinox tools were started with → that session, for routing `send_file`. */
|
|
131
|
-
sessionTokens = new Map();
|
|
132
|
-
constructor(
|
|
133
|
-
/** Live: settings changed from the app (approval, Dinox tools) apply to the next request. */
|
|
134
|
-
gateway, log = () => { },
|
|
135
|
-
/**
|
|
136
|
-
* MCP servers offered to sessions as they are created or loaded, e.g. the
|
|
137
|
-
* Dinox tools; `sessionToken` lets their `send_file` reach this session.
|
|
138
|
-
*/
|
|
139
|
-
mcpServers = () => []) {
|
|
140
|
-
this.gateway = gateway;
|
|
141
|
-
this.log = log;
|
|
142
|
-
this.mcpServers = mcpServers;
|
|
143
|
-
}
|
|
144
|
-
info() {
|
|
145
|
-
const agentInfo = this.process?.init.agentInfo;
|
|
146
|
-
return { kind: this.kind, agentName: agentInfo?.name ?? null, agentVersion: agentInfo?.version ?? null };
|
|
147
|
-
}
|
|
148
|
-
async runTurn(input) {
|
|
149
|
-
const agent = await this.ensureProcess();
|
|
150
|
-
const { sessionId, created } = await this.resolveSession(agent, input.sessionId, input.cwd);
|
|
151
|
-
await this.applyConfig(agent, sessionId, input.config);
|
|
152
|
-
const turn = { onEvent: input.onEvent, awaitApproval: input.awaitApproval, sendFile: input.sendFile, sent: 0 };
|
|
153
|
-
this.turns.set(sessionId, turn);
|
|
154
|
-
const startedAt = Date.now();
|
|
155
|
-
const onAbort = () => {
|
|
156
|
-
void agent.connection.cancel({ sessionId }).catch(() => undefined);
|
|
157
|
-
// The agent's commands outlive the cancel. Only stop them when no other session
|
|
158
|
-
// shares the process, since a command cannot be traced back to its session.
|
|
159
|
-
const pid = agent.child.pid;
|
|
160
|
-
if (pid && this.turns.size === 1) {
|
|
161
|
-
void killRecentDescendants(pid, startedAt).then((pids) => {
|
|
162
|
-
if (pids.length)
|
|
163
|
-
this.log('stopped commands left by a cancelled turn', { sessionId, pids });
|
|
164
|
-
});
|
|
165
|
-
}
|
|
166
|
-
};
|
|
167
|
-
input.signal.addEventListener('abort', onAbort, { once: true });
|
|
168
|
-
try {
|
|
169
|
-
const text = await input.prompt({ created });
|
|
170
|
-
const prompt = [{ type: 'text', text }];
|
|
171
|
-
for (const resource of input.resources) {
|
|
172
|
-
prompt.push({ type: 'resource_link', uri: resource.uri, name: resource.name, mimeType: resource.mediaType ?? null });
|
|
173
|
-
}
|
|
174
|
-
const response = await agent.connection.prompt({ sessionId, prompt });
|
|
175
|
-
if (turn.sent === 0)
|
|
176
|
-
await this.sendGeneratedImages(turn, sessionId, startedAt);
|
|
177
|
-
return { sessionId, stopReason: STOP_REASON[response.stopReason] ?? 'end_turn' };
|
|
178
|
-
}
|
|
179
|
-
catch (error) {
|
|
180
|
-
if (input.signal.aborted)
|
|
181
|
-
return { sessionId, stopReason: 'cancelled' };
|
|
182
|
-
return { sessionId, stopReason: 'error', error: error instanceof Error ? error.message : String(error) };
|
|
183
|
-
}
|
|
184
|
-
finally {
|
|
185
|
-
input.signal.removeEventListener('abort', onAbort);
|
|
186
|
-
this.turns.delete(sessionId);
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
sendFile(token, file) {
|
|
190
|
-
const sessionId = this.sessionTokens.get(token);
|
|
191
|
-
if (!sessionId)
|
|
192
|
-
return null;
|
|
193
|
-
const turn = this.turns.get(sessionId);
|
|
194
|
-
if (!turn)
|
|
195
|
-
return Promise.reject(new Error('Files can only be sent while answering the user'));
|
|
196
|
-
turn.sent += 1;
|
|
197
|
-
return turn.sendFile(file);
|
|
198
|
-
}
|
|
199
|
-
catalogExpiresAt = 0;
|
|
200
|
-
catalogRevision = 0;
|
|
201
|
-
probing = null;
|
|
202
|
-
async describeConfig() {
|
|
203
|
-
if (this.catalog && Date.now() < this.catalogExpiresAt)
|
|
204
|
-
return this.catalog;
|
|
205
|
-
if (!this.probing)
|
|
206
|
-
this.probing = this.probeConfig().finally(() => { this.probing = null; });
|
|
207
|
-
return this.probing;
|
|
208
|
-
}
|
|
209
|
-
async probeConfig() {
|
|
210
|
-
const agent = await this.ensureProcess();
|
|
211
|
-
// No session yet: open one only to read the agent's choices. It never runs a turn,
|
|
212
|
-
// so close it where the agent allows, or it shows up in the user's session list.
|
|
213
|
-
const revision = this.catalogRevision;
|
|
214
|
-
const created = await agent.connection.newSession({ cwd: this.gateway.cwd ?? os.homedir(), mcpServers: [] });
|
|
215
|
-
this.rememberConfig(agent, created.sessionId, created.configOptions, revision === this.catalogRevision);
|
|
216
|
-
if (agent.init.agentCapabilities?.sessionCapabilities?.close) {
|
|
217
|
-
await agent.connection.closeSession({ sessionId: created.sessionId }).catch((error) => this.log('closing the settings session failed', { error: String(error) }));
|
|
218
|
-
}
|
|
219
|
-
return this.catalog ?? [];
|
|
220
|
-
}
|
|
221
|
-
async dispose() {
|
|
222
|
-
const agent = this.process;
|
|
223
|
-
this.process = null;
|
|
224
|
-
this.starting = null;
|
|
225
|
-
if (!agent)
|
|
226
|
-
return;
|
|
227
|
-
agent.child.stdin.end();
|
|
228
|
-
agent.child.kill('SIGTERM');
|
|
229
|
-
this.sessionTokens.clear();
|
|
230
|
-
}
|
|
231
|
-
/** Codex leaves generated images on disk; send the ones this turn made when it sent nothing itself. */
|
|
232
|
-
async sendGeneratedImages(turn, sessionId, startedAt) {
|
|
233
|
-
const dir = codexGeneratedImagesDir(sessionId, { ...process.env, ...(this.gateway.env ?? {}) });
|
|
234
|
-
if (!dir)
|
|
235
|
-
return;
|
|
236
|
-
for (const file of await codexImagesSince(dir, startedAt)) {
|
|
237
|
-
turn.sent += 1;
|
|
238
|
-
await turn.sendFile({ kind: 'path', path: file }).catch((error) => this.log('sending a generated image failed', { error: String(error) }));
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
/** Reports a file the agent put in its message to the user, without failing the turn. */
|
|
242
|
-
sendContentFile(turn, content) {
|
|
243
|
-
const file = fileFromContent(content);
|
|
244
|
-
if (!file)
|
|
245
|
-
return;
|
|
246
|
-
turn.sent += 1;
|
|
247
|
-
void turn.sendFile(file).catch((error) => this.log('sending a file from the agent message failed', { error: String(error) }));
|
|
248
|
-
}
|
|
249
|
-
/** Continues the session (loading it in `cwd` when this process has not seen it) or starts one there. */
|
|
250
|
-
async resolveSession(agent, sessionId, cwd) {
|
|
251
|
-
if (sessionId && agent.liveSessions.has(sessionId))
|
|
252
|
-
return { sessionId, created: false };
|
|
253
|
-
if (sessionId && agent.init.agentCapabilities?.loadSession) {
|
|
254
|
-
try {
|
|
255
|
-
// No turn is registered yet, so the history the agent replays is ignored.
|
|
256
|
-
const token = crypto.randomBytes(18).toString('base64url');
|
|
257
|
-
const loaded = await agent.connection.loadSession({ sessionId, cwd, mcpServers: this.mcpServers(token, cwd) });
|
|
258
|
-
this.sessionTokens.set(token, sessionId);
|
|
259
|
-
agent.liveSessions.add(sessionId);
|
|
260
|
-
this.rememberConfig(agent, sessionId, loaded.configOptions);
|
|
261
|
-
return { sessionId, created: false };
|
|
262
|
-
}
|
|
263
|
-
catch (error) {
|
|
264
|
-
this.log('session/load failed; starting a new session', { sessionId, error: String(error) });
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
const token = crypto.randomBytes(18).toString('base64url');
|
|
268
|
-
const created = await agent.connection.newSession({ cwd, mcpServers: this.mcpServers(token, cwd) });
|
|
269
|
-
this.sessionTokens.set(token, created.sessionId);
|
|
270
|
-
agent.liveSessions.add(created.sessionId);
|
|
271
|
-
this.rememberConfig(agent, created.sessionId, created.configOptions);
|
|
272
|
-
return { sessionId: created.sessionId, created: true };
|
|
273
|
-
}
|
|
274
|
-
/**
|
|
275
|
-
* Brings the session to the requested settings before its turn. Entries the
|
|
276
|
-
* agent does not offer are skipped, so a stale choice never fails the run.
|
|
277
|
-
*/
|
|
278
|
-
async applyConfig(agent, sessionId, config) {
|
|
279
|
-
// YOLO also lifts the agent's own guard: its most permissive mode, whatever the app picked.
|
|
280
|
-
// Otherwise approvals must reach the user, so an agent left on its default (which may let
|
|
281
|
-
// the agent judge its own requests, like Codex's Auto review) is put in a mode that asks.
|
|
282
|
-
const options = agent.sessionConfig.get(sessionId);
|
|
283
|
-
const yolo = gatewayApproval(this.gateway) === 'yolo';
|
|
284
|
-
const forced = yolo ? mostPermissiveMode(options) : guardedMode(options);
|
|
285
|
-
const wanted = forced && (yolo || config?.[forced.id] === undefined)
|
|
286
|
-
? { ...(config ?? {}), [forced.id]: forced.value }
|
|
287
|
-
: (config ?? {});
|
|
288
|
-
for (const [configId, value] of Object.entries(wanted)) {
|
|
289
|
-
const option = agent.sessionConfig.get(sessionId)?.find((item) => item.id === configId);
|
|
290
|
-
if (!option || option.currentValue === value)
|
|
291
|
-
continue;
|
|
292
|
-
if (!option.values.some((item) => item.value === value)) {
|
|
293
|
-
this.log('agent setting not offered; skipped', { configId, value });
|
|
294
|
-
continue;
|
|
295
|
-
}
|
|
296
|
-
try {
|
|
297
|
-
const response = await agent.connection.setSessionConfigOption({ sessionId, configId, value });
|
|
298
|
-
this.rememberConfig(agent, sessionId, response.configOptions);
|
|
299
|
-
}
|
|
300
|
-
catch (error) {
|
|
301
|
-
this.log('agent setting failed; continuing with the current one', { configId, error: String(error) });
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
rememberConfig(agent, sessionId, options, updateCatalog = true) {
|
|
306
|
-
if (!options)
|
|
307
|
-
return;
|
|
308
|
-
const normalized = normalizeConfigOptions(options);
|
|
309
|
-
agent.sessionConfig.set(sessionId, normalized);
|
|
310
|
-
// A slow probe must not overwrite a newer live session update.
|
|
311
|
-
if (updateCatalog) {
|
|
312
|
-
this.catalog = normalized;
|
|
313
|
-
this.catalogExpiresAt = Date.now() + 5 * 60_000;
|
|
314
|
-
this.catalogRevision += 1;
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
ensureProcess() {
|
|
318
|
-
if (this.process)
|
|
319
|
-
return Promise.resolve(this.process);
|
|
320
|
-
this.starting ??= this.startProcess().finally(() => {
|
|
321
|
-
this.starting = null;
|
|
322
|
-
});
|
|
323
|
-
return this.starting;
|
|
324
|
-
}
|
|
325
|
-
async startProcess() {
|
|
326
|
-
const command = this.gateway.command;
|
|
327
|
-
if (!command)
|
|
328
|
-
throw new Error(`Gateway ${this.gateway.name} has no ACP command`);
|
|
329
|
-
const launch = agentLaunch(command, this.gateway.args ?? [], {
|
|
330
|
-
cwd: this.gateway.cwd ?? os.homedir(),
|
|
331
|
-
env: { ...process.env, ...(this.gateway.env ?? {}) },
|
|
332
|
-
stdio: ['pipe', 'pipe', 'pipe'],
|
|
333
|
-
// The daemon runs without a visible console on Windows; keep agents that way.
|
|
334
|
-
windowsHide: true,
|
|
335
|
-
});
|
|
336
|
-
const child = spawn(launch.command, launch.args, launch.options);
|
|
337
|
-
child.stderr.on('data', (chunk) => this.log('agent stderr', { text: chunk.toString('utf8').slice(0, 2000) }));
|
|
338
|
-
const exited = new Promise((_, reject) => {
|
|
339
|
-
child.once('error', reject);
|
|
340
|
-
child.once('exit', (code, signal) => reject(new Error(`agent exited (code ${code}, signal ${signal})`)));
|
|
341
|
-
});
|
|
342
|
-
child.once('exit', () => {
|
|
343
|
-
if (this.process?.child === child) {
|
|
344
|
-
this.process = null;
|
|
345
|
-
this.sessionTokens.clear();
|
|
346
|
-
}
|
|
347
|
-
});
|
|
348
|
-
const stream = ndJsonStream(Writable.toWeb(child.stdin), Readable.toWeb(child.stdout));
|
|
349
|
-
const connection = new ClientSideConnection(() => ({
|
|
350
|
-
sessionUpdate: (params) => this.handleSessionUpdate(params),
|
|
351
|
-
requestPermission: (params) => this.handlePermission(params),
|
|
352
|
-
}), stream);
|
|
353
|
-
const init = await Promise.race([
|
|
354
|
-
connection.initialize({
|
|
355
|
-
protocolVersion: PROTOCOL_VERSION,
|
|
356
|
-
clientCapabilities: { fs: { readTextFile: false, writeTextFile: false }, terminal: false },
|
|
357
|
-
clientInfo: { name: 'dinox-gateway', version: getPackageVersion() },
|
|
358
|
-
}),
|
|
359
|
-
exited,
|
|
360
|
-
]);
|
|
361
|
-
exited.catch(() => undefined);
|
|
362
|
-
const agent = { child, connection, init, liveSessions: new Set(), sessionConfig: new Map() };
|
|
363
|
-
this.process = agent;
|
|
364
|
-
this.log('agent connected', { agent: init.agentInfo?.name ?? command, protocol: init.protocolVersion });
|
|
365
|
-
return agent;
|
|
366
|
-
}
|
|
367
|
-
handleSessionUpdate(params) {
|
|
368
|
-
const update = params.update;
|
|
369
|
-
if (update.sessionUpdate === 'config_option_update' && this.process) {
|
|
370
|
-
this.rememberConfig(this.process, params.sessionId, update.configOptions);
|
|
371
|
-
return;
|
|
372
|
-
}
|
|
373
|
-
const turn = this.turns.get(params.sessionId);
|
|
374
|
-
if (!turn)
|
|
375
|
-
return;
|
|
376
|
-
switch (update.sessionUpdate) {
|
|
377
|
-
case 'agent_message_chunk':
|
|
378
|
-
if (update.content.type === 'text') {
|
|
379
|
-
const text = withoutTransportNotice(update.content.text);
|
|
380
|
-
if (text)
|
|
381
|
-
turn.onEvent({ type: 'text-delta', text });
|
|
382
|
-
}
|
|
383
|
-
else {
|
|
384
|
-
this.sendContentFile(turn, update.content);
|
|
385
|
-
}
|
|
386
|
-
break;
|
|
387
|
-
case 'agent_thought_chunk':
|
|
388
|
-
if (update.content.type === 'text')
|
|
389
|
-
turn.onEvent({ type: 'reasoning-delta', text: update.content.text });
|
|
390
|
-
break;
|
|
391
|
-
case 'tool_call':
|
|
392
|
-
case 'tool_call_update':
|
|
393
|
-
turn.onEvent({
|
|
394
|
-
type: 'tool',
|
|
395
|
-
toolCallId: update.toolCallId,
|
|
396
|
-
...(update.title ? { title: update.title } : {}),
|
|
397
|
-
...(update.status ? { status: TOOL_STATUS[update.status] } : {}),
|
|
398
|
-
...(update.rawInput !== undefined ? { input: update.rawInput } : {}),
|
|
399
|
-
...(update.rawOutput !== undefined || update.content
|
|
400
|
-
? { output: update.rawOutput ?? toolContentText(update.content) }
|
|
401
|
-
: {}),
|
|
402
|
-
});
|
|
403
|
-
break;
|
|
404
|
-
default:
|
|
405
|
-
break;
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
async handlePermission(params) {
|
|
409
|
-
const turn = this.turns.get(params.sessionId);
|
|
410
|
-
if (!turn)
|
|
411
|
-
return { outcome: { outcome: 'cancelled' } };
|
|
412
|
-
const approval = gatewayApproval(this.gateway);
|
|
413
|
-
if (approval === 'yolo' || (approval === 'auto_read' && isReadOnlyToolKind(params.toolCall.kind))) {
|
|
414
|
-
const option = pickOption(params.options, true);
|
|
415
|
-
if (option)
|
|
416
|
-
return { outcome: { outcome: 'selected', optionId: option.optionId } };
|
|
417
|
-
}
|
|
418
|
-
const approvalId = `acp-${generateId()}`;
|
|
419
|
-
turn.onEvent({
|
|
420
|
-
type: 'approval-request',
|
|
421
|
-
approvalId,
|
|
422
|
-
toolCallId: params.toolCall.toolCallId,
|
|
423
|
-
toolName: params.toolCall.title || params.toolCall.name || 'tool',
|
|
424
|
-
input: params.toolCall.rawInput,
|
|
425
|
-
});
|
|
426
|
-
const approved = await turn.awaitApproval(approvalId);
|
|
427
|
-
turn.onEvent({ type: 'approval-resolved', approvalId, approved });
|
|
428
|
-
const option = pickOption(params.options, approved);
|
|
429
|
-
return option ? { outcome: { outcome: 'selected', optionId: option.optionId } } : { outcome: { outcome: 'cancelled' } };
|
|
430
|
-
}
|
|
431
|
-
}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export declare const MAX_FALLBACK_IMAGES = 4;
|
|
2
|
-
export declare function codexGeneratedImagesDir(sessionId: string, env: Record<string, string | undefined>): string | null;
|
|
3
|
-
/** Images written to the session's folder since `sinceMs`, oldest first. */
|
|
4
|
-
export declare function codexImagesSince(dir: string, sinceMs: number): Promise<string[]>;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import fsp from 'node:fs/promises';
|
|
2
|
-
import os from 'node:os';
|
|
3
|
-
import path from 'node:path';
|
|
4
|
-
/**
|
|
5
|
-
* Codex saves the images it generates to `$CODEX_HOME/generated_images/<session>/`
|
|
6
|
-
* and only tells the model where they are, so a turn that produced images but
|
|
7
|
-
* never sent them would leave the user with nothing. The newest ones are sent instead.
|
|
8
|
-
*/
|
|
9
|
-
const IMAGE_EXTENSIONS = new Set(['.png', '.jpg', '.jpeg', '.webp', '.gif']);
|
|
10
|
-
export const MAX_FALLBACK_IMAGES = 4;
|
|
11
|
-
export function codexGeneratedImagesDir(sessionId, env) {
|
|
12
|
-
// The session id names a folder; refuse anything that could leave it.
|
|
13
|
-
if (!/^[A-Za-z0-9_-]{1,128}$/.test(sessionId))
|
|
14
|
-
return null;
|
|
15
|
-
const codexHome = env.CODEX_HOME?.trim() || path.join(os.homedir(), '.codex');
|
|
16
|
-
return path.join(codexHome, 'generated_images', sessionId);
|
|
17
|
-
}
|
|
18
|
-
/** Images written to the session's folder since `sinceMs`, oldest first. */
|
|
19
|
-
export async function codexImagesSince(dir, sinceMs) {
|
|
20
|
-
const entries = await fsp.readdir(dir, { withFileTypes: true }).catch(() => []);
|
|
21
|
-
const images = [];
|
|
22
|
-
for (const entry of entries) {
|
|
23
|
-
if (!entry.isFile() || !IMAGE_EXTENSIONS.has(path.extname(entry.name).toLowerCase()))
|
|
24
|
-
continue;
|
|
25
|
-
const file = path.join(dir, entry.name);
|
|
26
|
-
const stats = await fsp.stat(file).catch(() => null);
|
|
27
|
-
if (stats && stats.mtimeMs >= sinceMs)
|
|
28
|
-
images.push({ file, mtimeMs: stats.mtimeMs });
|
|
29
|
-
}
|
|
30
|
-
return images
|
|
31
|
-
.sort((a, b) => a.mtimeMs - b.mtimeMs)
|
|
32
|
-
.slice(-MAX_FALLBACK_IMAGES)
|
|
33
|
-
.map((image) => image.file);
|
|
34
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { GatewayAdapter, GatewayAdapterInfo, GatewayTurnInput, GatewayTurnResult } from '../types.js';
|
|
2
|
-
/**
|
|
3
|
-
* Loopback agent for end-to-end checks of the gateway path (app ⇄ NATS ⇄ CLI ⇄
|
|
4
|
-
* PowerSync) without a real runtime. Echoes the prompt; a prompt containing
|
|
5
|
-
* `/approve` exercises the tool-approval round trip first.
|
|
6
|
-
*/
|
|
7
|
-
export declare class EchoGatewayAdapter implements GatewayAdapter {
|
|
8
|
-
readonly kind: "echo";
|
|
9
|
-
info(): GatewayAdapterInfo;
|
|
10
|
-
runTurn(input: GatewayTurnInput): Promise<GatewayTurnResult>;
|
|
11
|
-
dispose(): Promise<void>;
|
|
12
|
-
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { generateId } from '../../utils/id.js';
|
|
2
|
-
const CHUNK_DELAY_MS = 40;
|
|
3
|
-
function delay(ms, signal) {
|
|
4
|
-
return new Promise((resolve, reject) => {
|
|
5
|
-
if (signal.aborted)
|
|
6
|
-
return reject(signal.reason);
|
|
7
|
-
const timer = setTimeout(resolve, ms);
|
|
8
|
-
signal.addEventListener('abort', () => {
|
|
9
|
-
clearTimeout(timer);
|
|
10
|
-
reject(signal.reason);
|
|
11
|
-
}, { once: true });
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Loopback agent for end-to-end checks of the gateway path (app ⇄ NATS ⇄ CLI ⇄
|
|
16
|
-
* PowerSync) without a real runtime. Echoes the prompt; a prompt containing
|
|
17
|
-
* `/approve` exercises the tool-approval round trip first.
|
|
18
|
-
*/
|
|
19
|
-
export class EchoGatewayAdapter {
|
|
20
|
-
kind = 'echo';
|
|
21
|
-
info() {
|
|
22
|
-
return { kind: this.kind, agentName: 'echo', agentVersion: null };
|
|
23
|
-
}
|
|
24
|
-
async runTurn(input) {
|
|
25
|
-
const sessionId = input.sessionId ?? `echo-${generateId()}`;
|
|
26
|
-
try {
|
|
27
|
-
const text = await input.prompt({ created: input.sessionId === null });
|
|
28
|
-
// Echo the user text while exercising the full prompt factory.
|
|
29
|
-
const prompt = text.replace(/<dinox_(delivery|knowledge|agent_instructions)>[\s\S]*?<\/dinox_\1>\n\n/g, '');
|
|
30
|
-
if (prompt.includes('/approve')) {
|
|
31
|
-
const toolCallId = `tool-${generateId()}`;
|
|
32
|
-
const approvalId = `approval-${generateId()}`;
|
|
33
|
-
input.onEvent({ type: 'tool', toolCallId, title: 'echo.write', status: 'pending', input: { text: prompt } });
|
|
34
|
-
input.onEvent({ type: 'approval-request', approvalId, toolCallId, toolName: 'echo.write', input: { text: prompt } });
|
|
35
|
-
const approved = await input.awaitApproval(approvalId);
|
|
36
|
-
input.onEvent({ type: 'approval-resolved', approvalId, approved });
|
|
37
|
-
input.onEvent(approved
|
|
38
|
-
? { type: 'tool', toolCallId, status: 'completed', output: 'approved' }
|
|
39
|
-
: { type: 'tool', toolCallId, status: 'failed', output: 'denied by user' });
|
|
40
|
-
}
|
|
41
|
-
for (const word of `Echo: ${prompt}`.split(/(\s+)/)) {
|
|
42
|
-
await delay(CHUNK_DELAY_MS, input.signal);
|
|
43
|
-
input.onEvent({ type: 'text-delta', text: word });
|
|
44
|
-
}
|
|
45
|
-
return { sessionId, stopReason: 'end_turn' };
|
|
46
|
-
}
|
|
47
|
-
catch (error) {
|
|
48
|
-
if (input.signal.aborted)
|
|
49
|
-
return { sessionId, stopReason: 'cancelled' };
|
|
50
|
-
throw error;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
async dispose() { }
|
|
54
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { McpServer } from '@agentclientprotocol/sdk';
|
|
2
|
-
import type { GatewayAdapter, GatewayDefinition } from '../types.js';
|
|
3
|
-
/**
|
|
4
|
-
* The Dinox tools as a stdio MCP server: this same CLI, run as
|
|
5
|
-
* `dino gateway mcp`, reading through the daemon. DINOX_* variables are passed
|
|
6
|
-
* on so the child finds the same config, data dir and daemon socket.
|
|
7
|
-
*/
|
|
8
|
-
export declare function dinoxMcpServerConfig(options: {
|
|
9
|
-
sessionToken: string;
|
|
10
|
-
knowledgeTools: boolean;
|
|
11
|
-
cwd?: string;
|
|
12
|
-
}): McpServer | null;
|
|
13
|
-
export declare function createGatewayAdapter(gateway: GatewayDefinition, log: (message: string, details?: Record<string, unknown>) => void): GatewayAdapter;
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { DINOX_MCP_SERVER_NAME, GATEWAY_SESSION_CWD_ENV, GATEWAY_KNOWLEDGE_TOOLS_ENV, GATEWAY_SESSION_TOKEN_ENV } from '../mcpEnv.js';
|
|
2
|
-
import { AcpGatewayAdapter } from './acp.js';
|
|
3
|
-
import { EchoGatewayAdapter } from './echo.js';
|
|
4
|
-
/**
|
|
5
|
-
* The Dinox tools as a stdio MCP server: this same CLI, run as
|
|
6
|
-
* `dino gateway mcp`, reading through the daemon. DINOX_* variables are passed
|
|
7
|
-
* on so the child finds the same config, data dir and daemon socket.
|
|
8
|
-
*/
|
|
9
|
-
export function dinoxMcpServerConfig(options) {
|
|
10
|
-
const entrypoint = process.argv[1];
|
|
11
|
-
if (!entrypoint)
|
|
12
|
-
return null;
|
|
13
|
-
const inherited = Object.entries(process.env).filter((entry) => entry[0].startsWith('DINOX_') &&
|
|
14
|
-
entry[0] !== GATEWAY_SESSION_TOKEN_ENV &&
|
|
15
|
-
entry[0] !== GATEWAY_SESSION_CWD_ENV &&
|
|
16
|
-
entry[0] !== GATEWAY_KNOWLEDGE_TOOLS_ENV &&
|
|
17
|
-
typeof entry[1] === 'string');
|
|
18
|
-
return {
|
|
19
|
-
name: DINOX_MCP_SERVER_NAME,
|
|
20
|
-
command: process.execPath,
|
|
21
|
-
args: [...process.execArgv, entrypoint, 'gateway', 'mcp'],
|
|
22
|
-
env: [
|
|
23
|
-
...inherited,
|
|
24
|
-
[GATEWAY_SESSION_CWD_ENV, options.cwd ?? process.cwd()],
|
|
25
|
-
[GATEWAY_SESSION_TOKEN_ENV, options.sessionToken],
|
|
26
|
-
[GATEWAY_KNOWLEDGE_TOOLS_ENV, options.knowledgeTools ? '1' : '0'],
|
|
27
|
-
].map(([name, value]) => ({ name, value })),
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
export function createGatewayAdapter(gateway, log) {
|
|
31
|
-
switch (gateway.kind) {
|
|
32
|
-
case 'acp':
|
|
33
|
-
// Read per session, so turning the knowledge tools off applies to the next new conversation.
|
|
34
|
-
// `send_file` stays offered either way: it is how the agent hands the user a file.
|
|
35
|
-
return new AcpGatewayAdapter(gateway, log, (sessionToken, cwd) => {
|
|
36
|
-
const tools = dinoxMcpServerConfig({ sessionToken, cwd, knowledgeTools: gateway.dinoxTools !== false });
|
|
37
|
-
return tools ? [tools] : [];
|
|
38
|
-
});
|
|
39
|
-
case 'echo':
|
|
40
|
-
return new EchoGatewayAdapter();
|
|
41
|
-
}
|
|
42
|
-
}
|