Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dsh-plugin-xquant",
"version": "0.1.0",
"version": "0.1.1",
"packageManager": "pnpm@10.33.0",
"description": "One-command xquant MCP integration for DeepSeek Harness",
"type": "module",
Expand Down
17 changes: 14 additions & 3 deletions scripts/smoke.mjs
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { execFileSync } from 'node:child_process'
import { execFileSync, spawnSync } from 'node:child_process'
import { mkdtempSync, readFileSync } from 'node:fs'
import { tmpdir } from 'node:os'
import { join } from 'node:path'

const workspace = mkdtempSync(join(tmpdir(), 'dsh-plugin-xquant-'))
const packageVersion = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8')).version

execFileSync('pnpm', ['pack', '--pack-destination', workspace], { stdio: 'inherit' })
const tarball = join(workspace, 'dsh-plugin-xquant-0.1.0.tgz')
const tarball = join(workspace, `dsh-plugin-xquant-${packageVersion}.tgz`)
const environment = { ...process.env, DSH_HOME: join(workspace, 'home') }
execFileSync('pnpm', ['dlx', '@deepseek-ai/dsh@0.1.0-rc.7', 'plugin', '--profile', 'web', 'add', tarball], {
stdio: 'inherit',
Expand All @@ -19,4 +20,14 @@ if (manifest.dependencies?.['dsh-plugin-xquant'] === undefined
throw new Error('dsh did not register dsh-plugin-xquant as a web-profile bundle')
}

console.log('dsh plugin install smoke passed')
const boot = spawnSync('pnpm', ['dlx', '@deepseek-ai/dsh@0.1.0-rc.7', '--profile', 'web', '--no-open', '--port', '0'], {
encoding: 'utf8',
env: environment,
timeout: 8_000,
})
const bootOutput = `${boot.stdout}${boot.stderr}`
if (!bootOutput.includes('dsh web: http://')) {
throw new Error(`dsh web failed to start after plugin installation:\n${bootOutput}`)
}

console.log('dsh plugin install and boot smoke passed')
4 changes: 4 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ export function xquantMcpUrl(origin = process.env.XQUANT_MCP_ORIGIN): string {

export const name = 'xquant'

// Cordis only exposes services that a plugin declares up front. Keep this
// explicit so the prompt section works when loaded from a dsh profile bundle.
export const inject = ['systemPrompt']

export async function apply(ctx: Context): Promise<void> {
ctx.effect(() => ctx.systemPrompt.section({
name: 'xquant:research-guidance',
Expand Down
6 changes: 5 additions & 1 deletion tests/plugin.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { readFileSync } from 'node:fs'
import { describe, expect, it, vi } from 'vitest'

import { apply, RESEARCH_GUIDANCE, xquantMcpUrl } from '../src/index.js'
import { apply, inject, RESEARCH_GUIDANCE, xquantMcpUrl } from '../src/index.js'

describe('xquant MCP endpoint', () => {
it('uses the official endpoint when no override is supplied', () => {
Expand All @@ -23,6 +23,10 @@ describe('xquant MCP endpoint', () => {
})

describe('Cordis plugin', () => {
it('declares the system prompt service required by apply', () => {
expect(inject).toEqual(['systemPrompt'])
})

it('registers the research prompt without mounting a second MCP client', async () => {
const ctx = {
effect: vi.fn((effect: () => unknown) => effect()),
Expand Down
Loading