mirror of
https://github.com/iflytek/skillhub.git
synced 2026-11-15 09:11: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>
18 lines
1.2 KiB
TypeScript
18 lines
1.2 KiB
TypeScript
import { expect, test } from 'bun:test';
|
|
import { randomUUID } from 'node:crypto';
|
|
import { installRequest, operationQuery } from '../src/host/install-request.js';
|
|
|
|
const input = { detailToken: 'detail', targetToken: 'target', requestKey: randomUUID(), hostInstanceId: randomUUID(),
|
|
mode: 'new' as const, initiatedFrom: 'plaza' as const };
|
|
|
|
test('installation wire validation rejects paths, malformed identities and unbounded references', () => {
|
|
expect(installRequest.parse(input)).toEqual(input);
|
|
for (const value of [null, {}, { ...input, path: '/tmp/untrusted' }, { ...input, downloadUrl: 'https://other.example' },
|
|
{ ...input, requestKey: 'invalid' }, { ...input, hostInstanceId: '' }, { ...input, detailToken: '' },
|
|
{ ...input, targetToken: 'x'.repeat(2049) }, { ...input, mode: 'force' }, { ...input, initiatedFrom: 'shell' }]) {
|
|
expect(installRequest.safeParse(value).success).toBe(false);
|
|
}
|
|
expect(installRequest.parse({ ...input, mode: 'retry' }).requestKey).toBe(input.requestKey);
|
|
expect(operationQuery.safeParse({ operationId: randomUUID(), hostInstanceId: input.hostInstanceId }).success).toBe(true);
|
|
expect(operationQuery.safeParse({ operationId: '../../private', hostInstanceId: input.hostInstanceId }).success).toBe(false);
|
|
});
|