@aiwayds/dsh-opentui 0.9.3 → 0.9.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 +49 -0
- package/README.md +34 -4
- package/dist/client/index.js +8466 -7787
- package/package.json +1 -1
- package/scripts/lib/provision-plan.mjs +62 -0
- package/scripts/provision-opentui-profile.mjs +18 -4
package/package.json
CHANGED
|
@@ -45,6 +45,12 @@ export const PLUGIN_SET = [
|
|
|
45
45
|
tier: 'core',
|
|
46
46
|
reason: 'web search without a per-provider key',
|
|
47
47
|
},
|
|
48
|
+
{
|
|
49
|
+
name: '@aiwayds/dsh-mcp-adapter',
|
|
50
|
+
version: '0.8.0',
|
|
51
|
+
tier: 'core',
|
|
52
|
+
reason: 'MCP catalog/dispatch meta-tools paired with the default context7 server row',
|
|
53
|
+
},
|
|
48
54
|
{
|
|
49
55
|
name: '@aiwayds/dsh-approval-policy',
|
|
50
56
|
version: '0.3.0',
|
|
@@ -441,6 +447,62 @@ export function planToolPatch(existingText = '') {
|
|
|
441
447
|
}
|
|
442
448
|
}
|
|
443
449
|
|
|
450
|
+
// ---------------------------------------------------------------------------
|
|
451
|
+
// Profile patch rows for MCP (adapter + one default server)
|
|
452
|
+
//
|
|
453
|
+
// @aiwayds/dsh-mcp-adapter is a prompt-side shim over the official
|
|
454
|
+
// @deepseek-ai/dsh-mcp-client: the client owns the connection and registers
|
|
455
|
+
// `mcp__<server>__<tool>` on ctx.tools, the adapter exposes the constant
|
|
456
|
+
// `mcp_list` / `mcp_call` meta-tools on top of those registrations. Without at
|
|
457
|
+
// least one client row the adapter's catalog is empty, so the pair ships
|
|
458
|
+
// together: the plugin set installs the adapter, and this row starts one
|
|
459
|
+
// server.
|
|
460
|
+
//
|
|
461
|
+
// The row is INSIDE an `- insert:` list (the same form the tui profile uses),
|
|
462
|
+
// so the id check must match nested entries — the top-level `patchEntryBlock`
|
|
463
|
+
// deliberately does not. Detection is by id alone: an existing
|
|
464
|
+
// `mcp-context7` row is the user's (possibly edited) row and is never
|
|
465
|
+
// rewritten or duplicated. `--plugins=none` writes no row at all: without the
|
|
466
|
+
// adapter the client's tools would surface unfolded, which is not the
|
|
467
|
+
// promised setup.
|
|
468
|
+
//
|
|
469
|
+
// context7 is the default server because it needs no API key, starts fast
|
|
470
|
+
// over streamable HTTP, and is read-only documentation lookup. A failed or
|
|
471
|
+
// offline connection is non-fatal by contract: mcp-client's
|
|
472
|
+
// `failOnStartupError` defaults to false and the host boots without its tools.
|
|
473
|
+
// ---------------------------------------------------------------------------
|
|
474
|
+
export const MCP_CONTEXT7_PATCH = `- insert:
|
|
475
|
+
- id: mcp-context7
|
|
476
|
+
name: '@deepseek-ai/dsh-mcp-client'
|
|
477
|
+
config:
|
|
478
|
+
serverName: context7
|
|
479
|
+
transport: streamable-http
|
|
480
|
+
url: https://mcp.context7.com/mcp
|
|
481
|
+
`
|
|
482
|
+
|
|
483
|
+
/** True when `<id>` appears as a patch row at ANY indentation (top-level id
|
|
484
|
+
* entries and rows nested under `- insert:`). */
|
|
485
|
+
export function hasAnyEntry(text, id) {
|
|
486
|
+
return new RegExp(`^[ \\t]*- id: ${escapeRegExp(id)}[ \\t]*$`, 'm').test(String(text ?? ''))
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
/**
|
|
490
|
+
* Plan the MCP client row a profile patch still needs. Pure.
|
|
491
|
+
*
|
|
492
|
+
* @param {string} existingText
|
|
493
|
+
* @param {{enabled?: boolean}} options `enabled: false` is `--plugins=none`.
|
|
494
|
+
* @returns {{append: string[], mcp: 'configured'|'missing'|'skipped', changed: boolean}}
|
|
495
|
+
*/
|
|
496
|
+
export function planMcpPatch(existingText = '', { enabled = true } = {}) {
|
|
497
|
+
const present = hasAnyEntry(existingText, 'mcp-context7')
|
|
498
|
+
if (!enabled) return { append: [], mcp: 'skipped', changed: false }
|
|
499
|
+
return {
|
|
500
|
+
append: present ? [] : [MCP_CONTEXT7_PATCH],
|
|
501
|
+
mcp: present ? 'configured' : 'missing',
|
|
502
|
+
changed: !present,
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
|
|
444
506
|
// ---------------------------------------------------------------------------
|
|
445
507
|
// Verify (dsh opentui --dump-config)
|
|
446
508
|
// ---------------------------------------------------------------------------
|
|
@@ -20,7 +20,10 @@
|
|
|
20
20
|
// it disabled and the `native` preset never turns it
|
|
21
21
|
// back on) and pins `web.searchProvider` to anysearch —
|
|
22
22
|
// with or without a plugin tier: this is what makes
|
|
23
|
-
// `web_search` visible to the model.
|
|
23
|
+
// `web_search` visible to the model. It also inserts
|
|
24
|
+
// the default `mcp-context7` client row (streamable
|
|
25
|
+
// HTTP, no key) so the MCP adapter's mcp_list has a
|
|
26
|
+
// server to catalog; skipped under `--plugins=none`.
|
|
24
27
|
// [3/5] plugins — install the default plugin set when a plugin is not
|
|
25
28
|
// already satisfied (see lib/provision-plan.mjs for the
|
|
26
29
|
// table and the idempotency rule). `--plugins=core`
|
|
@@ -73,6 +76,7 @@ import {
|
|
|
73
76
|
mergeBundles,
|
|
74
77
|
parseDumpConfig,
|
|
75
78
|
parseTier,
|
|
79
|
+
planMcpPatch,
|
|
76
80
|
planPluginInstall,
|
|
77
81
|
planToolPatch,
|
|
78
82
|
pluginAddArgs,
|
|
@@ -253,10 +257,15 @@ const missingRoute = [
|
|
|
253
257
|
// re-enabling `tool-web` and pinning the provider are what make `web_search`
|
|
254
258
|
// visible, and the anysearch bundle only installs the provider behind it.
|
|
255
259
|
const toolPatch = planToolPatch(existingPatch)
|
|
256
|
-
|
|
260
|
+
// The default MCP server row rides the adapter, so it is tier-scoped:
|
|
261
|
+
// `--plugins=none` installs neither and writes neither (the client alone
|
|
262
|
+
// would surface unfolded `mcp__*` schemas, which is not the promised setup).
|
|
263
|
+
const mcpPatch = planMcpPatch(existingPatch, { enabled: tier !== 'none' })
|
|
264
|
+
const pendingPatchEntries = missingRoute.length + toolPatch.append.length + mcpPatch.append.length
|
|
257
265
|
// Stable state suffix for the progress line (task-visible on a dry run too).
|
|
258
266
|
const webState = `; tool-web ${toolPatch.toolWeb === 'enabled' ? 'enabled' : 'to enable'}, ` +
|
|
259
|
-
`web search ${toolPatch.web === 'pinned' ? 'pinned' : 'to pin anysearch'}`
|
|
267
|
+
`web search ${toolPatch.web === 'pinned' ? 'pinned' : 'to pin anysearch'}, ` +
|
|
268
|
+
`mcp context7 ${mcpPatch.mcp === 'configured' ? 'configured' : mcpPatch.mcp === 'missing' ? 'to add' : 'skipped (--plugins=none)'}`
|
|
260
269
|
|
|
261
270
|
if (pendingPatchEntries === 0) {
|
|
262
271
|
say(2, 'model route', `${provider}/${model} (already pinned)${webState}`)
|
|
@@ -273,7 +282,12 @@ if (pendingPatchEntries === 0) {
|
|
|
273
282
|
`provision-opentui-profile.mjs — anysearch needs no key; tool-web is disabled by ` +
|
|
274
283
|
`@deepseek-ai/dsh-web-app and re-enabled here):\n`
|
|
275
284
|
: ''
|
|
276
|
-
const
|
|
285
|
+
const mcpBanner = mcpPatch.append.length > 0
|
|
286
|
+
? `${missingRoute.length > 0 || toolPatch.append.length > 0 ? '\n' : ''}# MCP (managed by ` +
|
|
287
|
+
`provision-opentui-profile.mjs — the adapter's mcp_list/mcp_call need a client row; ` +
|
|
288
|
+
`context7 needs no key and a failed/offline connection is non-fatal):\n`
|
|
289
|
+
: ''
|
|
290
|
+
const patchBody = `${routeBanner}${routeBody}${webBanner}${toolPatch.append.join('')}${mcpBanner}${mcpPatch.append.join('')}`
|
|
277
291
|
const backupPatch = () => {
|
|
278
292
|
if (!existingPatch) return
|
|
279
293
|
const backupPath = `${patchPath}.bak-${Date.now()}`
|