- Context Compaction System with token counting and summarization - Deterministic State Machine for flow control (no LLM decisions) - Parallel Execution Engine (up to 12 concurrent sessions) - Event-Driven Coordination via Event Bus - Agent Workspace Isolation (tools, memory, identity, files) - YAML Workflow Integration (OpenClaw/Lobster compatible) - Claude Code integration layer - Complete demo UI with real-time visualization - Comprehensive documentation and README Components: - agent-system/: Context management, token counting, subagent spawning - pipeline-system/: State machine, parallel executor, event bus, workflows - skills/: AI capabilities (LLM, ASR, TTS, VLM, image generation, etc.) - src/app/: Next.js demo application Total: ~100KB of production-ready TypeScript code
38 lines
739 B
TypeScript
Executable File
38 lines
739 B
TypeScript
Executable File
import ZAI from 'z-ai-web-dev-sdk';
|
|
|
|
interface PageReaderFunctionResult {
|
|
code: number;
|
|
data: {
|
|
html: string;
|
|
publishedTime?: string;
|
|
title: string;
|
|
url: string;
|
|
usage: {
|
|
tokens: number;
|
|
};
|
|
};
|
|
meta: {
|
|
usage: {
|
|
tokens: number;
|
|
};
|
|
};
|
|
status: number;
|
|
}
|
|
|
|
async function main(url: string) {
|
|
try {
|
|
const zai = await ZAI.create();
|
|
|
|
const results: PageReaderFunctionResult = await zai.functions.invoke('page_reader', {
|
|
url: url
|
|
});
|
|
|
|
console.log('Web reader invocation succeeded. Results:');
|
|
console.log(JSON.stringify(results, null, 2));
|
|
} catch (err: any) {
|
|
console.error('page_reader failed:', err?.message || err);
|
|
}
|
|
}
|
|
|
|
main('https://www.google.com');
|