@swarmify/agents-cli 1.13.3 → 1.14.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/README.md +2 -319
- package/bin/agents.js +2 -0
- package/package.json +13 -79
- package/scripts/postinstall.js +4 -71
- package/CHANGELOG.md +0 -316
- package/LICENSE +0 -21
- package/dist/commands/__tests__/sessions-tail.test.d.ts +0 -2
- package/dist/commands/__tests__/sessions-tail.test.d.ts.map +0 -1
- package/dist/commands/__tests__/sessions-tail.test.js +0 -108
- package/dist/commands/__tests__/sessions-tail.test.js.map +0 -1
- package/dist/commands/__tests__/sessions.test.d.ts +0 -2
- package/dist/commands/__tests__/sessions.test.d.ts.map +0 -1
- package/dist/commands/__tests__/sessions.test.js +0 -636
- package/dist/commands/__tests__/sessions.test.js.map +0 -1
- package/dist/commands/cloud.d.ts +0 -11
- package/dist/commands/cloud.d.ts.map +0 -1
- package/dist/commands/cloud.js +0 -363
- package/dist/commands/cloud.js.map +0 -1
- package/dist/commands/commands.d.ts +0 -12
- package/dist/commands/commands.d.ts.map +0 -1
- package/dist/commands/commands.js +0 -629
- package/dist/commands/commands.js.map +0 -1
- package/dist/commands/daemon.d.ts +0 -11
- package/dist/commands/daemon.d.ts.map +0 -1
- package/dist/commands/daemon.js +0 -119
- package/dist/commands/daemon.js.map +0 -1
- package/dist/commands/drive.d.ts +0 -11
- package/dist/commands/drive.d.ts.map +0 -1
- package/dist/commands/drive.js +0 -175
- package/dist/commands/drive.js.map +0 -1
- package/dist/commands/exec.d.ts +0 -11
- package/dist/commands/exec.d.ts.map +0 -1
- package/dist/commands/exec.js +0 -251
- package/dist/commands/exec.js.map +0 -1
- package/dist/commands/factory.d.ts +0 -11
- package/dist/commands/factory.d.ts.map +0 -1
- package/dist/commands/factory.js +0 -445
- package/dist/commands/factory.js.map +0 -1
- package/dist/commands/fork.d.ts +0 -11
- package/dist/commands/fork.d.ts.map +0 -1
- package/dist/commands/fork.js +0 -147
- package/dist/commands/fork.js.map +0 -1
- package/dist/commands/hooks.d.ts +0 -12
- package/dist/commands/hooks.d.ts.map +0 -1
- package/dist/commands/hooks.js +0 -690
- package/dist/commands/hooks.js.map +0 -1
- package/dist/commands/init.d.ts +0 -15
- package/dist/commands/init.d.ts.map +0 -1
- package/dist/commands/init.js +0 -137
- package/dist/commands/init.js.map +0 -1
- package/dist/commands/mcp.d.ts +0 -12
- package/dist/commands/mcp.d.ts.map +0 -1
- package/dist/commands/mcp.js +0 -583
- package/dist/commands/mcp.js.map +0 -1
- package/dist/commands/models.d.ts +0 -11
- package/dist/commands/models.d.ts.map +0 -1
- package/dist/commands/models.js +0 -170
- package/dist/commands/models.js.map +0 -1
- package/dist/commands/packages.d.ts +0 -11
- package/dist/commands/packages.d.ts.map +0 -1
- package/dist/commands/packages.js +0 -551
- package/dist/commands/packages.js.map +0 -1
- package/dist/commands/permissions.d.ts +0 -12
- package/dist/commands/permissions.d.ts.map +0 -1
- package/dist/commands/permissions.js +0 -724
- package/dist/commands/permissions.js.map +0 -1
- package/dist/commands/plugins.d.ts +0 -11
- package/dist/commands/plugins.d.ts.map +0 -1
- package/dist/commands/plugins.js +0 -393
- package/dist/commands/plugins.js.map +0 -1
- package/dist/commands/profiles.d.ts +0 -12
- package/dist/commands/profiles.d.ts.map +0 -1
- package/dist/commands/profiles.js +0 -255
- package/dist/commands/profiles.js.map +0 -1
- package/dist/commands/pty.d.ts +0 -21
- package/dist/commands/pty.d.ts.map +0 -1
- package/dist/commands/pty.js +0 -391
- package/dist/commands/pty.js.map +0 -1
- package/dist/commands/pull.d.ts +0 -11
- package/dist/commands/pull.d.ts.map +0 -1
- package/dist/commands/pull.js +0 -456
- package/dist/commands/pull.js.map +0 -1
- package/dist/commands/push.d.ts +0 -11
- package/dist/commands/push.d.ts.map +0 -1
- package/dist/commands/push.js +0 -188
- package/dist/commands/push.js.map +0 -1
- package/dist/commands/refresh-memory.d.ts +0 -16
- package/dist/commands/refresh-memory.d.ts.map +0 -1
- package/dist/commands/refresh-memory.js +0 -52
- package/dist/commands/refresh-memory.js.map +0 -1
- package/dist/commands/resource-view.d.ts +0 -39
- package/dist/commands/resource-view.d.ts.map +0 -1
- package/dist/commands/resource-view.js +0 -197
- package/dist/commands/resource-view.js.map +0 -1
- package/dist/commands/routines.d.ts +0 -11
- package/dist/commands/routines.d.ts.map +0 -1
- package/dist/commands/routines.js +0 -590
- package/dist/commands/routines.js.map +0 -1
- package/dist/commands/rules.d.ts +0 -12
- package/dist/commands/rules.d.ts.map +0 -1
- package/dist/commands/rules.js +0 -489
- package/dist/commands/rules.js.map +0 -1
- package/dist/commands/secrets.d.ts +0 -11
- package/dist/commands/secrets.d.ts.map +0 -1
- package/dist/commands/secrets.js +0 -352
- package/dist/commands/secrets.js.map +0 -1
- package/dist/commands/sessions-picker.d.ts +0 -18
- package/dist/commands/sessions-picker.d.ts.map +0 -1
- package/dist/commands/sessions-picker.js +0 -265
- package/dist/commands/sessions-picker.js.map +0 -1
- package/dist/commands/sessions-tail.d.ts +0 -20
- package/dist/commands/sessions-tail.d.ts.map +0 -1
- package/dist/commands/sessions-tail.js +0 -236
- package/dist/commands/sessions-tail.js.map +0 -1
- package/dist/commands/sessions.d.ts +0 -18
- package/dist/commands/sessions.d.ts.map +0 -1
- package/dist/commands/sessions.js +0 -1173
- package/dist/commands/sessions.js.map +0 -1
- package/dist/commands/skills.d.ts +0 -12
- package/dist/commands/skills.d.ts.map +0 -1
- package/dist/commands/skills.js +0 -717
- package/dist/commands/skills.js.map +0 -1
- package/dist/commands/status.d.ts +0 -10
- package/dist/commands/status.d.ts.map +0 -1
- package/dist/commands/status.js +0 -26
- package/dist/commands/status.js.map +0 -1
- package/dist/commands/subagents.d.ts +0 -11
- package/dist/commands/subagents.d.ts.map +0 -1
- package/dist/commands/subagents.js +0 -361
- package/dist/commands/subagents.js.map +0 -1
- package/dist/commands/sync.d.ts +0 -11
- package/dist/commands/sync.d.ts.map +0 -1
- package/dist/commands/sync.js +0 -70
- package/dist/commands/sync.js.map +0 -1
- package/dist/commands/teams-picker.d.ts +0 -18
- package/dist/commands/teams-picker.d.ts.map +0 -1
- package/dist/commands/teams-picker.js +0 -290
- package/dist/commands/teams-picker.js.map +0 -1
- package/dist/commands/teams.d.ts +0 -18
- package/dist/commands/teams.d.ts.map +0 -1
- package/dist/commands/teams.js +0 -1144
- package/dist/commands/teams.js.map +0 -1
- package/dist/commands/utils.d.ts +0 -45
- package/dist/commands/utils.d.ts.map +0 -1
- package/dist/commands/utils.js +0 -106
- package/dist/commands/utils.js.map +0 -1
- package/dist/commands/versions.d.ts +0 -11
- package/dist/commands/versions.d.ts.map +0 -1
- package/dist/commands/versions.js +0 -701
- package/dist/commands/versions.js.map +0 -1
- package/dist/commands/view.d.ts +0 -43
- package/dist/commands/view.d.ts.map +0 -1
- package/dist/commands/view.js +0 -894
- package/dist/commands/view.js.map +0 -1
- package/dist/index.d.ts +0 -9
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -496
- package/dist/index.js.map +0 -1
- package/dist/lib/__tests__/bugfixes.test.d.ts +0 -2
- package/dist/lib/__tests__/bugfixes.test.d.ts.map +0 -1
- package/dist/lib/__tests__/bugfixes.test.js +0 -192
- package/dist/lib/__tests__/bugfixes.test.js.map +0 -1
- package/dist/lib/__tests__/exec.test.d.ts +0 -2
- package/dist/lib/__tests__/exec.test.d.ts.map +0 -1
- package/dist/lib/__tests__/exec.test.js +0 -446
- package/dist/lib/__tests__/exec.test.js.map +0 -1
- package/dist/lib/__tests__/git-sync.test.d.ts +0 -2
- package/dist/lib/__tests__/git-sync.test.d.ts.map +0 -1
- package/dist/lib/__tests__/git-sync.test.js +0 -138
- package/dist/lib/__tests__/git-sync.test.js.map +0 -1
- package/dist/lib/__tests__/hooks.test.d.ts +0 -2
- package/dist/lib/__tests__/hooks.test.d.ts.map +0 -1
- package/dist/lib/__tests__/hooks.test.js +0 -203
- package/dist/lib/__tests__/hooks.test.js.map +0 -1
- package/dist/lib/__tests__/memory-compile.test.d.ts +0 -2
- package/dist/lib/__tests__/memory-compile.test.d.ts.map +0 -1
- package/dist/lib/__tests__/memory-compile.test.js +0 -95
- package/dist/lib/__tests__/memory-compile.test.js.map +0 -1
- package/dist/lib/__tests__/models.test.d.ts +0 -2
- package/dist/lib/__tests__/models.test.d.ts.map +0 -1
- package/dist/lib/__tests__/models.test.js +0 -239
- package/dist/lib/__tests__/models.test.js.map +0 -1
- package/dist/lib/__tests__/rotate.test.d.ts +0 -2
- package/dist/lib/__tests__/rotate.test.d.ts.map +0 -1
- package/dist/lib/__tests__/rotate.test.js +0 -80
- package/dist/lib/__tests__/rotate.test.js.map +0 -1
- package/dist/lib/__tests__/secrets-bundles.test.d.ts +0 -2
- package/dist/lib/__tests__/secrets-bundles.test.d.ts.map +0 -1
- package/dist/lib/__tests__/secrets-bundles.test.js +0 -104
- package/dist/lib/__tests__/secrets-bundles.test.js.map +0 -1
- package/dist/lib/__tests__/secrets.test.d.ts +0 -2
- package/dist/lib/__tests__/secrets.test.d.ts.map +0 -1
- package/dist/lib/__tests__/secrets.test.js +0 -90
- package/dist/lib/__tests__/secrets.test.js.map +0 -1
- package/dist/lib/__tests__/shims.test.d.ts +0 -2
- package/dist/lib/__tests__/shims.test.d.ts.map +0 -1
- package/dist/lib/__tests__/shims.test.js +0 -57
- package/dist/lib/__tests__/shims.test.js.map +0 -1
- package/dist/lib/__tests__/usage.test.d.ts +0 -2
- package/dist/lib/__tests__/usage.test.d.ts.map +0 -1
- package/dist/lib/__tests__/usage.test.js +0 -220
- package/dist/lib/__tests__/usage.test.js.map +0 -1
- package/dist/lib/__tests__/versions.test.d.ts +0 -2
- package/dist/lib/__tests__/versions.test.d.ts.map +0 -1
- package/dist/lib/__tests__/versions.test.js +0 -63
- package/dist/lib/__tests__/versions.test.js.map +0 -1
- package/dist/lib/agents.d.ts +0 -158
- package/dist/lib/agents.d.ts.map +0 -1
- package/dist/lib/agents.js +0 -1159
- package/dist/lib/agents.js.map +0 -1
- package/dist/lib/artifact-actions.d.ts +0 -27
- package/dist/lib/artifact-actions.d.ts.map +0 -1
- package/dist/lib/artifact-actions.js +0 -58
- package/dist/lib/artifact-actions.js.map +0 -1
- package/dist/lib/cloud/codex.d.ts +0 -26
- package/dist/lib/cloud/codex.d.ts.map +0 -1
- package/dist/lib/cloud/codex.js +0 -237
- package/dist/lib/cloud/codex.js.map +0 -1
- package/dist/lib/cloud/factory.d.ts +0 -32
- package/dist/lib/cloud/factory.d.ts.map +0 -1
- package/dist/lib/cloud/factory.js +0 -43
- package/dist/lib/cloud/factory.js.map +0 -1
- package/dist/lib/cloud/registry.d.ts +0 -16
- package/dist/lib/cloud/registry.d.ts.map +0 -1
- package/dist/lib/cloud/registry.js +0 -68
- package/dist/lib/cloud/registry.js.map +0 -1
- package/dist/lib/cloud/rush.d.ts +0 -37
- package/dist/lib/cloud/rush.d.ts.map +0 -1
- package/dist/lib/cloud/rush.js +0 -230
- package/dist/lib/cloud/rush.js.map +0 -1
- package/dist/lib/cloud/rush.test.d.ts +0 -2
- package/dist/lib/cloud/rush.test.d.ts.map +0 -1
- package/dist/lib/cloud/rush.test.js +0 -63
- package/dist/lib/cloud/rush.test.js.map +0 -1
- package/dist/lib/cloud/store.d.ts +0 -23
- package/dist/lib/cloud/store.d.ts.map +0 -1
- package/dist/lib/cloud/store.js +0 -116
- package/dist/lib/cloud/store.js.map +0 -1
- package/dist/lib/cloud/stream.d.ts +0 -24
- package/dist/lib/cloud/stream.d.ts.map +0 -1
- package/dist/lib/cloud/stream.js +0 -145
- package/dist/lib/cloud/stream.js.map +0 -1
- package/dist/lib/cloud/types.d.ts +0 -109
- package/dist/lib/cloud/types.d.ts.map +0 -1
- package/dist/lib/cloud/types.js +0 -33
- package/dist/lib/cloud/types.js.map +0 -1
- package/dist/lib/cloud/types.test.d.ts +0 -2
- package/dist/lib/cloud/types.test.d.ts.map +0 -1
- package/dist/lib/cloud/types.test.js +0 -41
- package/dist/lib/cloud/types.test.js.map +0 -1
- package/dist/lib/commands.d.ts +0 -141
- package/dist/lib/commands.d.ts.map +0 -1
- package/dist/lib/commands.js +0 -514
- package/dist/lib/commands.js.map +0 -1
- package/dist/lib/convert.d.ts +0 -21
- package/dist/lib/convert.d.ts.map +0 -1
- package/dist/lib/convert.js +0 -54
- package/dist/lib/convert.js.map +0 -1
- package/dist/lib/daemon.d.ts +0 -43
- package/dist/lib/daemon.d.ts.map +0 -1
- package/dist/lib/daemon.js +0 -332
- package/dist/lib/daemon.js.map +0 -1
- package/dist/lib/drive-sync.d.ts +0 -46
- package/dist/lib/drive-sync.d.ts.map +0 -1
- package/dist/lib/drive-sync.js +0 -209
- package/dist/lib/drive-sync.js.map +0 -1
- package/dist/lib/exec.d.ts +0 -101
- package/dist/lib/exec.d.ts.map +0 -1
- package/dist/lib/exec.js +0 -450
- package/dist/lib/exec.js.map +0 -1
- package/dist/lib/factory/__tests__/config.test.d.ts +0 -2
- package/dist/lib/factory/__tests__/config.test.d.ts.map +0 -1
- package/dist/lib/factory/__tests__/config.test.js +0 -128
- package/dist/lib/factory/__tests__/config.test.js.map +0 -1
- package/dist/lib/factory/config.d.ts +0 -49
- package/dist/lib/factory/config.d.ts.map +0 -1
- package/dist/lib/factory/config.js +0 -127
- package/dist/lib/factory/config.js.map +0 -1
- package/dist/lib/factory.d.ts +0 -57
- package/dist/lib/factory.d.ts.map +0 -1
- package/dist/lib/factory.js +0 -107
- package/dist/lib/factory.js.map +0 -1
- package/dist/lib/git.d.ts +0 -157
- package/dist/lib/git.d.ts.map +0 -1
- package/dist/lib/git.js +0 -647
- package/dist/lib/git.js.map +0 -1
- package/dist/lib/help.d.ts +0 -10
- package/dist/lib/help.d.ts.map +0 -1
- package/dist/lib/help.js +0 -66
- package/dist/lib/help.js.map +0 -1
- package/dist/lib/hooks.d.ts +0 -125
- package/dist/lib/hooks.d.ts.map +0 -1
- package/dist/lib/hooks.js +0 -846
- package/dist/lib/hooks.js.map +0 -1
- package/dist/lib/ledger/__tests__/local.test.d.ts +0 -2
- package/dist/lib/ledger/__tests__/local.test.d.ts.map +0 -1
- package/dist/lib/ledger/__tests__/local.test.js +0 -177
- package/dist/lib/ledger/__tests__/local.test.js.map +0 -1
- package/dist/lib/ledger/__tests__/sync.test.d.ts +0 -2
- package/dist/lib/ledger/__tests__/sync.test.d.ts.map +0 -1
- package/dist/lib/ledger/__tests__/sync.test.js +0 -117
- package/dist/lib/ledger/__tests__/sync.test.js.map +0 -1
- package/dist/lib/ledger/index.d.ts +0 -18
- package/dist/lib/ledger/index.d.ts.map +0 -1
- package/dist/lib/ledger/index.js +0 -32
- package/dist/lib/ledger/index.js.map +0 -1
- package/dist/lib/ledger/local.d.ts +0 -22
- package/dist/lib/ledger/local.d.ts.map +0 -1
- package/dist/lib/ledger/local.js +0 -333
- package/dist/lib/ledger/local.js.map +0 -1
- package/dist/lib/ledger/r2.d.ts +0 -41
- package/dist/lib/ledger/r2.d.ts.map +0 -1
- package/dist/lib/ledger/r2.js +0 -335
- package/dist/lib/ledger/r2.js.map +0 -1
- package/dist/lib/ledger/sync.d.ts +0 -33
- package/dist/lib/ledger/sync.d.ts.map +0 -1
- package/dist/lib/ledger/sync.js +0 -106
- package/dist/lib/ledger/sync.js.map +0 -1
- package/dist/lib/ledger/types.d.ts +0 -100
- package/dist/lib/ledger/types.d.ts.map +0 -1
- package/dist/lib/ledger/types.js +0 -21
- package/dist/lib/ledger/types.js.map +0 -1
- package/dist/lib/manifest.d.ts +0 -14
- package/dist/lib/manifest.d.ts.map +0 -1
- package/dist/lib/manifest.js +0 -48
- package/dist/lib/manifest.js.map +0 -1
- package/dist/lib/markdown.d.ts +0 -5
- package/dist/lib/markdown.d.ts.map +0 -1
- package/dist/lib/markdown.js +0 -17
- package/dist/lib/markdown.js.map +0 -1
- package/dist/lib/mcp.d.ts +0 -64
- package/dist/lib/mcp.d.ts.map +0 -1
- package/dist/lib/mcp.js +0 -327
- package/dist/lib/mcp.js.map +0 -1
- package/dist/lib/memory-compile.d.ts +0 -65
- package/dist/lib/memory-compile.d.ts.map +0 -1
- package/dist/lib/memory-compile.js +0 -174
- package/dist/lib/memory-compile.js.map +0 -1
- package/dist/lib/memory.d.ts +0 -64
- package/dist/lib/memory.d.ts.map +0 -1
- package/dist/lib/memory.js +0 -275
- package/dist/lib/memory.js.map +0 -1
- package/dist/lib/models.d.ts +0 -98
- package/dist/lib/models.d.ts.map +0 -1
- package/dist/lib/models.js +0 -728
- package/dist/lib/models.js.map +0 -1
- package/dist/lib/permissions.d.ts +0 -227
- package/dist/lib/permissions.d.ts.map +0 -1
- package/dist/lib/permissions.js +0 -1071
- package/dist/lib/permissions.js.map +0 -1
- package/dist/lib/picker.d.ts +0 -27
- package/dist/lib/picker.d.ts.map +0 -1
- package/dist/lib/picker.js +0 -110
- package/dist/lib/picker.js.map +0 -1
- package/dist/lib/plugins.d.ts +0 -80
- package/dist/lib/plugins.d.ts.map +0 -1
- package/dist/lib/plugins.js +0 -556
- package/dist/lib/plugins.js.map +0 -1
- package/dist/lib/profiles-keychain.d.ts +0 -11
- package/dist/lib/profiles-keychain.d.ts.map +0 -1
- package/dist/lib/profiles-keychain.js +0 -14
- package/dist/lib/profiles-keychain.js.map +0 -1
- package/dist/lib/profiles-presets.d.ts +0 -25
- package/dist/lib/profiles-presets.d.ts.map +0 -1
- package/dist/lib/profiles-presets.js +0 -104
- package/dist/lib/profiles-presets.js.map +0 -1
- package/dist/lib/profiles.d.ts +0 -70
- package/dist/lib/profiles.d.ts.map +0 -1
- package/dist/lib/profiles.js +0 -145
- package/dist/lib/profiles.js.map +0 -1
- package/dist/lib/pty-client.d.ts +0 -23
- package/dist/lib/pty-client.d.ts.map +0 -1
- package/dist/lib/pty-client.js +0 -181
- package/dist/lib/pty-client.js.map +0 -1
- package/dist/lib/pty-server.d.ts +0 -21
- package/dist/lib/pty-server.d.ts.map +0 -1
- package/dist/lib/pty-server.js +0 -427
- package/dist/lib/pty-server.js.map +0 -1
- package/dist/lib/registry.d.ts +0 -45
- package/dist/lib/registry.d.ts.map +0 -1
- package/dist/lib/registry.js +0 -220
- package/dist/lib/registry.js.map +0 -1
- package/dist/lib/resources.d.ts +0 -55
- package/dist/lib/resources.d.ts.map +0 -1
- package/dist/lib/resources.js +0 -103
- package/dist/lib/resources.js.map +0 -1
- package/dist/lib/rotate.d.ts +0 -58
- package/dist/lib/rotate.d.ts.map +0 -1
- package/dist/lib/rotate.js +0 -93
- package/dist/lib/rotate.js.map +0 -1
- package/dist/lib/routines.d.ts +0 -99
- package/dist/lib/routines.d.ts.map +0 -1
- package/dist/lib/routines.js +0 -352
- package/dist/lib/routines.js.map +0 -1
- package/dist/lib/runner.d.ts +0 -26
- package/dist/lib/runner.d.ts.map +0 -1
- package/dist/lib/runner.js +0 -325
- package/dist/lib/runner.js.map +0 -1
- package/dist/lib/sandbox.d.ts +0 -26
- package/dist/lib/sandbox.d.ts.map +0 -1
- package/dist/lib/sandbox.js +0 -218
- package/dist/lib/sandbox.js.map +0 -1
- package/dist/lib/scheduler.d.ts +0 -26
- package/dist/lib/scheduler.d.ts.map +0 -1
- package/dist/lib/scheduler.js +0 -77
- package/dist/lib/scheduler.js.map +0 -1
- package/dist/lib/secrets-bundles.d.ts +0 -38
- package/dist/lib/secrets-bundles.d.ts.map +0 -1
- package/dist/lib/secrets-bundles.js +0 -176
- package/dist/lib/secrets-bundles.js.map +0 -1
- package/dist/lib/secrets.d.ts +0 -53
- package/dist/lib/secrets.d.ts.map +0 -1
- package/dist/lib/secrets.js +0 -140
- package/dist/lib/secrets.js.map +0 -1
- package/dist/lib/session/__tests__/db.test.d.ts +0 -2
- package/dist/lib/session/__tests__/db.test.d.ts.map +0 -1
- package/dist/lib/session/__tests__/db.test.js +0 -54
- package/dist/lib/session/__tests__/db.test.js.map +0 -1
- package/dist/lib/session/__tests__/discover.test.d.ts +0 -2
- package/dist/lib/session/__tests__/discover.test.d.ts.map +0 -1
- package/dist/lib/session/__tests__/discover.test.js +0 -63
- package/dist/lib/session/__tests__/discover.test.js.map +0 -1
- package/dist/lib/session/__tests__/prompt.test.d.ts +0 -2
- package/dist/lib/session/__tests__/prompt.test.d.ts.map +0 -1
- package/dist/lib/session/__tests__/prompt.test.js +0 -44
- package/dist/lib/session/__tests__/prompt.test.js.map +0 -1
- package/dist/lib/session/__tests__/render.test.d.ts +0 -2
- package/dist/lib/session/__tests__/render.test.d.ts.map +0 -1
- package/dist/lib/session/__tests__/render.test.js +0 -602
- package/dist/lib/session/__tests__/render.test.js.map +0 -1
- package/dist/lib/session/active.d.ts +0 -44
- package/dist/lib/session/active.d.ts.map +0 -1
- package/dist/lib/session/active.js +0 -379
- package/dist/lib/session/active.js.map +0 -1
- package/dist/lib/session/artifacts.d.ts +0 -15
- package/dist/lib/session/artifacts.d.ts.map +0 -1
- package/dist/lib/session/artifacts.js +0 -86
- package/dist/lib/session/artifacts.js.map +0 -1
- package/dist/lib/session/db.d.ts +0 -140
- package/dist/lib/session/db.d.ts.map +0 -1
- package/dist/lib/session/db.js +0 -599
- package/dist/lib/session/db.js.map +0 -1
- package/dist/lib/session/discover.d.ts +0 -72
- package/dist/lib/session/discover.d.ts.map +0 -1
- package/dist/lib/session/discover.js +0 -1315
- package/dist/lib/session/discover.js.map +0 -1
- package/dist/lib/session/parse.d.ts +0 -34
- package/dist/lib/session/parse.d.ts.map +0 -1
- package/dist/lib/session/parse.js +0 -663
- package/dist/lib/session/parse.js.map +0 -1
- package/dist/lib/session/prompt.d.ts +0 -13
- package/dist/lib/session/prompt.d.ts.map +0 -1
- package/dist/lib/session/prompt.js +0 -79
- package/dist/lib/session/prompt.js.map +0 -1
- package/dist/lib/session/prompt.test.d.ts +0 -2
- package/dist/lib/session/prompt.test.d.ts.map +0 -1
- package/dist/lib/session/prompt.test.js +0 -57
- package/dist/lib/session/prompt.test.js.map +0 -1
- package/dist/lib/session/render.d.ts +0 -103
- package/dist/lib/session/render.d.ts.map +0 -1
- package/dist/lib/session/render.js +0 -798
- package/dist/lib/session/render.js.map +0 -1
- package/dist/lib/session/team-filter.d.ts +0 -35
- package/dist/lib/session/team-filter.d.ts.map +0 -1
- package/dist/lib/session/team-filter.js +0 -75
- package/dist/lib/session/team-filter.js.map +0 -1
- package/dist/lib/session/team-filter.test.d.ts +0 -2
- package/dist/lib/session/team-filter.test.d.ts.map +0 -1
- package/dist/lib/session/team-filter.test.js +0 -157
- package/dist/lib/session/team-filter.test.js.map +0 -1
- package/dist/lib/session/types.d.ts +0 -84
- package/dist/lib/session/types.d.ts.map +0 -1
- package/dist/lib/session/types.js +0 -11
- package/dist/lib/session/types.js.map +0 -1
- package/dist/lib/shims.d.ts +0 -272
- package/dist/lib/shims.d.ts.map +0 -1
- package/dist/lib/shims.js +0 -1322
- package/dist/lib/shims.js.map +0 -1
- package/dist/lib/skills.d.ts +0 -142
- package/dist/lib/skills.d.ts.map +0 -1
- package/dist/lib/skills.js +0 -791
- package/dist/lib/skills.js.map +0 -1
- package/dist/lib/state.d.ts +0 -87
- package/dist/lib/state.d.ts.map +0 -1
- package/dist/lib/state.js +0 -333
- package/dist/lib/state.js.map +0 -1
- package/dist/lib/subagents.d.ts +0 -84
- package/dist/lib/subagents.d.ts.map +0 -1
- package/dist/lib/subagents.js +0 -410
- package/dist/lib/subagents.js.map +0 -1
- package/dist/lib/teams/__tests__/oracle.test.d.ts +0 -2
- package/dist/lib/teams/__tests__/oracle.test.d.ts.map +0 -1
- package/dist/lib/teams/__tests__/oracle.test.js +0 -89
- package/dist/lib/teams/__tests__/oracle.test.js.map +0 -1
- package/dist/lib/teams/__tests__/supervisor.test.d.ts +0 -2
- package/dist/lib/teams/__tests__/supervisor.test.d.ts.map +0 -1
- package/dist/lib/teams/__tests__/supervisor.test.js +0 -179
- package/dist/lib/teams/__tests__/supervisor.test.js.map +0 -1
- package/dist/lib/teams/agents.d.ts +0 -247
- package/dist/lib/teams/agents.d.ts.map +0 -1
- package/dist/lib/teams/agents.js +0 -1244
- package/dist/lib/teams/agents.js.map +0 -1
- package/dist/lib/teams/api.d.ts +0 -91
- package/dist/lib/teams/api.d.ts.map +0 -1
- package/dist/lib/teams/api.js +0 -239
- package/dist/lib/teams/api.js.map +0 -1
- package/dist/lib/teams/cloud.d.ts +0 -11
- package/dist/lib/teams/cloud.d.ts.map +0 -1
- package/dist/lib/teams/cloud.js +0 -169
- package/dist/lib/teams/cloud.js.map +0 -1
- package/dist/lib/teams/debug.d.ts +0 -8
- package/dist/lib/teams/debug.d.ts.map +0 -1
- package/dist/lib/teams/debug.js +0 -12
- package/dist/lib/teams/debug.js.map +0 -1
- package/dist/lib/teams/file_ops.d.ts +0 -13
- package/dist/lib/teams/file_ops.d.ts.map +0 -1
- package/dist/lib/teams/file_ops.js +0 -66
- package/dist/lib/teams/file_ops.js.map +0 -1
- package/dist/lib/teams/index.d.ts +0 -16
- package/dist/lib/teams/index.d.ts.map +0 -1
- package/dist/lib/teams/index.js +0 -15
- package/dist/lib/teams/index.js.map +0 -1
- package/dist/lib/teams/oracle.d.ts +0 -20
- package/dist/lib/teams/oracle.d.ts.map +0 -1
- package/dist/lib/teams/oracle.js +0 -59
- package/dist/lib/teams/oracle.js.map +0 -1
- package/dist/lib/teams/parsers.d.ts +0 -9
- package/dist/lib/teams/parsers.d.ts.map +0 -1
- package/dist/lib/teams/parsers.js +0 -837
- package/dist/lib/teams/parsers.js.map +0 -1
- package/dist/lib/teams/persistence.d.ts +0 -43
- package/dist/lib/teams/persistence.d.ts.map +0 -1
- package/dist/lib/teams/persistence.js +0 -299
- package/dist/lib/teams/persistence.js.map +0 -1
- package/dist/lib/teams/ralph.d.ts +0 -8
- package/dist/lib/teams/ralph.d.ts.map +0 -1
- package/dist/lib/teams/ralph.js +0 -59
- package/dist/lib/teams/ralph.js.map +0 -1
- package/dist/lib/teams/registry.d.ts +0 -18
- package/dist/lib/teams/registry.d.ts.map +0 -1
- package/dist/lib/teams/registry.js +0 -68
- package/dist/lib/teams/registry.js.map +0 -1
- package/dist/lib/teams/summarizer.d.ts +0 -73
- package/dist/lib/teams/summarizer.d.ts.map +0 -1
- package/dist/lib/teams/summarizer.js +0 -780
- package/dist/lib/teams/summarizer.js.map +0 -1
- package/dist/lib/teams/supervisor.d.ts +0 -49
- package/dist/lib/teams/supervisor.d.ts.map +0 -1
- package/dist/lib/teams/supervisor.js +0 -74
- package/dist/lib/teams/supervisor.js.map +0 -1
- package/dist/lib/template.d.ts +0 -27
- package/dist/lib/template.d.ts.map +0 -1
- package/dist/lib/template.js +0 -60
- package/dist/lib/template.js.map +0 -1
- package/dist/lib/types.d.ts +0 -331
- package/dist/lib/types.d.ts.map +0 -1
- package/dist/lib/types.js +0 -29
- package/dist/lib/types.js.map +0 -1
- package/dist/lib/usage.d.ts +0 -105
- package/dist/lib/usage.d.ts.map +0 -1
- package/dist/lib/usage.js +0 -686
- package/dist/lib/usage.js.map +0 -1
- package/dist/lib/versions.d.ts +0 -253
- package/dist/lib/versions.d.ts.map +0 -1
- package/dist/lib/versions.js +0 -1796
- package/dist/lib/versions.js.map +0 -1
- package/scripts/rebuild-sqlite.sh +0 -46
package/dist/lib/models.js
DELETED
|
@@ -1,728 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Model catalog extraction, caching, and resolution for all supported agents.
|
|
3
|
-
*
|
|
4
|
-
* Each agent ships its model list differently -- Claude and Codex embed it in
|
|
5
|
-
* compiled bundles/binaries, Gemini exports it from a JS module, and OpenCode/
|
|
6
|
-
* Cursor/OpenClaw expose it via CLI commands. This module provides a unified
|
|
7
|
-
* `getModelCatalog()` and `resolveModel()` interface over all of them, backed
|
|
8
|
-
* by a file-system cache keyed on source mtime.
|
|
9
|
-
*/
|
|
10
|
-
import * as fs from 'fs';
|
|
11
|
-
import * as path from 'path';
|
|
12
|
-
import * as os from 'os';
|
|
13
|
-
import { execFileSync } from 'child_process';
|
|
14
|
-
import { getVersionDir } from './versions.js';
|
|
15
|
-
const CACHE_PATH = path.join(os.homedir(), '.agents', '.models-cache.json');
|
|
16
|
-
/**
|
|
17
|
-
* Bump when the extractor logic changes shape in an incompatible way so cached
|
|
18
|
-
* catalogs from older agents-cli builds are re-extracted.
|
|
19
|
-
*/
|
|
20
|
-
const CACHE_SCHEMA_VERSION = 2;
|
|
21
|
-
let memoryCache = null;
|
|
22
|
-
function cacheKey(agent, version) {
|
|
23
|
-
return `${agent}@${version}`;
|
|
24
|
-
}
|
|
25
|
-
/** Load the cache file from disk (or return the in-memory copy). */
|
|
26
|
-
function loadCache() {
|
|
27
|
-
if (memoryCache)
|
|
28
|
-
return memoryCache;
|
|
29
|
-
try {
|
|
30
|
-
const raw = JSON.parse(fs.readFileSync(CACHE_PATH, 'utf-8'));
|
|
31
|
-
if (raw && raw.schema === CACHE_SCHEMA_VERSION && raw.entries) {
|
|
32
|
-
memoryCache = raw;
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
// Legacy (pre-schema) or stale-schema cache -- drop it.
|
|
36
|
-
memoryCache = { schema: CACHE_SCHEMA_VERSION, entries: {} };
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
catch {
|
|
40
|
-
memoryCache = { schema: CACHE_SCHEMA_VERSION, entries: {} };
|
|
41
|
-
}
|
|
42
|
-
return memoryCache;
|
|
43
|
-
}
|
|
44
|
-
/** Persist the in-memory cache to disk. Best-effort; failures are silent. */
|
|
45
|
-
function saveCache() {
|
|
46
|
-
if (!memoryCache)
|
|
47
|
-
return;
|
|
48
|
-
try {
|
|
49
|
-
const dir = path.dirname(CACHE_PATH);
|
|
50
|
-
if (!fs.existsSync(dir))
|
|
51
|
-
fs.mkdirSync(dir, { recursive: true });
|
|
52
|
-
fs.writeFileSync(CACHE_PATH, JSON.stringify(memoryCache));
|
|
53
|
-
}
|
|
54
|
-
catch {
|
|
55
|
-
/* best-effort */
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Locate the file that authoritatively describes the installed model catalog
|
|
60
|
-
* for a given (agent, version). The `kind` tells `getModelCatalog` how to
|
|
61
|
-
* read it:
|
|
62
|
-
* bundle/binary -- strings(1)-style extraction (claude/codex)
|
|
63
|
-
* js -- read + regex-parse an exported JS module (gemini)
|
|
64
|
-
* cli -- spawn the agent's own `models` command (opencode/cursor/openclaw)
|
|
65
|
-
*
|
|
66
|
-
* Returns null if nothing usable is found.
|
|
67
|
-
*/
|
|
68
|
-
export function locateModelSource(agent, version) {
|
|
69
|
-
const versionDir = getVersionDir(agent, version);
|
|
70
|
-
if (agent === 'claude') {
|
|
71
|
-
const bundle = path.join(versionDir, 'node_modules', '@anthropic-ai', 'claude-code', 'cli.js');
|
|
72
|
-
if (fs.existsSync(bundle))
|
|
73
|
-
return { path: bundle, kind: 'bundle' };
|
|
74
|
-
// 2.1.113+ ships a native Mach-O binary
|
|
75
|
-
const bin = path.join(versionDir, 'node_modules', '@anthropic-ai', 'claude-code', 'bin', 'claude.exe');
|
|
76
|
-
if (fs.existsSync(bin))
|
|
77
|
-
return { path: bin, kind: 'binary' };
|
|
78
|
-
return null;
|
|
79
|
-
}
|
|
80
|
-
if (agent === 'codex') {
|
|
81
|
-
const triple = currentTargetTriple();
|
|
82
|
-
if (triple) {
|
|
83
|
-
const platformPkg = path.join(versionDir, 'node_modules', '@openai', `codex-${triple.includes('apple') ? 'darwin' : triple.includes('linux') ? 'linux' : 'win32'}-${triple.includes('aarch64') ? 'arm64' : 'x64'}`, 'vendor', triple, 'codex', 'codex');
|
|
84
|
-
if (fs.existsSync(platformPkg))
|
|
85
|
-
return { path: platformPkg, kind: 'binary' };
|
|
86
|
-
}
|
|
87
|
-
// 0.98 layout: binary inside @openai/codex itself
|
|
88
|
-
const triples = ['aarch64-apple-darwin', 'x86_64-apple-darwin', 'x86_64-unknown-linux-musl', 'aarch64-unknown-linux-musl'];
|
|
89
|
-
for (const t of triples) {
|
|
90
|
-
const p = path.join(versionDir, 'node_modules', '@openai', 'codex', 'vendor', t, 'codex', 'codex');
|
|
91
|
-
if (fs.existsSync(p))
|
|
92
|
-
return { path: p, kind: 'binary' };
|
|
93
|
-
}
|
|
94
|
-
return null;
|
|
95
|
-
}
|
|
96
|
-
if (agent === 'gemini') {
|
|
97
|
-
// Gemini ships a clean ES module with all constants and aliases -- no need
|
|
98
|
-
// to parse the minified CLI bundle.
|
|
99
|
-
const modelsJs = path.join(versionDir, 'node_modules', '@google', 'gemini-cli-core', 'dist', 'src', 'config', 'models.js');
|
|
100
|
-
if (fs.existsSync(modelsJs))
|
|
101
|
-
return { path: modelsJs, kind: 'js' };
|
|
102
|
-
return null;
|
|
103
|
-
}
|
|
104
|
-
if (agent === 'opencode') {
|
|
105
|
-
// The `opencode` shim under node_modules/.bin dispatches to a platform-
|
|
106
|
-
// specific native binary. We don't parse the 100MB binary; we let the CLI
|
|
107
|
-
// produce its own catalog via `opencode models --verbose`.
|
|
108
|
-
const cli = path.join(versionDir, 'node_modules', '.bin', 'opencode');
|
|
109
|
-
if (fs.existsSync(cli))
|
|
110
|
-
return { path: cli, kind: 'cli' };
|
|
111
|
-
return null;
|
|
112
|
-
}
|
|
113
|
-
if (agent === 'openclaw') {
|
|
114
|
-
const cli = path.join(versionDir, 'node_modules', '.bin', 'openclaw');
|
|
115
|
-
if (fs.existsSync(cli))
|
|
116
|
-
return { path: cli, kind: 'cli' };
|
|
117
|
-
// Fallback: installed outside agents-cli version management (e.g. global npm).
|
|
118
|
-
const pathBin = findOnPath('openclaw');
|
|
119
|
-
if (pathBin)
|
|
120
|
-
return { path: pathBin, kind: 'cli' };
|
|
121
|
-
return null;
|
|
122
|
-
}
|
|
123
|
-
if (agent === 'cursor') {
|
|
124
|
-
// cursor-agent is installed via curl script, not agents-cli. Version argument
|
|
125
|
-
// is accepted for API symmetry but ignored -- cursor lives on PATH.
|
|
126
|
-
const pathBin = findOnPath('cursor-agent');
|
|
127
|
-
if (pathBin)
|
|
128
|
-
return { path: pathBin, kind: 'cli' };
|
|
129
|
-
return null;
|
|
130
|
-
}
|
|
131
|
-
return null;
|
|
132
|
-
}
|
|
133
|
-
/** Search PATH for a command and return its absolute path, or null. */
|
|
134
|
-
function findOnPath(command) {
|
|
135
|
-
const pathEnv = process.env.PATH || '';
|
|
136
|
-
const exts = process.platform === 'win32' ? (process.env.PATHEXT || '').split(';') : [''];
|
|
137
|
-
for (const dir of pathEnv.split(path.delimiter)) {
|
|
138
|
-
if (!dir)
|
|
139
|
-
continue;
|
|
140
|
-
for (const ext of exts) {
|
|
141
|
-
const full = path.join(dir, command + ext);
|
|
142
|
-
try {
|
|
143
|
-
if (fs.statSync(full).isFile())
|
|
144
|
-
return full;
|
|
145
|
-
}
|
|
146
|
-
catch {
|
|
147
|
-
/* not here */
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
return null;
|
|
152
|
-
}
|
|
153
|
-
/** Map the current Node.js platform/arch pair to a Rust-style target triple. */
|
|
154
|
-
function currentTargetTriple() {
|
|
155
|
-
switch (`${process.platform}-${process.arch}`) {
|
|
156
|
-
case 'darwin-arm64': return 'aarch64-apple-darwin';
|
|
157
|
-
case 'darwin-x64': return 'x86_64-apple-darwin';
|
|
158
|
-
case 'linux-x64': return 'x86_64-unknown-linux-musl';
|
|
159
|
-
case 'linux-arm64': return 'aarch64-unknown-linux-musl';
|
|
160
|
-
case 'win32-x64': return 'x86_64-pc-windows-msvc';
|
|
161
|
-
case 'win32-arm64': return 'aarch64-pc-windows-msvc';
|
|
162
|
-
default: return null;
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
/**
|
|
166
|
-
* Read a file and return only the printable ASCII runs of length >= minLen,
|
|
167
|
-
* joined with newlines. Mirrors `strings(1)` for portability.
|
|
168
|
-
*/
|
|
169
|
-
function extractStrings(filePath, minLen = 6) {
|
|
170
|
-
const buf = fs.readFileSync(filePath);
|
|
171
|
-
const out = [];
|
|
172
|
-
let run = [];
|
|
173
|
-
for (let i = 0; i < buf.length; i++) {
|
|
174
|
-
const b = buf[i];
|
|
175
|
-
// printable ASCII (incl. tab, newline)
|
|
176
|
-
if ((b >= 0x20 && b <= 0x7e) || b === 0x09 || b === 0x0a) {
|
|
177
|
-
run.push(b);
|
|
178
|
-
}
|
|
179
|
-
else {
|
|
180
|
-
if (run.length >= minLen)
|
|
181
|
-
out.push(Buffer.from(run).toString('utf8'));
|
|
182
|
-
run = [];
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
if (run.length >= minLen)
|
|
186
|
-
out.push(Buffer.from(run).toString('utf8'));
|
|
187
|
-
return out.join('\n');
|
|
188
|
-
}
|
|
189
|
-
/**
|
|
190
|
-
* Extract Claude's model catalog from its bundle/binary.
|
|
191
|
-
*
|
|
192
|
-
* Bundle/binary contains:
|
|
193
|
-
* - alias map: {opus:"claude-opus-4-7",sonnet:"claude-sonnet-4-6",haiku:"..."}
|
|
194
|
-
* - per-cloud maps: {firstParty:"claude-opus-4-5-...",bedrock:"...",vertex:"...",...}
|
|
195
|
-
* - constants: {OPUS_ID:"...",OPUS_NAME:"...",SONNET_ID:"...",...}
|
|
196
|
-
*/
|
|
197
|
-
function extractClaudeCatalog(text) {
|
|
198
|
-
const aliases = {};
|
|
199
|
-
const aliasMapMatch = text.match(/\{opus:"(claude-[^"]+)",sonnet:"(claude-[^"]+)",haiku:"(claude-[^"]+)"\}/);
|
|
200
|
-
if (aliasMapMatch) {
|
|
201
|
-
aliases.opus = aliasMapMatch[1];
|
|
202
|
-
aliases.sonnet = aliasMapMatch[2];
|
|
203
|
-
aliases.haiku = aliasMapMatch[3];
|
|
204
|
-
}
|
|
205
|
-
const constMatch = text.match(/\{OPUS_ID:"([^"]+)",OPUS_NAME:"([^"]+)",SONNET_ID:"([^"]+)",SONNET_NAME:"([^"]+)",HAIKU_ID:"([^"]+)",HAIKU_NAME:"([^"]+)"/);
|
|
206
|
-
const displayNames = {};
|
|
207
|
-
if (constMatch) {
|
|
208
|
-
displayNames[constMatch[1]] = constMatch[2];
|
|
209
|
-
displayNames[constMatch[3]] = constMatch[4];
|
|
210
|
-
displayNames[constMatch[5]] = constMatch[6];
|
|
211
|
-
}
|
|
212
|
-
const perCloud = {};
|
|
213
|
-
const perCloudRe = /\{firstParty:"(claude-[^"]+)",bedrock:"([^"]+)"(?:,vertex:"([^"]+)")?(?:,foundry:"([^"]+)")?(?:,anthropicAws:"([^"]+)")?(?:,mantle:(?:null|"([^"]*)"))?\}/g;
|
|
214
|
-
let m;
|
|
215
|
-
while ((m = perCloudRe.exec(text)) !== null) {
|
|
216
|
-
const id = m[1];
|
|
217
|
-
if (perCloud[id])
|
|
218
|
-
continue;
|
|
219
|
-
perCloud[id] = {
|
|
220
|
-
firstParty: id,
|
|
221
|
-
bedrock: m[2],
|
|
222
|
-
vertex: m[3],
|
|
223
|
-
foundry: m[4],
|
|
224
|
-
anthropicAws: m[5],
|
|
225
|
-
mantle: m[6] ?? null,
|
|
226
|
-
};
|
|
227
|
-
}
|
|
228
|
-
const allIds = new Set([
|
|
229
|
-
...Object.values(aliases),
|
|
230
|
-
...Object.keys(displayNames),
|
|
231
|
-
...Object.keys(perCloud),
|
|
232
|
-
]);
|
|
233
|
-
const aliasReverse = {};
|
|
234
|
-
for (const [a, id] of Object.entries(aliases))
|
|
235
|
-
aliasReverse[id] = a;
|
|
236
|
-
const defaults = new Set(Object.values(aliases));
|
|
237
|
-
const models = Array.from(allIds)
|
|
238
|
-
.filter((id) => /^claude-(opus|sonnet|haiku)-/.test(id))
|
|
239
|
-
.sort()
|
|
240
|
-
.map((id) => ({
|
|
241
|
-
id,
|
|
242
|
-
displayName: displayNames[id],
|
|
243
|
-
alias: aliasReverse[id],
|
|
244
|
-
isDefault: defaults.has(id),
|
|
245
|
-
perCloud: perCloud[id],
|
|
246
|
-
}));
|
|
247
|
-
return { models, aliases };
|
|
248
|
-
}
|
|
249
|
-
/**
|
|
250
|
-
* Extract Codex's model catalog. Catalog is embedded as JSON-ish records:
|
|
251
|
-
* "slug": "...", "display_name": "...", "description": "...",
|
|
252
|
-
* "default_reasoning_level": "...", "supported_reasoning_levels": [...]
|
|
253
|
-
*/
|
|
254
|
-
function extractCodexCatalog(text) {
|
|
255
|
-
const models = [];
|
|
256
|
-
const seen = new Set();
|
|
257
|
-
// Anchor on each "slug" then walk forward for the related fields within ~1500 chars
|
|
258
|
-
const slugRe = /"slug":\s*"([^"]+)"/g;
|
|
259
|
-
let m;
|
|
260
|
-
while ((m = slugRe.exec(text)) !== null) {
|
|
261
|
-
const slug = m[1];
|
|
262
|
-
if (seen.has(slug))
|
|
263
|
-
continue;
|
|
264
|
-
seen.add(slug);
|
|
265
|
-
const window = text.slice(Math.max(0, m.index - 200), m.index + 1500);
|
|
266
|
-
const displayMatch = window.match(/"display_name":\s*"([^"]+)"/);
|
|
267
|
-
const descMatch = window.match(/"description":\s*"([^"]+)"/);
|
|
268
|
-
const defaultLevelMatch = window.match(/"default_reasoning_level":\s*"([^"]+)"/);
|
|
269
|
-
const reasoningLevels = [];
|
|
270
|
-
const levelsBlock = window.match(/"supported_reasoning_levels":\s*\[([\s\S]*?)\]/);
|
|
271
|
-
if (levelsBlock) {
|
|
272
|
-
const levelRe = /\{\s*"effort":\s*"([^"]+)"(?:,\s*"description":\s*"([^"]+)")?\s*\}/g;
|
|
273
|
-
let lm;
|
|
274
|
-
while ((lm = levelRe.exec(levelsBlock[1])) !== null) {
|
|
275
|
-
reasoningLevels.push({ effort: lm[1], description: lm[2] });
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
models.push({
|
|
279
|
-
id: slug,
|
|
280
|
-
displayName: displayMatch?.[1],
|
|
281
|
-
description: descMatch?.[1],
|
|
282
|
-
defaultReasoningLevel: defaultLevelMatch?.[1],
|
|
283
|
-
reasoningLevels: reasoningLevels.length > 0 ? reasoningLevels : undefined,
|
|
284
|
-
});
|
|
285
|
-
}
|
|
286
|
-
return { models, aliases: {} };
|
|
287
|
-
}
|
|
288
|
-
/**
|
|
289
|
-
* Extract Gemini's model catalog from `@google/gemini-cli-core/.../config/models.js`.
|
|
290
|
-
*
|
|
291
|
-
* The module exports a set of named constants (e.g. `DEFAULT_GEMINI_MODEL`,
|
|
292
|
-
* `PREVIEW_GEMINI_FLASH_MODEL`) plus a `VALID_GEMINI_MODELS` Set and a handful
|
|
293
|
-
* of `GEMINI_MODEL_ALIAS_*` strings. We parse it with regex (a JS-module import
|
|
294
|
-
* would pollute the runtime and ES-module interop is awkward from a CJS build).
|
|
295
|
-
*/
|
|
296
|
-
function extractGeminiCatalog(text) {
|
|
297
|
-
const constRe = /export\s+const\s+([A-Z0-9_]+)\s*=\s*'([^']+)'/g;
|
|
298
|
-
const constants = new Map();
|
|
299
|
-
let m;
|
|
300
|
-
while ((m = constRe.exec(text)) !== null) {
|
|
301
|
-
constants.set(m[1], m[2]);
|
|
302
|
-
}
|
|
303
|
-
// The set of ids the CLI accepts as "valid model names". Names (not values)
|
|
304
|
-
// are listed inside `new Set([...])`, so we expand them via the constants map.
|
|
305
|
-
const validIds = new Set();
|
|
306
|
-
const setBlock = text.match(/VALID_GEMINI_MODELS\s*=\s*new\s+Set\(\[([\s\S]*?)\]\)/);
|
|
307
|
-
if (setBlock) {
|
|
308
|
-
const nameRe = /([A-Z0-9_]+)/g;
|
|
309
|
-
let nm;
|
|
310
|
-
while ((nm = nameRe.exec(setBlock[1])) !== null) {
|
|
311
|
-
const id = constants.get(nm[1]);
|
|
312
|
-
if (id)
|
|
313
|
-
validIds.add(id);
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
// Fall back to any gemini-shaped id we saw in the constants map -- useful
|
|
317
|
-
// when the Set shape changes across gemini versions.
|
|
318
|
-
if (validIds.size === 0) {
|
|
319
|
-
for (const [name, value] of constants) {
|
|
320
|
-
if (/^(DEFAULT_|PREVIEW_)/.test(name) && /^gemini-/.test(value)) {
|
|
321
|
-
validIds.add(value);
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
// Aliases are exported as `GEMINI_MODEL_ALIAS_FLASH = 'flash'` etc. The alias
|
|
326
|
-
// is the *value*; the target model is resolved at runtime by `resolveModel()`.
|
|
327
|
-
// We replicate that logic here so callers get a concrete id per alias.
|
|
328
|
-
const defaultId = constants.get('DEFAULT_GEMINI_MODEL');
|
|
329
|
-
const previewPro = constants.get('PREVIEW_GEMINI_MODEL');
|
|
330
|
-
const previewFlash = constants.get('PREVIEW_GEMINI_FLASH_MODEL');
|
|
331
|
-
const flashLite = constants.get('DEFAULT_GEMINI_FLASH_LITE_MODEL');
|
|
332
|
-
const aliases = {};
|
|
333
|
-
if (previewPro) {
|
|
334
|
-
aliases.auto = previewPro;
|
|
335
|
-
aliases.pro = previewPro;
|
|
336
|
-
}
|
|
337
|
-
if (previewFlash)
|
|
338
|
-
aliases.flash = previewFlash;
|
|
339
|
-
if (flashLite)
|
|
340
|
-
aliases['flash-lite'] = flashLite;
|
|
341
|
-
const aliasReverse = {};
|
|
342
|
-
for (const [alias, id] of Object.entries(aliases)) {
|
|
343
|
-
(aliasReverse[id] ||= []).push(alias);
|
|
344
|
-
}
|
|
345
|
-
const defaults = new Set();
|
|
346
|
-
if (defaultId)
|
|
347
|
-
defaults.add(defaultId);
|
|
348
|
-
if (previewPro)
|
|
349
|
-
defaults.add(previewPro); // auto/pro alias resolves here
|
|
350
|
-
const displayNameFor = (id) => {
|
|
351
|
-
// Gemini has a `getDisplayString` for some aliases but the canonical id
|
|
352
|
-
// is human-readable enough ("gemini-3-pro-preview") -- no separate map.
|
|
353
|
-
return undefined;
|
|
354
|
-
};
|
|
355
|
-
const models = Array.from(validIds)
|
|
356
|
-
.sort()
|
|
357
|
-
.map((id) => ({
|
|
358
|
-
id,
|
|
359
|
-
displayName: displayNameFor(id),
|
|
360
|
-
alias: aliasReverse[id]?.[0],
|
|
361
|
-
isDefault: defaults.has(id),
|
|
362
|
-
}));
|
|
363
|
-
return { models, aliases };
|
|
364
|
-
}
|
|
365
|
-
/**
|
|
366
|
-
* Extract OpenCode's catalog by invoking `opencode models --verbose`. The
|
|
367
|
-
* output is a sequence of `<provider>/<id>\n{json}` blocks -- we parse every
|
|
368
|
-
* JSON block that follows a provider/id line.
|
|
369
|
-
*
|
|
370
|
-
* OpenCode caches the models.dev snapshot internally, so this is a local,
|
|
371
|
-
* non-network call after first launch.
|
|
372
|
-
*/
|
|
373
|
-
function extractOpenCodeCatalog(binaryPath) {
|
|
374
|
-
let stdout;
|
|
375
|
-
try {
|
|
376
|
-
stdout = execFileSync(binaryPath, ['models', '--verbose'], {
|
|
377
|
-
encoding: 'utf-8',
|
|
378
|
-
stdio: ['ignore', 'pipe', 'ignore'],
|
|
379
|
-
timeout: 15_000,
|
|
380
|
-
maxBuffer: 64 * 1024 * 1024,
|
|
381
|
-
});
|
|
382
|
-
}
|
|
383
|
-
catch {
|
|
384
|
-
return { models: [], aliases: {} };
|
|
385
|
-
}
|
|
386
|
-
const models = [];
|
|
387
|
-
const seen = new Set();
|
|
388
|
-
// Blocks look like:
|
|
389
|
-
// provider/model-id
|
|
390
|
-
// {
|
|
391
|
-
// "id": "...", "providerID": "...", "name": "...", ...
|
|
392
|
-
// }
|
|
393
|
-
// Walk forward finding `{` at column 0 that terminates with a `}` at column 0.
|
|
394
|
-
const lines = stdout.split('\n');
|
|
395
|
-
for (let i = 0; i < lines.length; i++) {
|
|
396
|
-
const line = lines[i];
|
|
397
|
-
if (!/^[a-z0-9][a-z0-9.-]*\/[^\s]+$/i.test(line))
|
|
398
|
-
continue;
|
|
399
|
-
const fullKey = line;
|
|
400
|
-
// Find the opening `{` right after this line, collect until matching `}`.
|
|
401
|
-
let start = -1;
|
|
402
|
-
for (let j = i + 1; j < lines.length; j++) {
|
|
403
|
-
if (lines[j] === '{') {
|
|
404
|
-
start = j;
|
|
405
|
-
break;
|
|
406
|
-
}
|
|
407
|
-
if (lines[j].trim() !== '')
|
|
408
|
-
break;
|
|
409
|
-
}
|
|
410
|
-
if (start === -1)
|
|
411
|
-
continue;
|
|
412
|
-
let depth = 0;
|
|
413
|
-
let end = -1;
|
|
414
|
-
for (let j = start; j < lines.length; j++) {
|
|
415
|
-
for (const ch of lines[j]) {
|
|
416
|
-
if (ch === '{')
|
|
417
|
-
depth++;
|
|
418
|
-
else if (ch === '}')
|
|
419
|
-
depth--;
|
|
420
|
-
}
|
|
421
|
-
if (depth === 0) {
|
|
422
|
-
end = j;
|
|
423
|
-
break;
|
|
424
|
-
}
|
|
425
|
-
}
|
|
426
|
-
if (end === -1)
|
|
427
|
-
continue;
|
|
428
|
-
const json = lines.slice(start, end + 1).join('\n');
|
|
429
|
-
try {
|
|
430
|
-
const obj = JSON.parse(json);
|
|
431
|
-
if (seen.has(fullKey))
|
|
432
|
-
continue;
|
|
433
|
-
seen.add(fullKey);
|
|
434
|
-
// obj.status can be "active" | "deprecated" | "preview" -- surface only
|
|
435
|
-
// when it isn't the default so the consumer can flag stale models.
|
|
436
|
-
const nonDefaultStatus = obj.status && obj.status !== 'active' ? obj.status : undefined;
|
|
437
|
-
models.push({
|
|
438
|
-
id: fullKey,
|
|
439
|
-
displayName: obj.name,
|
|
440
|
-
description: nonDefaultStatus,
|
|
441
|
-
});
|
|
442
|
-
}
|
|
443
|
-
catch {
|
|
444
|
-
/* skip malformed block */
|
|
445
|
-
}
|
|
446
|
-
i = end;
|
|
447
|
-
}
|
|
448
|
-
// Second pass: if --verbose produced nothing, fall back to the plain list.
|
|
449
|
-
if (models.length === 0) {
|
|
450
|
-
try {
|
|
451
|
-
const plain = execFileSync(binaryPath, ['models'], {
|
|
452
|
-
encoding: 'utf-8',
|
|
453
|
-
stdio: ['ignore', 'pipe', 'ignore'],
|
|
454
|
-
timeout: 10_000,
|
|
455
|
-
maxBuffer: 16 * 1024 * 1024,
|
|
456
|
-
});
|
|
457
|
-
for (const raw of plain.split('\n')) {
|
|
458
|
-
const id = raw.trim();
|
|
459
|
-
if (!id || !/^[a-z0-9][a-z0-9.-]*\/[^\s]+$/i.test(id))
|
|
460
|
-
continue;
|
|
461
|
-
if (seen.has(id))
|
|
462
|
-
continue;
|
|
463
|
-
seen.add(id);
|
|
464
|
-
models.push({ id });
|
|
465
|
-
}
|
|
466
|
-
}
|
|
467
|
-
catch {
|
|
468
|
-
/* leave empty */
|
|
469
|
-
}
|
|
470
|
-
}
|
|
471
|
-
return { models, aliases: {} };
|
|
472
|
-
}
|
|
473
|
-
/**
|
|
474
|
-
* Extract Cursor's catalog via `cursor-agent --list-models`. Output lines look like:
|
|
475
|
-
* `auto - Auto`
|
|
476
|
-
* `composer-2-fast - Composer 2 Fast (current, default)`
|
|
477
|
-
* `gpt-5.3-codex - Codex 5.3`
|
|
478
|
-
*/
|
|
479
|
-
function extractCursorCatalog(binaryPath) {
|
|
480
|
-
let stdout;
|
|
481
|
-
try {
|
|
482
|
-
stdout = execFileSync(binaryPath, ['--list-models'], {
|
|
483
|
-
encoding: 'utf-8',
|
|
484
|
-
stdio: ['ignore', 'pipe', 'ignore'],
|
|
485
|
-
timeout: 15_000,
|
|
486
|
-
maxBuffer: 8 * 1024 * 1024,
|
|
487
|
-
});
|
|
488
|
-
}
|
|
489
|
-
catch {
|
|
490
|
-
return { models: [], aliases: {} };
|
|
491
|
-
}
|
|
492
|
-
// Strip ANSI escape sequences; cursor renders a loading spinner.
|
|
493
|
-
// eslint-disable-next-line no-control-regex
|
|
494
|
-
const plain = stdout.replace(/\x1b\[[0-9;]*[A-Za-z]/g, '');
|
|
495
|
-
const models = [];
|
|
496
|
-
const seen = new Set();
|
|
497
|
-
for (const raw of plain.split('\n')) {
|
|
498
|
-
const line = raw.trim();
|
|
499
|
-
if (!line)
|
|
500
|
-
continue;
|
|
501
|
-
// Expect `id - display[ (flag1, flag2, ...)]`
|
|
502
|
-
const m = line.match(/^([A-Za-z0-9][A-Za-z0-9.\-_]*)\s+-\s+(.+)$/);
|
|
503
|
-
if (!m)
|
|
504
|
-
continue;
|
|
505
|
-
const id = m[1];
|
|
506
|
-
if (seen.has(id))
|
|
507
|
-
continue;
|
|
508
|
-
seen.add(id);
|
|
509
|
-
const rest = m[2];
|
|
510
|
-
const flagMatch = rest.match(/\s+\(([^)]+)\)\s*$/);
|
|
511
|
-
const flags = flagMatch ? flagMatch[1].split(',').map((s) => s.trim().toLowerCase()) : [];
|
|
512
|
-
const displayName = (flagMatch ? rest.slice(0, flagMatch.index) : rest).trim();
|
|
513
|
-
models.push({
|
|
514
|
-
id,
|
|
515
|
-
displayName,
|
|
516
|
-
isDefault: flags.includes('default'),
|
|
517
|
-
});
|
|
518
|
-
}
|
|
519
|
-
return { models, aliases: {} };
|
|
520
|
-
}
|
|
521
|
-
/**
|
|
522
|
-
* Extract OpenClaw's catalog via `openclaw models list --all --json`. OpenClaw
|
|
523
|
-
* bundles its own models.dev-like snapshot and exposes a stable JSON shape.
|
|
524
|
-
*/
|
|
525
|
-
function extractOpenClawCatalog(binaryPath) {
|
|
526
|
-
let stdout;
|
|
527
|
-
try {
|
|
528
|
-
stdout = execFileSync(binaryPath, ['models', 'list', '--all', '--json'], {
|
|
529
|
-
encoding: 'utf-8',
|
|
530
|
-
stdio: ['ignore', 'pipe', 'ignore'],
|
|
531
|
-
timeout: 20_000,
|
|
532
|
-
maxBuffer: 64 * 1024 * 1024,
|
|
533
|
-
});
|
|
534
|
-
}
|
|
535
|
-
catch {
|
|
536
|
-
return { models: [], aliases: {} };
|
|
537
|
-
}
|
|
538
|
-
// OpenClaw prefaces output with a banner line on stderr; stdout should be
|
|
539
|
-
// pure JSON, but be defensive and skip preface text if any slipped through.
|
|
540
|
-
const firstBrace = stdout.indexOf('{');
|
|
541
|
-
if (firstBrace === -1)
|
|
542
|
-
return { models: [], aliases: {} };
|
|
543
|
-
let parsed;
|
|
544
|
-
try {
|
|
545
|
-
parsed = JSON.parse(stdout.slice(firstBrace));
|
|
546
|
-
}
|
|
547
|
-
catch {
|
|
548
|
-
return { models: [], aliases: {} };
|
|
549
|
-
}
|
|
550
|
-
const rawModels = Array.isArray(parsed?.models) ? parsed.models : [];
|
|
551
|
-
const models = rawModels
|
|
552
|
-
.filter((m) => typeof m?.key === 'string')
|
|
553
|
-
.map((m) => ({
|
|
554
|
-
id: m.key,
|
|
555
|
-
displayName: typeof m.name === 'string' ? m.name : undefined,
|
|
556
|
-
isDefault: m.available === true && m.tags?.includes?.('default'),
|
|
557
|
-
}));
|
|
558
|
-
return { models, aliases: {} };
|
|
559
|
-
}
|
|
560
|
-
/**
|
|
561
|
-
* Build (or load from cache) the model catalog for a specific (agent, version).
|
|
562
|
-
* Cache is keyed on source-file mtime (binary or js module), so re-extracts
|
|
563
|
-
* automatically when the user upgrades or reinstalls a version.
|
|
564
|
-
*/
|
|
565
|
-
export function getModelCatalog(agent, version) {
|
|
566
|
-
const src = locateModelSource(agent, version);
|
|
567
|
-
if (!src)
|
|
568
|
-
return null;
|
|
569
|
-
let mtime = 0;
|
|
570
|
-
try {
|
|
571
|
-
mtime = fs.statSync(src.path).mtimeMs;
|
|
572
|
-
}
|
|
573
|
-
catch {
|
|
574
|
-
return null;
|
|
575
|
-
}
|
|
576
|
-
const cache = loadCache();
|
|
577
|
-
const key = cacheKey(agent, version);
|
|
578
|
-
const cached = cache.entries[key];
|
|
579
|
-
if (cached && cached.sourcePath === src.path && cached.mtime === mtime) {
|
|
580
|
-
return cached.catalog;
|
|
581
|
-
}
|
|
582
|
-
let models = [];
|
|
583
|
-
let aliases = {};
|
|
584
|
-
if (src.kind === 'bundle' || src.kind === 'binary') {
|
|
585
|
-
const text = extractStrings(src.path);
|
|
586
|
-
({ models, aliases } =
|
|
587
|
-
agent === 'claude' ? extractClaudeCatalog(text)
|
|
588
|
-
: agent === 'codex' ? extractCodexCatalog(text)
|
|
589
|
-
: { models: [], aliases: {} });
|
|
590
|
-
}
|
|
591
|
-
else if (src.kind === 'js') {
|
|
592
|
-
try {
|
|
593
|
-
const text = fs.readFileSync(src.path, 'utf-8');
|
|
594
|
-
if (agent === 'gemini')
|
|
595
|
-
({ models, aliases } = extractGeminiCatalog(text));
|
|
596
|
-
}
|
|
597
|
-
catch {
|
|
598
|
-
/* unreadable */
|
|
599
|
-
}
|
|
600
|
-
}
|
|
601
|
-
else if (src.kind === 'cli') {
|
|
602
|
-
if (agent === 'opencode')
|
|
603
|
-
({ models, aliases } = extractOpenCodeCatalog(src.path));
|
|
604
|
-
else if (agent === 'cursor')
|
|
605
|
-
({ models, aliases } = extractCursorCatalog(src.path));
|
|
606
|
-
else if (agent === 'openclaw')
|
|
607
|
-
({ models, aliases } = extractOpenClawCatalog(src.path));
|
|
608
|
-
}
|
|
609
|
-
const catalog = {
|
|
610
|
-
agent,
|
|
611
|
-
version,
|
|
612
|
-
source: src.kind,
|
|
613
|
-
sourcePath: src.path,
|
|
614
|
-
models,
|
|
615
|
-
aliases,
|
|
616
|
-
};
|
|
617
|
-
// Don't cache empty CLI extractions: the CLI may have been mid-install,
|
|
618
|
-
// network-dependent, or transiently failing. Caching 0 models would mask
|
|
619
|
-
// the real catalog forever (mtime won't change). Bundle/binary/js sources
|
|
620
|
-
// are deterministic, so cache those even when empty.
|
|
621
|
-
if (src.kind !== 'cli' || models.length > 0) {
|
|
622
|
-
cache.entries[key] = { sourcePath: src.path, mtime, catalog };
|
|
623
|
-
saveCache();
|
|
624
|
-
}
|
|
625
|
-
return catalog;
|
|
626
|
-
}
|
|
627
|
-
/**
|
|
628
|
-
* Resolve a user-supplied model string for a specific (agent, version).
|
|
629
|
-
*
|
|
630
|
-
* Pass-through semantics: we never block. If the input doesn't match anything
|
|
631
|
-
* we know about, we forward it as-is and return a warning the caller can log.
|
|
632
|
-
*
|
|
633
|
-
* - If `requested` matches an alias in the catalog (e.g. "opus"), we still
|
|
634
|
-
* forward the alias (the CLI accepts both), but we report the canonical id
|
|
635
|
-
* so logs/metadata can record the concrete model.
|
|
636
|
-
* - If `requested` matches a known canonical id, no warning.
|
|
637
|
-
* - If `requested` is unknown to our extractor, we forward it and warn.
|
|
638
|
-
*/
|
|
639
|
-
export function resolveModel(agent, version, requested) {
|
|
640
|
-
const catalog = getModelCatalog(agent, version);
|
|
641
|
-
if (!catalog) {
|
|
642
|
-
return { forwarded: requested };
|
|
643
|
-
}
|
|
644
|
-
const aliasTarget = catalog.aliases[requested];
|
|
645
|
-
if (aliasTarget) {
|
|
646
|
-
return { forwarded: requested, canonical: aliasTarget };
|
|
647
|
-
}
|
|
648
|
-
const knownIds = new Set(catalog.models.map((m) => m.id));
|
|
649
|
-
if (knownIds.has(requested)) {
|
|
650
|
-
return { forwarded: requested, canonical: requested };
|
|
651
|
-
}
|
|
652
|
-
// Strip [1m] context-window suffix before checking (Claude appends at runtime)
|
|
653
|
-
const stripped = requested.replace(/\[[^\]]+\]$/, '');
|
|
654
|
-
if (knownIds.has(stripped)) {
|
|
655
|
-
return { forwarded: requested, canonical: requested };
|
|
656
|
-
}
|
|
657
|
-
const suggestions = pickSuggestions(requested, catalog);
|
|
658
|
-
const hint = suggestions.length > 0 ? ` (closest: ${suggestions.join(', ')})` : '';
|
|
659
|
-
return {
|
|
660
|
-
forwarded: requested,
|
|
661
|
-
warning: `model "${requested}" not in known catalog for ${agent}@${version}; forwarding as-is${hint}`,
|
|
662
|
-
};
|
|
663
|
-
}
|
|
664
|
-
/** Find the closest matching model ids/aliases using edit distance. */
|
|
665
|
-
function pickSuggestions(requested, catalog) {
|
|
666
|
-
const all = [...catalog.models.map((m) => m.id), ...Object.keys(catalog.aliases)];
|
|
667
|
-
return all
|
|
668
|
-
.map((id) => ({ id, score: similarity(requested, id) }))
|
|
669
|
-
.filter((s) => s.score > 0.5)
|
|
670
|
-
.sort((a, b) => b.score - a.score)
|
|
671
|
-
.slice(0, 3)
|
|
672
|
-
.map((s) => s.id);
|
|
673
|
-
}
|
|
674
|
-
/** Normalized Levenshtein similarity (0..1, where 1 is identical). */
|
|
675
|
-
function similarity(a, b) {
|
|
676
|
-
const longer = a.length >= b.length ? a : b;
|
|
677
|
-
const shorter = a.length >= b.length ? b : a;
|
|
678
|
-
if (longer.length === 0)
|
|
679
|
-
return 1;
|
|
680
|
-
const distance = levenshtein(longer, shorter);
|
|
681
|
-
return (longer.length - distance) / longer.length;
|
|
682
|
-
}
|
|
683
|
-
/** Standard Levenshtein edit distance between two strings. */
|
|
684
|
-
function levenshtein(a, b) {
|
|
685
|
-
const m = a.length;
|
|
686
|
-
const n = b.length;
|
|
687
|
-
const dp = Array(m + 1)
|
|
688
|
-
.fill(null)
|
|
689
|
-
.map(() => Array(n + 1).fill(0));
|
|
690
|
-
for (let i = 0; i <= m; i++)
|
|
691
|
-
dp[i][0] = i;
|
|
692
|
-
for (let j = 0; j <= n; j++)
|
|
693
|
-
dp[0][j] = j;
|
|
694
|
-
for (let i = 1; i <= m; i++) {
|
|
695
|
-
for (let j = 1; j <= n; j++) {
|
|
696
|
-
dp[i][j] = a[i - 1] === b[j - 1]
|
|
697
|
-
? dp[i - 1][j - 1]
|
|
698
|
-
: 1 + Math.min(dp[i - 1][j], dp[i][j - 1], dp[i - 1][j - 1]);
|
|
699
|
-
}
|
|
700
|
-
}
|
|
701
|
-
return dp[m][n];
|
|
702
|
-
}
|
|
703
|
-
/**
|
|
704
|
-
* Build the per-agent CLI flags for a unified reasoning effort knob.
|
|
705
|
-
*
|
|
706
|
-
* Both Claude (`--effort`) and Codex (`-c model_reasoning_effort=...`) expose a
|
|
707
|
-
* reasoning intensity dial. Inputs accepted: low | medium | high | xhigh | max | auto.
|
|
708
|
-
* - Codex only supports low/medium/high; xhigh and max are clamped to high.
|
|
709
|
-
* - 'auto' skips reasoning flags for codex (lets it use model default).
|
|
710
|
-
* - 'auto' passes --effort auto to claude if supported.
|
|
711
|
-
*/
|
|
712
|
-
export function buildReasoningFlags(agent, level) {
|
|
713
|
-
const normalized = level.toLowerCase();
|
|
714
|
-
if (normalized === 'auto') {
|
|
715
|
-
// For claude, forward --effort auto if the agent supports it
|
|
716
|
-
// For codex and others, omit (let agent use its default)
|
|
717
|
-
return agent === 'claude' ? ['--effort', 'auto'] : [];
|
|
718
|
-
}
|
|
719
|
-
if (agent === 'claude') {
|
|
720
|
-
return ['--effort', normalized];
|
|
721
|
-
}
|
|
722
|
-
if (agent === 'codex') {
|
|
723
|
-
const codexLevel = (normalized === 'xhigh' || normalized === 'max') ? 'high' : normalized;
|
|
724
|
-
return ['-c', `model_reasoning_effort=${codexLevel}`];
|
|
725
|
-
}
|
|
726
|
-
return [];
|
|
727
|
-
}
|
|
728
|
-
//# sourceMappingURL=models.js.map
|