mirror of
https://github.com/iflytek/skillhub.git
synced 2026-11-16 09:21:18 +00:00
Some checks failed
Deploy Docs / build (push) Has been cancelled
Security / Dependency Review (push) Has been cancelled
Security / CodeQL (java-kotlin) (push) Has been cancelled
Security / CodeQL (javascript-typescript) (push) Has been cancelled
Security / CodeQL (python) (push) Has been cancelled
Deploy Docs / Deploy (push) Has been cancelled
Add the native SkillHub plugin for DeepSeek Harness with a scoped skill center, conversation search/install tools, exact-version installation and protected lifecycle management. Prepare the independently versioned 0.1.0 npm candidate with an empty default Registry and documented compatibility limits. Keep formal specifications and executable regression tests; remove archived development screenshots and runtime reports from the final tree. Review fixes cover independent scopes, installed references, pre-staging recovery and idempotent discovery. Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>
29 lines
1.9 KiB
TypeScript
29 lines
1.9 KiB
TypeScript
import { expect, test } from 'bun:test';
|
|
import { RemoteError } from '@deepseek-ai/dsh-typert-protocol';
|
|
import { installationFailureCode } from '../src/host/installation-failure.js';
|
|
import { parseInstallFailure, parseInstallResult } from '../src/client/install-result.js';
|
|
|
|
test('known Host errors map to bounded failure codes without carrying diagnostics', () => {
|
|
for (const [code, expected] of [
|
|
['skillhub/context-stale', 'CONTEXT_STALE'], ['HOST_MISMATCH', 'CONTEXT_STALE'],
|
|
['REQUEST_KEY_CONFLICT', 'REQUEST_CONFLICT'], ['skillhub/request-conflict', 'REQUEST_CONFLICT'],
|
|
['skillhub/source-not-configured', 'SOURCE_NOT_CONFIGURED'], ['skillhub/target-unavailable', 'TARGET_UNAVAILABLE'],
|
|
['unexpected', 'UNCONFIRMED'],
|
|
] as const) expect(installationFailureCode({ code, message: '/private secret' })).toBe(expected);
|
|
for (const [reason, expected] of [['ANONYMOUS_DENIED', 'SOURCE_DENIED'], ['NOT_FOUND', 'SKILL_UNAVAILABLE'],
|
|
['RATE_LIMITED', 'RATE_LIMITED'], ['NETWORK_ERROR', 'SOURCE_UNAVAILABLE']] as const) {
|
|
expect(installationFailureCode(new RemoteError('skillhub/registry-error', '/private diagnostic', { reason, retryable: false }))).toBe(expected);
|
|
}
|
|
expect(installationFailureCode(null)).toBe('UNCONFIRMED');
|
|
expect(installationFailureCode(new Error('secret'))).toBe('UNCONFIRMED');
|
|
});
|
|
|
|
test('failure history cannot be treated as acceptance or introduce an arbitrary diagnostic', () => {
|
|
const failure = { schemaVersion: 1, kind: 'skillhub-install', status: 'not-confirmed', toolCallId: 'call', code: 'REQUEST_CONFLICT' } as const;
|
|
expect(parseInstallFailure(failure)).toEqual(failure);
|
|
expect(parseInstallResult(failure)).toBeUndefined();
|
|
for (const value of [{ ...failure, code: '/private' }, { ...failure, message: 'secret' },
|
|
{ ...failure, operationId: 'fake' }, { ...failure, schemaVersion: 2 }, null]) {
|
|
expect(parseInstallFailure(value)).toBeUndefined();
|
|
}
|
|
});
|