feat: Add complete Agentic Compaction & Pipeline System
- 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
This commit is contained in:
28
skills/image-generation/scripts/image-generation.ts
Executable file
28
skills/image-generation/scripts/image-generation.ts
Executable file
@@ -0,0 +1,28 @@
|
||||
import ZAI from 'z-ai-web-dev-sdk';
|
||||
import fs from 'fs';
|
||||
|
||||
async function main(prompt: string, size: '1024x1024' | '768x1344' | '864x1152' | '1344x768' | '1152x864' | '1440x720' | '720x1440', outFile: string) {
|
||||
try {
|
||||
const zai = await ZAI.create();
|
||||
|
||||
const response = await zai.images.generations.create({
|
||||
prompt,
|
||||
size
|
||||
});
|
||||
|
||||
const base64 = response?.data?.[0]?.base64;
|
||||
if (!base64) {
|
||||
console.error('No image data returned by the API');
|
||||
console.log('Full response:', JSON.stringify(response, null, 2));
|
||||
return;
|
||||
}
|
||||
|
||||
const buffer = Buffer.from(base64, 'base64');
|
||||
fs.writeFileSync(outFile, buffer);
|
||||
console.log(`Image saved to ${outFile}`);
|
||||
} catch (err: any) {
|
||||
console.error('Image generation failed:', err?.message || err);
|
||||
}
|
||||
}
|
||||
|
||||
main('A cute kitten', '1024x1024', './output.png');
|
||||
Reference in New Issue
Block a user