@functional-systems/lambdadb-cli 0.1.5-dev.19 → 0.1.5
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/CHANGELOG.md +21 -0
- package/CONTRIBUTING.md +27 -0
- package/README.md +214 -3
- package/dist/agent-config.d.ts +21 -0
- package/dist/agent-config.js +124 -0
- package/dist/agent-config.js.map +1 -0
- package/dist/agents.d.ts +113 -0
- package/dist/agents.js +196 -0
- package/dist/agents.js.map +1 -0
- package/dist/cli.js +47 -12
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/config.js +2 -2
- package/dist/config.js.map +1 -1
- package/dist/init.d.ts +31 -0
- package/dist/init.js +211 -0
- package/dist/init.js.map +1 -0
- package/dist/mcp.d.ts +4 -0
- package/dist/mcp.js +46 -0
- package/dist/mcp.js.map +1 -0
- package/dist/runtime.d.ts +8 -0
- package/dist/runtime.js +8 -0
- package/dist/runtime.js.map +1 -1
- package/package.json +6 -4
- package/skills/lambdadb/SKILL.md +35 -0
- package/src/agent-config.ts +112 -0
- package/src/agents.ts +212 -0
- package/src/cli.ts +42 -8
- package/src/config.ts +2 -2
- package/src/init.ts +185 -0
- package/src/mcp.ts +45 -0
- package/src/runtime.ts +9 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,10 +2,31 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [0.1.5] - 2026-10-25
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- First-use `init` for existing projects, with interactive guidance and an explicit
|
|
10
|
+
non-interactive path. Verify collection-list access and optionally configure
|
|
11
|
+
Codex, Claude Code, Cursor, VS Code, Gemini CLI, OpenCode, GitHub Copilot CLI,
|
|
12
|
+
Kiro IDE/CLI or the Cline VS Code extension (user scope) and a bundled LambdaDB
|
|
13
|
+
usage skill. Agent adapters preserve existing configuration and keep
|
|
14
|
+
environment forwarding specific to each tool.
|
|
15
|
+
- Deduplicate identical shared MCP/skill file updates across selected agents;
|
|
16
|
+
reject conflicting plans and unsupported agent scopes before connection or writes.
|
|
17
|
+
- Runtime-only credential forwarding to the existing read-only-by-default stdio
|
|
18
|
+
MCP package through `lambdadb mcp`; no key values are persisted. Existing CLI
|
|
19
|
+
commands remain non-interactive. Search readiness is not inferred from setup.
|
|
20
|
+
|
|
5
21
|
### Maintenance
|
|
6
22
|
|
|
7
23
|
- Synchronize the 0.1.4 release history and start the 0.1.5 development line.
|
|
8
24
|
- Update the Homebrew formula to verified stable 0.1.4.
|
|
25
|
+
- Correct the release live smoke for servers with a 1,000-candidate Bayesian
|
|
26
|
+
limit and compare document results across independent native embedding calls
|
|
27
|
+
without requiring bit-identical scores; retain the CLI's existing limits.
|
|
28
|
+
- Refresh the locked transitive Zod dependency to 4.6.7, addressing
|
|
29
|
+
[GHSA-mrhx-c7xc-m3w5](https://github.com/advisories/GHSA-mrhx-c7xc-m3w5).
|
|
9
30
|
|
|
10
31
|
## [0.1.4] - 2026-10-07
|
|
11
32
|
|
package/CONTRIBUTING.md
CHANGED
|
@@ -90,6 +90,26 @@ live-service readiness. See [README.md](README.md) for public behavior and the
|
|
|
90
90
|
|
|
91
91
|
## Compatibility and maintenance
|
|
92
92
|
|
|
93
|
+
Agent integrations live in the `agentAdapters` registry in `src/agents.ts`.
|
|
94
|
+
Each adapter owns detection directories and executable names, supported scopes, project/user
|
|
95
|
+
paths, MCP configuration generation (including environment forwarding), optional
|
|
96
|
+
skill path, and restart instructions. Add an adapter there to extend init's
|
|
97
|
+
selection, detection and help; keep authentication, file planning and atomic
|
|
98
|
+
writes in `src/init.ts`. `src/agent-config.ts` provides shared CLI launch
|
|
99
|
+
arguments and JSONC/TOML editors that preserve unrelated settings. MCP
|
|
100
|
+
configuration generation receives the key's variable name, never its value.
|
|
101
|
+
An MCP-only adapter can omit the skill path.
|
|
102
|
+
An adapter that cannot configure project MCP settings declares `scopes: ['user']`;
|
|
103
|
+
init rejects unsupported flags and offers only shared supported scopes interactively.
|
|
104
|
+
Identical changes to the same canonical path are combined; conflicting contents
|
|
105
|
+
or CLI-settings overlaps fail before connection or writes. Copilot/Cline adapters
|
|
106
|
+
use the strict JSON editor rather than silently removing comments.
|
|
107
|
+
|
|
108
|
+
Before adding an agent, verify its documented formats and environment forwarding,
|
|
109
|
+
then cover both scopes, unrelated configuration preservation, conflicts, reruns
|
|
110
|
+
and secret handling through the CLI tests. Test real agent startup separately;
|
|
111
|
+
configuration generation alone is not a successful connection.
|
|
112
|
+
|
|
93
113
|
Treat documented flags, JSON schema, exit codes, explicit target selection and
|
|
94
114
|
failure semantics as public contracts. Add regression coverage for changes to
|
|
95
115
|
these behaviors; do not script against human summaries. Update the changelog
|
|
@@ -114,6 +134,13 @@ repository's runtime matrix or release tooling without checking this CLI's needs
|
|
|
114
134
|
that artifact. To check an existing candidate, use
|
|
115
135
|
`npm run test:package -- /path/to/package.tgz`. Building test sources alone is
|
|
116
136
|
not evidence that tests executed.
|
|
137
|
+
- Init contracts run in temporary home/project directories against loopback
|
|
138
|
+
collection-list responses. They cover configuration/comment preservation,
|
|
139
|
+
reruns, conflicts, scope, secret handling and non-interactive failures. An npx
|
|
140
|
+
stub verifies stdio launch, credential mapping and write opt-in without fetching
|
|
141
|
+
or running an agent. The packaged suite repeats these contracts and verifies
|
|
142
|
+
the bundled skill. These checks do not establish actual agent MCP connection,
|
|
143
|
+
live authentication or document search readiness.
|
|
117
144
|
- [Homebrew validation](packaging/homebrew/README.md#local-and-ci-verification)
|
|
118
145
|
checks the stable formula's installation and released CLI contracts on macOS
|
|
119
146
|
and Linux. A new installation does not establish an existing-user upgrade;
|
package/README.md
CHANGED
|
@@ -88,6 +88,208 @@ printf '\n'
|
|
|
88
88
|
export LAMBDADB_API_KEY
|
|
89
89
|
```
|
|
90
90
|
|
|
91
|
+
### First-use setup with `init`
|
|
92
|
+
|
|
93
|
+
After securely exporting the key, run either entry point. Both use this same
|
|
94
|
+
package and executable:
|
|
95
|
+
|
|
96
|
+
```sh
|
|
97
|
+
lambdadb init
|
|
98
|
+
npx @functional-systems/lambdadb-cli@latest init
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
`init` guides you through the existing project's endpoint, name and API-key
|
|
102
|
+
environment-variable name. It detects Codex, Claude Code, Cursor, VS Code,
|
|
103
|
+
Gemini CLI, OpenCode, GitHub Copilot CLI, Kiro IDE/CLI and the Cline VS Code
|
|
104
|
+
extension using PATH and configuration directories, then lets you choose any subset (or `none`),
|
|
105
|
+
project/user scope, and whether to enable MCP write tools. Detection is a hint,
|
|
106
|
+
not proof that an agent is installed or connected. Project scope means the
|
|
107
|
+
current working directory; run from your repository root.
|
|
108
|
+
Cursor detection recognizes both the editor's `cursor` command and the
|
|
109
|
+
`cursor-agent` CLI, which reads the same MCP configuration. With Cursor CLI,
|
|
110
|
+
check the generated server with `cursor-agent mcp list-tools lambdadb`.
|
|
111
|
+
|
|
112
|
+
The remaining manual step is in [LambdaDB Console](https://console.lambdadb.ai):
|
|
113
|
+
select an existing project and obtain its API endpoint, project name and project
|
|
114
|
+
API key. Inject the key into your shell or secret manager before running init.
|
|
115
|
+
There is no browser login, account/project creation, key issuance, remote MCP,
|
|
116
|
+
or backend/Console change in this flow. Init never asks for the key value and
|
|
117
|
+
does not load or write `.env` files.
|
|
118
|
+
|
|
119
|
+
For automation, explicitly select both agents and scope:
|
|
120
|
+
|
|
121
|
+
```sh
|
|
122
|
+
# Inject LAMBDADB_API_KEY securely before running this command.
|
|
123
|
+
lambdadb init --non-interactive --agents codex,claude,cursor --scope project \
|
|
124
|
+
--endpoint https://api.lambdadb.ai --project YOUR_PROJECT --json
|
|
125
|
+
# Configure only the CLI, without changing agent files:
|
|
126
|
+
lambdadb init --non-interactive --agents none --scope project \
|
|
127
|
+
--endpoint https://api.lambdadb.ai --project YOUR_PROJECT --api-key-env MY_PROJECT_KEY
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
`--agents` accepts a comma-separated subset of
|
|
131
|
+
`codex,claude,cursor,vscode,gemini,opencode,copilot,kiro,cline` or `none`. For example:
|
|
132
|
+
|
|
133
|
+
```sh
|
|
134
|
+
lambdadb init --non-interactive --agents vscode,gemini,opencode --scope project
|
|
135
|
+
lambdadb init --non-interactive --agents copilot,kiro,cline --scope user
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
This example reuses your existing CLI settings and environment-held key.
|
|
139
|
+
`--scope` accepts `project` or `user`. `--write-tools` explicitly enables MCP
|
|
140
|
+
write tools; omission disables them, including on reruns and when the inherited
|
|
141
|
+
`LAMBDADB_MCP_ENABLE_WRITE_TOOLS` environment variable is true. The normal global
|
|
142
|
+
`--config`, `--endpoint`, `--project`, `--api-key-env`, and `--timeout-ms` flags
|
|
143
|
+
apply. Existing settings/environment precedence is unchanged. Non-TTY and
|
|
144
|
+
`--json` runs require `--non-interactive`; missing choices, target or key fail
|
|
145
|
+
with exit 2 and instructions, without prompting. This mode authorizes applying
|
|
146
|
+
the displayed file plan; it does not silently select detected agents.
|
|
147
|
+
Cline's extension supports only user-scope MCP settings. Selecting `cline` with
|
|
148
|
+
`--scope project` fails before any file writes or connection; interactive setup
|
|
149
|
+
offers user scope when Cline is selected. It never silently broadens the scope.
|
|
150
|
+
|
|
151
|
+
Before writing, init displays exact paths and create/update/unchanged actions,
|
|
152
|
+
then uses the same SDK check as `doctor` to verify authentication and collection-list
|
|
153
|
+
access. Failed validation/authentication leaves files untouched. The CLI's
|
|
154
|
+
non-secret settings always use its usual configuration path (or `--config`),
|
|
155
|
+
independently of agent scope:
|
|
156
|
+
|
|
157
|
+
| Agent | Project MCP / skill | User MCP / skill |
|
|
158
|
+
| --- | --- | --- |
|
|
159
|
+
| Codex | `.codex/config.toml` / `.agents/skills/lambdadb/SKILL.md` | `$CODEX_HOME/config.toml` (default `~/.codex/config.toml`) / `~/.agents/skills/lambdadb/SKILL.md` |
|
|
160
|
+
| Claude Code | `.mcp.json` / `.claude/skills/lambdadb/SKILL.md` | `~/.claude.json` / `~/.claude/skills/lambdadb/SKILL.md` |
|
|
161
|
+
| Cursor | `.cursor/mcp.json` / `.cursor/skills/lambdadb/SKILL.md` | `~/.cursor/mcp.json` / `~/.cursor/skills/lambdadb/SKILL.md` |
|
|
162
|
+
| VS Code | `.vscode/mcp.json` / `.github/skills/lambdadb/SKILL.md` | Default profile `mcp.json` (see below) / `~/.copilot/skills/lambdadb/SKILL.md` |
|
|
163
|
+
| Gemini CLI | `.gemini/settings.json` / `.gemini/skills/lambdadb/SKILL.md` | `~/.gemini/settings.json` / `~/.gemini/skills/lambdadb/SKILL.md` |
|
|
164
|
+
| OpenCode | `opencode.json` or existing `opencode.jsonc` / `.opencode/skills/lambdadb/SKILL.md` | `~/.config/opencode/opencode.json` or existing `.jsonc` / `~/.config/opencode/skills/lambdadb/SKILL.md` |
|
|
165
|
+
| GitHub Copilot CLI | `.mcp.json` or existing `.github/mcp.json` / `.github/skills/lambdadb/SKILL.md` | `~/.copilot/mcp-config.json` / `~/.copilot/skills/lambdadb/SKILL.md` |
|
|
166
|
+
| Kiro IDE/CLI | `.kiro/settings/mcp.json` / `.kiro/skills/lambdadb/SKILL.md` | `~/.kiro/settings/mcp.json` / `~/.kiro/skills/lambdadb/SKILL.md` |
|
|
167
|
+
| Cline VS Code extension | Unsupported; choose user scope | VS Code user profile `globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json` / `~/.cline/skills/lambdadb/SKILL.md` |
|
|
168
|
+
|
|
169
|
+
When `CLAUDE_CONFIG_DIR` is set, Claude's user MCP file is
|
|
170
|
+
`$CLAUDE_CONFIG_DIR/.claude.json` and its user skill is under
|
|
171
|
+
`$CLAUDE_CONFIG_DIR/skills/lambdadb/SKILL.md`.
|
|
172
|
+
|
|
173
|
+
Gemini's `GEMINI_CLI_HOME` replaces the home directory, with `.gemini` appended;
|
|
174
|
+
both user settings and the skill follow it. OpenCode's user config and skill
|
|
175
|
+
respect `XDG_CONFIG_HOME` (default `~/.config`). Existing OpenCode JSONC files
|
|
176
|
+
are edited in place. If both `opencode.json` and `opencode.jsonc` exist in the
|
|
177
|
+
chosen scope, init asks you to consolidate them before proceeding. It preserves
|
|
178
|
+
existing V2 `mcp.servers` maps; new files use V1 `mcp` syntax, which V2 also
|
|
179
|
+
supports. A mixed V1 LambdaDB entry and V2 server map is rejected for manual
|
|
180
|
+
resolution. Custom `OPENCODE_CONFIG`, `OPENCODE_CONFIG_DIR`, inline or
|
|
181
|
+
higher-priority project settings may override the selected root/user file.
|
|
182
|
+
|
|
183
|
+
VS Code uses the documented `servers` format for its Local harness, with
|
|
184
|
+
project scope at `.vscode/mcp.json`. User scope targets the default stable
|
|
185
|
+
profile: `~/Library/Application Support/Code/User/mcp.json` on macOS,
|
|
186
|
+
`${XDG_CONFIG_HOME:-$HOME/.config}/Code/User/mcp.json` on Linux, and
|
|
187
|
+
`%APPDATA%/Code/User/mcp.json` on Windows (fallback `%USERPROFILE%/AppData/Roaming`).
|
|
188
|
+
`VSCODE_PORTABLE` and `VSCODE_APPDATA` overrides are honored. Named profiles,
|
|
189
|
+
Insiders, `--user-data-dir`, remote hosts and portable Copilot configuration are
|
|
190
|
+
outside this adapter's scope. Reload the window and use **MCP: List Servers**.
|
|
191
|
+
In Gemini, restart or use `/mcp refresh` and `/skills reload`; in OpenCode,
|
|
192
|
+
restart and use `opencode mcp list`. Preserve normal trust/approval prompts.
|
|
193
|
+
|
|
194
|
+
Copilot CLI is separate from the VS Code adapter. It reads `mcpServers`, not
|
|
195
|
+
VS Code's `servers` map. Project setup reuses `.mcp.json` if present, otherwise
|
|
196
|
+
an existing `.github/mcp.json`, otherwise creates `.mcp.json`. Both wrapped
|
|
197
|
+
`mcpServers` and existing bare server maps are preserved. `COPILOT_HOME` overrides
|
|
198
|
+
the user MCP and skill directory. Restart with the selected key in the launch
|
|
199
|
+
environment, trust the repository, check `/mcp`, and run `/skills reload`.
|
|
200
|
+
|
|
201
|
+
Kiro IDE and CLI share one `kiro` adapter; detection recognizes both `kiro` and
|
|
202
|
+
`kiro-cli` executables. Approve the selected key variable in **Mcp Approved Env
|
|
203
|
+
Vars** when prompted. For a custom Kiro agent, ensure it includes the MCP JSON
|
|
204
|
+
and skill resources; init does not edit agent definitions or grant tool approvals.
|
|
205
|
+
|
|
206
|
+
The `cline` adapter targets the Cline extension in the default stable VS Code
|
|
207
|
+
user profile, using the same platform/portable user directory rules above.
|
|
208
|
+
Reload VS Code from an environment containing the selected key and inspect
|
|
209
|
+
Cline's MCP Servers and Skills menus. Cline CLI, other editors and named profiles
|
|
210
|
+
use different configuration locations and are outside this adapter's scope.
|
|
211
|
+
|
|
212
|
+
Unrelated configuration and comments are preserved where JSONC is accepted.
|
|
213
|
+
Copilot and Cline settings must be strict JSON for init; comments/trailing
|
|
214
|
+
commas cause an actionable failure and leave the file untouched. Shared files
|
|
215
|
+
(such as Claude/Copilot project MCP and VS Code/Copilot skills) are written only
|
|
216
|
+
once when both agents request identical contents; conflicting changes stop
|
|
217
|
+
before connection or writes. Symbolic links are preserved: init displays the
|
|
218
|
+
resolved write target and updates it once. Links with missing targets fail before
|
|
219
|
+
connection or writes; restore their targets before rerunning init.
|
|
220
|
+
Reruns update only recognizable init-generated `lambdadb` MCP entries;
|
|
221
|
+
existing custom entries or additions inside a generated entry cause an actionable
|
|
222
|
+
conflict. Existing skills are preserved, including user edits; remove the skill
|
|
223
|
+
file deliberately if you want to reinstall the bundled version. Writes use
|
|
224
|
+
atomic replacement per file, not a transaction across files: a disk/permission
|
|
225
|
+
failure can leave a partial installation; inspect the displayed paths and rerun.
|
|
226
|
+
|
|
227
|
+
Agent settings launch `npx -y @functional-systems/lambdadb-cli@<installed-version> mcp`,
|
|
228
|
+
which runs the existing `@functional-systems/lambdadb-mcp@0.1.4` stdio package.
|
|
229
|
+
No npx cache path is saved. The exact CLI version must be published before an
|
|
230
|
+
agent can fetch it; a source checkout/unpublished tarball alone does not provide
|
|
231
|
+
that registry version. Node/npm and `npx` must be on the agent's PATH; first launch
|
|
232
|
+
may download both packages and requires npm registry access.
|
|
233
|
+
|
|
234
|
+
The `mcp` bridge reads the selected key from the agent environment at startup and
|
|
235
|
+
maps CLI endpoint/project/key to MCP's `LAMBDADB_BASE_URL`,
|
|
236
|
+
`LAMBDADB_PROJECT_NAME`, and `LAMBDADB_PROJECT_API_KEY`. The bridge sets
|
|
237
|
+
`LAMBDADB_MCP_ENABLE_WRITE_TOOLS` explicitly. No key value is placed in arguments
|
|
238
|
+
or configuration. Codex uses `env_vars` to forward the selected variable;
|
|
239
|
+
Claude, Gemini, Copilot and Kiro use `${VAR}`; Cursor, VS Code and Cline use `${env:VAR}`; and
|
|
240
|
+
OpenCode uses `{env:VAR}` environment references. Gemini's explicit `env` entry
|
|
241
|
+
also forwards the key through its inherited-environment sanitization. An unresolved
|
|
242
|
+
reference fails before starting MCP. Keep the variable in the agent launch
|
|
243
|
+
environment: GUI apps may not inherit a terminal export. Restart/reload agents
|
|
244
|
+
after setup or credential changes, check `/mcp` in Codex/Claude or Cursor's MCP
|
|
245
|
+
settings, and approve/trust project settings if prompted. Higher-priority agent
|
|
246
|
+
settings or organization policies may override or block these files.
|
|
247
|
+
|
|
248
|
+
The no-secret-persistence contract covers files written by this CLI. Agents
|
|
249
|
+
manage their own runtime storage; for example, Codex shell snapshots can capture
|
|
250
|
+
the launch environment. Review your agent's environment/snapshot settings and
|
|
251
|
+
protect its runtime directory when forwarding a project key.
|
|
252
|
+
|
|
253
|
+
Init does not query documents or create collections/data. Connection success does
|
|
254
|
+
not establish search readiness. Its result includes a read-only agent prompt:
|
|
255
|
+
list collections, inspect the selected collection's index configuration, then
|
|
256
|
+
read up to five documents at `branch:main` with `query` omitted before searching
|
|
257
|
+
an actual indexed field. Without an agent, run `lambdadb collections list --json`,
|
|
258
|
+
choose an existing collection, save `{"size":5}` in `first-query.json`, and run:
|
|
259
|
+
|
|
260
|
+
```sh
|
|
261
|
+
lambdadb collections describe --collection YOUR_COLLECTION --json
|
|
262
|
+
lambdadb query --collection YOUR_COLLECTION --ref branch:main --file first-query.json --json
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
An empty project needs deliberately supplied data outside init. Empty results
|
|
266
|
+
are not evidence of indexing failure or readiness.
|
|
267
|
+
|
|
268
|
+
Agent formats were checked against official documentation on 2026-10-24:
|
|
269
|
+
[Codex MCP](https://developers.openai.com/codex/mcp),
|
|
270
|
+
[Codex skills](https://developers.openai.com/codex/skills),
|
|
271
|
+
[Claude Code MCP](https://code.claude.com/docs/en/mcp),
|
|
272
|
+
[Claude Code skills](https://code.claude.com/docs/en/skills),
|
|
273
|
+
[Cursor MCP](https://cursor.com/docs/mcp),
|
|
274
|
+
[Cursor CLI MCP](https://cursor.com/docs/cli/mcp),
|
|
275
|
+
[Cursor skills](https://cursor.com/docs/skills),
|
|
276
|
+
[VS Code MCP](https://code.visualstudio.com/docs/agents/reference/mcp-configuration),
|
|
277
|
+
[VS Code skills](https://code.visualstudio.com/docs/agent-customization/agent-skills),
|
|
278
|
+
[Gemini MCP](https://geminicli.com/docs/tools/mcp-server/),
|
|
279
|
+
[Gemini skills](https://geminicli.com/docs/cli/skills/),
|
|
280
|
+
[OpenCode MCP](https://opencode.ai/docs/mcp-servers/),
|
|
281
|
+
[OpenCode skills](https://opencode.ai/docs/skills/),
|
|
282
|
+
[OpenCode V2 compatibility](https://opencode.ai/v2/docs/migrate-v1/),
|
|
283
|
+
[Copilot MCP](https://docs.github.com/en/copilot/how-tos/copilot-cli/customize-copilot/add-mcp-servers),
|
|
284
|
+
[Copilot skills](https://docs.github.com/en/copilot/how-tos/copilot-cli/customize-copilot/add-skills),
|
|
285
|
+
[Kiro MCP](https://kiro.dev/docs/mcp/configuration/),
|
|
286
|
+
[Kiro skills](https://kiro.dev/docs/skills/),
|
|
287
|
+
[Cline MCP](https://docs.cline.bot/mcp/mcp-overview),
|
|
288
|
+
[Cline skills](https://docs.cline.bot/customization/skills), and
|
|
289
|
+
[Cline environment expansion source](https://github.com/cline/cline/blob/main/apps/vscode/src/utils/envExpansion.ts).
|
|
290
|
+
Generated settings still require
|
|
291
|
+
verification in the actual agent; local contract tests simulate that boundary.
|
|
292
|
+
|
|
91
293
|
No command accepts a raw key argument. Configuration stores only `endpoint`,
|
|
92
294
|
`project` and `apiKeyEnv`. Keys are read from the selected environment variable at
|
|
93
295
|
runtime and are never persisted by this CLI. Environment variables are still
|
|
@@ -112,7 +314,10 @@ Use a CI secret manager instead of adding credentials to tracked files.
|
|
|
112
314
|
|
|
113
315
|
There is no implicit endpoint, project, collection, branch or read ref. Explicit
|
|
114
316
|
empty values fail validation instead of silently falling back. An explicitly
|
|
115
|
-
selected missing config file fails except
|
|
317
|
+
selected missing config file fails for existing commands except `configure`,
|
|
318
|
+
which can create it. `init` can also create it; the `mcp` bridge allows a missing
|
|
319
|
+
file when endpoint/project settings are supplied through flags or environment.
|
|
320
|
+
|
|
116
321
|
`configure` applies the same precedence and saves the selected non-secret values;
|
|
117
322
|
it does not contact the service. To reference a different secret variable:
|
|
118
323
|
|
|
@@ -234,6 +439,10 @@ These additions require a supporting deployment; their API contract is pinned to
|
|
|
234
439
|
backend `9072a1bc8925954369a887f558f1eaf387b7ea0e`. See the SDK 0.8.0
|
|
235
440
|
[Bayesian contract](https://github.com/lambdadb/lambdadb-typescript-client/blob/v0.8.0/docs/bayesian-search.md)
|
|
236
441
|
and [native embedding contract](https://github.com/lambdadb/lambdadb-typescript-client/blob/v0.8.0/docs/native-embeddings.md).
|
|
442
|
+
Newer servers [raise the candidate limit to 1,000](https://github.com/lambdadb/lambdadb/commit/963d79e8866833f1deb1393ed00a9825d866c853).
|
|
443
|
+
The top-level Bayesian `candidateSize` is forwarded unchanged and its upper bound
|
|
444
|
+
depends on the deployment. This CLI and its bundled SDK still limit final `size`
|
|
445
|
+
and `rerank.candidateSize` to 100; a higher server limit does not raise those local limits.
|
|
237
446
|
|
|
238
447
|
### Native reranking
|
|
239
448
|
|
|
@@ -396,7 +605,9 @@ collection and explicit ref/branch. Errors use stable categories and safe hints.
|
|
|
396
605
|
API-specific response data may grow as the upstream API evolves. Help/version
|
|
397
606
|
remain plain text even with `--json`. Default output adds a readable summary and
|
|
398
607
|
pretty-printed data. Progress and diagnostics go only to stderr. No ANSI styling
|
|
399
|
-
|
|
608
|
+
is used. Only `init` prompts on a terminal; `init --non-interactive` and all
|
|
609
|
+
existing commands never prompt. `mcp` reserves stdout for MCP JSON-RPC and sends
|
|
610
|
+
startup failures to stderr rather than emitting the CLI JSON envelope.
|
|
400
611
|
|
|
401
612
|
Credential redaction preserves fixed protocol field names and command, status,
|
|
402
613
|
ref-kind and error-code tokens, even when a short credential coincides with one
|
|
@@ -453,7 +664,7 @@ methods and their limits.
|
|
|
453
664
|
|
|
454
665
|
This MVP intentionally omits Branch/Tag/Alias management: default `main` supports
|
|
455
666
|
first use, while reads can select existing refs. It also omits Console management,
|
|
456
|
-
MCP, Git collection, chunking, embedding workflows, code-search logic, delete,
|
|
667
|
+
remote MCP, Git collection, chunking, embedding workflows, code-search logic, delete,
|
|
457
668
|
plugins and publication. There are no changes to the SDK or reference repositories.
|
|
458
669
|
|
|
459
670
|
Live verification requires an explicitly designated development project, endpoint
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Settings } from './config.js';
|
|
2
|
+
export type McpLaunch = {
|
|
3
|
+
command: string;
|
|
4
|
+
args: string[];
|
|
5
|
+
apiKeyEnv: string;
|
|
6
|
+
};
|
|
7
|
+
type Server = {
|
|
8
|
+
command: string | string[];
|
|
9
|
+
args?: string[];
|
|
10
|
+
env_vars?: string[];
|
|
11
|
+
env?: Record<string, string>;
|
|
12
|
+
environment?: Record<string, string>;
|
|
13
|
+
type?: string;
|
|
14
|
+
};
|
|
15
|
+
type ServerFactory = (launch: McpLaunch) => Server;
|
|
16
|
+
type JsonMapPath = readonly string[] | ((value: Record<string, unknown>) => readonly string[]);
|
|
17
|
+
export declare function mcpLaunch(selected: Required<Settings>, writeTools: boolean, cliVersion: string): McpLaunch;
|
|
18
|
+
export declare function jsonConfig(path: string, text: string | undefined, launch: McpLaunch, createServer: ServerFactory, mapPath?: JsonMapPath): string;
|
|
19
|
+
export declare function strictJsonConfig(path: string, text: string | undefined, launch: McpLaunch, createServer: ServerFactory, mapPath?: JsonMapPath): string;
|
|
20
|
+
export declare function tomlConfig(path: string, text: string | undefined, launch: McpLaunch, createServer: ServerFactory): string;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { applyEdits, modify, parse as parseJson } from 'jsonc-parser';
|
|
2
|
+
import { parse as parseToml } from 'smol-toml';
|
|
3
|
+
import { InputError } from './errors.js';
|
|
4
|
+
const begin = '# BEGIN lambdadb init';
|
|
5
|
+
const end = '# END lambdadb init';
|
|
6
|
+
export function mcpLaunch(selected, writeTools, cliVersion) {
|
|
7
|
+
return { command: 'npx', apiKeyEnv: selected.apiKeyEnv,
|
|
8
|
+
args: ['-y', `@functional-systems/lambdadb-cli@${cliVersion}`, 'mcp',
|
|
9
|
+
'--endpoint', selected.endpoint, '--project', selected.project, '--api-key-env', selected.apiKeyEnv,
|
|
10
|
+
...(writeTools ? ['--write-tools'] : [])] };
|
|
11
|
+
}
|
|
12
|
+
function object(value) {
|
|
13
|
+
return !!value && typeof value === 'object' && !Array.isArray(value);
|
|
14
|
+
}
|
|
15
|
+
// Only entries generated by init may be updated. User additions to our entry
|
|
16
|
+
// cause a conflict instead of silently dropping their settings.
|
|
17
|
+
function managedServer(value, createServer) {
|
|
18
|
+
if (!object(value))
|
|
19
|
+
return false;
|
|
20
|
+
const command = Array.isArray(value.command) ? value.command[0] : value.command;
|
|
21
|
+
const a = Array.isArray(value.command) ? value.command.slice(1) : value.args;
|
|
22
|
+
if (command !== 'npx' || !Array.isArray(a))
|
|
23
|
+
return false;
|
|
24
|
+
if (a.some(v => typeof v !== 'string') || !/^@functional-systems\/lambdadb-cli@[\w.+-]+$/.test(a[1] ?? '')
|
|
25
|
+
|| a[0] !== '-y' || a[2] !== 'mcp' || a[3] !== '--endpoint' || a[5] !== '--project'
|
|
26
|
+
|| a[7] !== '--api-key-env' || ![9, 10].includes(a.length) || (a.length === 10 && a[9] !== '--write-tools'))
|
|
27
|
+
return false;
|
|
28
|
+
const expected = createServer({ command: 'npx', args: a, apiKeyEnv: a[8] });
|
|
29
|
+
return Object.keys(value).length === Object.keys(expected).length
|
|
30
|
+
&& Object.entries(expected).every(([key, item]) => JSON.stringify(value[key]) === JSON.stringify(item));
|
|
31
|
+
}
|
|
32
|
+
function conflict(path) {
|
|
33
|
+
throw new InputError(`Existing LambdaDB configuration in ${path} was not generated by init or has been edited. Preserve or rename that entry before rerunning init; no overwrite was performed.`);
|
|
34
|
+
}
|
|
35
|
+
export function jsonConfig(path, text, launch, createServer, mapPath = ['mcpServers']) {
|
|
36
|
+
const errors = [];
|
|
37
|
+
const value = parseJson(text ?? '{}', errors, { allowTrailingComma: true });
|
|
38
|
+
if (errors.length || !object(value)) {
|
|
39
|
+
throw new InputError(`Invalid agent JSON configuration: ${path}. Fix it before rerunning init.`);
|
|
40
|
+
}
|
|
41
|
+
const keys = typeof mapPath === 'function' ? mapPath(value) : mapPath;
|
|
42
|
+
let container = value;
|
|
43
|
+
for (const key of keys) {
|
|
44
|
+
const child = container[key];
|
|
45
|
+
if (child !== undefined && !object(child)) {
|
|
46
|
+
throw new InputError(`Invalid agent JSON configuration: ${path}. ${keys.join('.')} must contain objects.`);
|
|
47
|
+
}
|
|
48
|
+
container = (child ?? {});
|
|
49
|
+
}
|
|
50
|
+
const previous = container.lambdadb;
|
|
51
|
+
if (previous !== undefined && !managedServer(previous, createServer))
|
|
52
|
+
conflict(path);
|
|
53
|
+
const desired = createServer(launch);
|
|
54
|
+
if (JSON.stringify(previous) === JSON.stringify(desired))
|
|
55
|
+
return text;
|
|
56
|
+
const source = text ?? '{}\n';
|
|
57
|
+
return applyEdits(source, modify(source, [...keys, 'lambdadb'], desired, {
|
|
58
|
+
formattingOptions: { insertSpaces: true, tabSize: 2 },
|
|
59
|
+
}));
|
|
60
|
+
}
|
|
61
|
+
export function strictJsonConfig(path, text, launch, createServer, mapPath = ['mcpServers']) {
|
|
62
|
+
try {
|
|
63
|
+
JSON.parse(text ?? '{}');
|
|
64
|
+
}
|
|
65
|
+
catch {
|
|
66
|
+
throw new InputError(`Init requires strict JSON for ${path}. Remove comments or trailing commas before rerunning init.`);
|
|
67
|
+
}
|
|
68
|
+
return jsonConfig(path, text, launch, createServer, mapPath);
|
|
69
|
+
}
|
|
70
|
+
function tomlBlock(value) {
|
|
71
|
+
return `${begin}\n[mcp_servers.lambdadb]\ncommand = "npx"\nargs = ${JSON.stringify(value.args)}\nenv_vars = ${JSON.stringify(value.env_vars)}\n${end}\n`;
|
|
72
|
+
}
|
|
73
|
+
export function tomlConfig(path, text, launch, createServer) {
|
|
74
|
+
const source = text ?? '';
|
|
75
|
+
let parsed;
|
|
76
|
+
try {
|
|
77
|
+
parsed = parseToml(source);
|
|
78
|
+
}
|
|
79
|
+
catch {
|
|
80
|
+
throw new InputError(`Invalid agent TOML configuration: ${path}. Fix it before rerunning init.`);
|
|
81
|
+
}
|
|
82
|
+
const servers = parsed.mcp_servers;
|
|
83
|
+
if (servers !== undefined && !object(servers))
|
|
84
|
+
conflict(path);
|
|
85
|
+
const previous = object(servers) ? servers.lambdadb : undefined;
|
|
86
|
+
const block = tomlBlock(createServer(launch));
|
|
87
|
+
const start = source.indexOf(begin);
|
|
88
|
+
let after;
|
|
89
|
+
if (start < 0) {
|
|
90
|
+
if (previous !== undefined || source.includes(end))
|
|
91
|
+
conflict(path);
|
|
92
|
+
after = source + (source.endsWith('\n') || !source ? '' : '\n') + '\n' + block;
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
const finish = source.indexOf(end, start);
|
|
96
|
+
if (finish < 0 || source.indexOf(begin, start + begin.length) >= 0 || source.indexOf(end, finish + end.length) >= 0
|
|
97
|
+
|| !managedServer(previous, createServer))
|
|
98
|
+
conflict(path);
|
|
99
|
+
const stop = finish + end.length + (source[finish + end.length] === '\n' ? 1 : 0);
|
|
100
|
+
// Refuse to remove any unrelated sections/settings hidden inside markers.
|
|
101
|
+
let managed;
|
|
102
|
+
try {
|
|
103
|
+
managed = parseToml(source.slice(start, stop));
|
|
104
|
+
}
|
|
105
|
+
catch {
|
|
106
|
+
conflict(path);
|
|
107
|
+
}
|
|
108
|
+
if (Object.keys(managed).length !== 1 || !object(managed.mcp_servers)
|
|
109
|
+
|| Object.keys(managed.mcp_servers).length !== 1 || !managedServer(managed.mcp_servers.lambdadb, createServer))
|
|
110
|
+
conflict(path);
|
|
111
|
+
if (source.slice(start, stop) !== tomlBlock(previous))
|
|
112
|
+
conflict(path);
|
|
113
|
+
after = source.slice(0, start) + block + source.slice(stop);
|
|
114
|
+
}
|
|
115
|
+
// Appending a table is unsafe when an existing inline table seals mcp_servers.
|
|
116
|
+
try {
|
|
117
|
+
parseToml(after);
|
|
118
|
+
}
|
|
119
|
+
catch {
|
|
120
|
+
throw new InputError(`Cannot safely add LambdaDB to ${path}. Expand inline MCP tables before rerunning init.`);
|
|
121
|
+
}
|
|
122
|
+
return after;
|
|
123
|
+
}
|
|
124
|
+
//# sourceMappingURL=agent-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-config.js","sourceRoot":"","sources":["../src/agent-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,IAAI,SAAS,EAAmB,MAAM,cAAc,CAAC;AACvF,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,WAAW,CAAC;AAE/C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAOzC,MAAM,KAAK,GAAG,uBAAuB,CAAC;AACtC,MAAM,GAAG,GAAG,qBAAqB,CAAC;AAElC,MAAM,UAAU,SAAS,CAAC,QAA4B,EAAE,UAAmB,EAAE,UAAkB;IAC7F,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ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,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC;QAAC,CAAC;QAAC,MAAM,CAAC;YAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QAAC,CAAC;QACjF,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC;eAChE,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,WAAW,CAAC,QAAQ,EAAE,YAAY,CAAC;YAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;QACjI,IAAI,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,SAAS,CAAC,QAAgD,CAAC;YAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;QAC9G,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,GAAG,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC9D,CAAC;IACD,+EAA+E;IAC/E,IAAI,CAAC;QAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAAC,CAAC;IACzB,MAAM,CAAC;QAAC,MAAM,IAAI,UAAU,CAAC,iCAAiC,IAAI,mDAAmD,CAAC,CAAC;IAAC,CAAC;IACzH,OAAO,KAAK,CAAC;AACf,CAAC"}
|
package/dist/agents.d.ts
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { type McpLaunch } from './agent-config.js';
|
|
2
|
+
export type AgentScope = 'project' | 'user';
|
|
3
|
+
export type AgentContext = {
|
|
4
|
+
cwd: string;
|
|
5
|
+
home: string;
|
|
6
|
+
env: NodeJS.ProcessEnv;
|
|
7
|
+
platform?: NodeJS.Platform;
|
|
8
|
+
};
|
|
9
|
+
type AgentPaths = {
|
|
10
|
+
mcp: string;
|
|
11
|
+
skill?: string;
|
|
12
|
+
};
|
|
13
|
+
export type AgentAdapter = {
|
|
14
|
+
id: string;
|
|
15
|
+
executable: string | readonly string[];
|
|
16
|
+
scopes?: readonly AgentScope[];
|
|
17
|
+
detectionDirectories(context: AgentContext): string[];
|
|
18
|
+
paths(scope: AgentScope, context: AgentContext): AgentPaths | Promise<AgentPaths>;
|
|
19
|
+
configure(path: string, text: string | undefined, launch: McpLaunch): string;
|
|
20
|
+
instructions: string;
|
|
21
|
+
};
|
|
22
|
+
declare function opencodePaths(scope: AgentScope, context: AgentContext): Promise<AgentPaths>;
|
|
23
|
+
declare function copilotPaths(scope: AgentScope, context: AgentContext): Promise<AgentPaths>;
|
|
24
|
+
export declare const agentAdapters: readonly [{
|
|
25
|
+
readonly id: "codex";
|
|
26
|
+
readonly executable: "codex";
|
|
27
|
+
readonly detectionDirectories: ({ cwd, home, env }: AgentContext) => string[];
|
|
28
|
+
readonly paths: (scope: AgentScope, { cwd, home, env }: AgentContext) => {
|
|
29
|
+
mcp: string;
|
|
30
|
+
skill: string;
|
|
31
|
+
};
|
|
32
|
+
readonly configure: (path: string, text: string | undefined, launch: McpLaunch) => string;
|
|
33
|
+
readonly instructions: "Codex: trust the project if using project scope, start a new session, and check /mcp.";
|
|
34
|
+
}, {
|
|
35
|
+
readonly id: "claude";
|
|
36
|
+
readonly executable: "claude";
|
|
37
|
+
readonly detectionDirectories: ({ cwd, home, env }: AgentContext) => string[];
|
|
38
|
+
readonly paths: (scope: AgentScope, { cwd, home, env }: AgentContext) => {
|
|
39
|
+
mcp: string;
|
|
40
|
+
skill: string;
|
|
41
|
+
};
|
|
42
|
+
readonly configure: (path: string, text: string | undefined, launch: McpLaunch) => string;
|
|
43
|
+
readonly instructions: "Claude Code: restart and approve the project MCP server if prompted; check /mcp.";
|
|
44
|
+
}, {
|
|
45
|
+
readonly id: "cursor";
|
|
46
|
+
readonly executable: readonly ["cursor", "cursor-agent"];
|
|
47
|
+
readonly detectionDirectories: ({ cwd, home }: AgentContext) => string[];
|
|
48
|
+
readonly paths: (scope: AgentScope, { cwd, home }: AgentContext) => {
|
|
49
|
+
mcp: string;
|
|
50
|
+
skill: string;
|
|
51
|
+
};
|
|
52
|
+
readonly configure: (path: string, text: string | undefined, launch: McpLaunch) => string;
|
|
53
|
+
readonly instructions: "Cursor: restart/reload and check MCP settings.";
|
|
54
|
+
}, {
|
|
55
|
+
readonly id: "vscode";
|
|
56
|
+
readonly executable: "code";
|
|
57
|
+
readonly detectionDirectories: (context: AgentContext) => string[];
|
|
58
|
+
readonly paths: (scope: AgentScope, context: AgentContext) => {
|
|
59
|
+
mcp: string;
|
|
60
|
+
skill: string;
|
|
61
|
+
};
|
|
62
|
+
readonly configure: (path: string, text: string | undefined, launch: McpLaunch) => string;
|
|
63
|
+
readonly instructions: "VS Code: reload the window, trust the workspace, and use MCP: List Servers to start/check lambdadb. Init targets the Local harness and the default user profile, not portable Copilot or remote profiles.";
|
|
64
|
+
}, {
|
|
65
|
+
readonly id: "gemini";
|
|
66
|
+
readonly executable: "gemini";
|
|
67
|
+
readonly detectionDirectories: (context: AgentContext) => string[];
|
|
68
|
+
readonly paths: (scope: AgentScope, context: AgentContext) => {
|
|
69
|
+
mcp: string;
|
|
70
|
+
skill: string;
|
|
71
|
+
};
|
|
72
|
+
readonly configure: (path: string, text: string | undefined, launch: McpLaunch) => string;
|
|
73
|
+
readonly instructions: "Gemini CLI: restart or run /mcp refresh and /skills reload, trust the workspace if prompted, and check /mcp and /skills list.";
|
|
74
|
+
}, {
|
|
75
|
+
readonly id: "opencode";
|
|
76
|
+
readonly executable: "opencode";
|
|
77
|
+
readonly detectionDirectories: (context: AgentContext) => string[];
|
|
78
|
+
readonly paths: typeof opencodePaths;
|
|
79
|
+
readonly configure: (path: string, text: string | undefined, launch: McpLaunch) => string;
|
|
80
|
+
readonly instructions: "OpenCode: restart and run opencode mcp list. Init preserves existing V2 mcp.servers maps; new files use V1 syntax supported by V1 and V2. Custom config files and organization policies may override these settings.";
|
|
81
|
+
}, {
|
|
82
|
+
readonly id: "copilot";
|
|
83
|
+
readonly executable: "copilot";
|
|
84
|
+
readonly detectionDirectories: (context: AgentContext) => string[];
|
|
85
|
+
readonly paths: typeof copilotPaths;
|
|
86
|
+
readonly configure: (path: string, text: string | undefined, launch: McpLaunch) => string;
|
|
87
|
+
readonly instructions: "GitHub Copilot CLI: restart from the environment holding the selected key, trust the repository, then check /mcp and run /skills reload. Project MCP settings override user settings.";
|
|
88
|
+
}, {
|
|
89
|
+
readonly id: "kiro";
|
|
90
|
+
readonly executable: readonly ["kiro", "kiro-cli"];
|
|
91
|
+
readonly detectionDirectories: ({ cwd, home }: AgentContext) => string[];
|
|
92
|
+
readonly paths: (scope: AgentScope, { cwd, home }: AgentContext) => {
|
|
93
|
+
mcp: string;
|
|
94
|
+
skill: string;
|
|
95
|
+
};
|
|
96
|
+
readonly configure: (path: string, text: string | undefined, launch: McpLaunch) => string;
|
|
97
|
+
readonly instructions: "Kiro IDE/CLI: restart from the environment holding the selected key and check /mcp. Approve the selected variable in Mcp Approved Env Vars when prompted. Custom agents must include the MCP JSON and skill resources; init does not alter agent permissions or definitions.";
|
|
98
|
+
}, {
|
|
99
|
+
readonly id: "cline";
|
|
100
|
+
readonly executable: readonly [];
|
|
101
|
+
readonly scopes: readonly ["user"];
|
|
102
|
+
readonly detectionDirectories: (context: AgentContext) => string[];
|
|
103
|
+
readonly paths: (_scope: AgentScope, context: AgentContext) => {
|
|
104
|
+
mcp: string;
|
|
105
|
+
skill: string;
|
|
106
|
+
};
|
|
107
|
+
readonly configure: (path: string, text: string | undefined, launch: McpLaunch) => string;
|
|
108
|
+
readonly instructions: "Cline VS Code extension: reload VS Code from the environment holding the selected key and check MCP Servers and the Skills menu. Init targets the default stable VS Code profile, not Cline CLI or other editors/profiles. No tools are auto-approved.";
|
|
109
|
+
}];
|
|
110
|
+
export type Agent = typeof agentAdapters[number]['id'];
|
|
111
|
+
export declare const agentNames: string;
|
|
112
|
+
export declare function detectAgents(context: AgentContext): Promise<Agent[]>;
|
|
113
|
+
export {};
|