feat: prepare Zhinian desktop client for pilot release

This commit is contained in:
inman
2026-04-29 10:23:20 +08:00
parent f9361e686a
commit 47b83b79fc
149 changed files with 15341 additions and 3590 deletions

View File

@@ -0,0 +1,12 @@
{
"name": "@yinian/kernel-adapter-openclaw",
"version": "0.1.0",
"private": true,
"type": "module",
"main": "./src/index.ts",
"types": "./src/index.ts",
"dependencies": {
"@yinian/kernel-core": "workspace:*"
}
}

View File

@@ -0,0 +1,81 @@
import type {
Adapter,
AdapterFactory,
Conversation,
ConversationId,
ConversationPort,
ConversationStreamEvent,
CreateConversationInput,
Message,
SendMessageInput,
} from '@yinian/kernel-core';
export interface OpenClawAdapterConfig {
wsUrl: string;
token: string;
reconnect?: {
maxAttempts: number;
backoffMs: number;
};
}
class NotImplementedConversationPort implements ConversationPort {
async list(): Promise<Conversation[]> {
return [];
}
async get(_id: ConversationId): Promise<Conversation> {
throw new Error('OpenClaw conversation.get adapter is not implemented yet.');
}
async create(_input: CreateConversationInput): Promise<Conversation> {
throw new Error('OpenClaw conversation.create adapter is not implemented yet.');
}
async delete(_id: ConversationId): Promise<void> {
throw new Error('OpenClaw conversation.delete adapter is not implemented yet.');
}
async *send(_input: SendMessageInput): AsyncIterable<ConversationStreamEvent> {
yield {
type: 'error',
error: {
code: 'kernel_unavailable',
message: 'OpenClaw conversation.send adapter is not implemented yet.',
retryable: false,
},
};
}
async abort(_conversationId: ConversationId): Promise<void> {
throw new Error('OpenClaw conversation.abort adapter is not implemented yet.');
}
async history(_conversationId: ConversationId): Promise<Message[]> {
return [];
}
}
export const createOpenClawAdapter: AdapterFactory<OpenClawAdapterConfig> = (config): Adapter => {
const conversation = new NotImplementedConversationPort();
return {
info: { name: 'openclaw', kernelVersion: 'unknown' },
async connect() {
if (!config.wsUrl || !config.token) {
throw new Error('OpenClaw adapter requires wsUrl and token.');
}
},
async disconnect() {
// No persistent socket yet. The real implementation lands with the Gateway contract.
},
async health() {
return {
ready: false,
details: { wsUrl: config.wsUrl, reason: 'adapter_stub' },
};
},
conversation,
};
};