首页龙虾技能列表 › Ainative Svelte Sdk — 技能工具

Ainative Svelte Sdk — 技能工具

v1.0.0

Use @ainative/svelte-sdk to add AI chat to Svelte/SvelteKit apps. Use when (1) Installing @ainative/svelte-sdk, (2) Using Svelte stores for chat state, (3) C...

0· 73·1 当前·1 累计
by @urbantech (Toby Morning)·MIT-0
下载技能包
License
MIT-0
最后更新
2026/3/24
安全扫描
VirusTotal
Pending
查看报告
OpenClaw
可疑
medium confidence
The SKILL.md describes a Svelte SDK that legitimately needs an AINative API key, but the skill metadata declares no required environment variables — a coherence gap that looks like sloppy or incomplete packaging and should be clarified before trusting/installation.
评估建议
This skill's docs look like a normal Svelte SDK, but the metadata omitted the environment variables that the docs require. Before installing or wiring this into production: (1) verify the npm package and publisher (is @ainative/svelte-sdk actually published under the expected owner?), (2) inspect the package source/repository and package contents to confirm there is no unexpected behavior, (3) ensure you only store the real API key server-side (AINATIVE_API_KEY in SvelteKit $env/static/private) ...
详细分析 ▾
用途与能力
The name/description (Svelte SDK for adding AI chat) match the instructions: creating Svelte stores, calling an AINative chat endpoint, and recommending server routes. The functionality described plausibly requires an AINative API key and outbound network access to api.ainative.studio.
指令范围
SKILL.md stays within the stated purpose: it shows installing the npm package, setting configuration with import.meta.env, and a recommended server route that posts to https://api.ainative.studio/v1/public/chat/completions. It also explicitly warns not to expose API keys client-side, which is appropriate. No instructions request unrelated files, credentials, or system state.
安装机制
This is an instruction-only skill with no install spec and no bundled code—lowest-risk delivery. It instructs using npm to install @ainative/svelte-sdk (expected for a JS SDK) but does not perform any downloads itself.
凭证需求
SKILL.md references two environment variables (VITE_AINATIVE_API_KEY for client builds and AINATIVE_API_KEY for server-side use) but the skill metadata lists no required env vars or primary credential. The SDK legitimately needs at least a server API key; the metadata omission is an incoherence that reduces transparency and should be corrected. Otherwise the credentials requested in the docs are proportional to the purpose.
持久化与权限
The skill is not always-enabled, does not request elevated persistence, and contains no instructions to modify other skills or agent settings. Autonomous invocation is allowed (platform default) but there is no extra privilege requested.
安全有层次,运行前请审查代码。

License

MIT-0

可自由使用、修改和再分发,无需署名。

运行时依赖

无特殊依赖

版本

latestv1.0.02026/3/24

ainative-svelte-sdk v1.0.0 initial release - Adds Svelte store utilities for integrating AINative chat into Svelte/SvelteKit apps. - Provides createChatStore for reactive chat state, handling messages, loading, and errors. - Includes setAINativeConfig for global API setup. - Documents recommended setup for both client and secure server-side usage. - Type exports for Message, ChatState, and AINativeError.

● Pending

安装命令 点击复制

官方npx clawhub@latest install ainative-svelte-sdk
镜像加速npx clawhub@latest install ainative-svelte-sdk --registry https://cn.clawhub-mirror.com

技能文档

Svelte stores and utilities for AINative chat completions.

Install

npm install @ainative/svelte-sdk

Configure

// src/lib/ainative.ts
import { setAINativeConfig } from '@ainative/svelte-sdk';

setAINativeConfig({ apiKey: import.meta.env.VITE_AINATIVE_API_KEY, baseUrl: 'https://api.ainative.studio', });

Call this once in your app root (+layout.svelte or App.svelte).

createChatStore


{#each $chat.messages as msg}

{msg.role}: {msg.content}
{/each}

{#if $chat.isLoading}

Thinking...

{/if}

{#if $chat.error}

Error: {$chat.error.message}

{/if}

e.key === 'Enter' && send()} />

Store Shape

$chat is a reactive store with this shape:

FieldTypeDescription
messagesMessage[]Full conversation history
isLoadingbooleanTrue while request in flight
errorAINativeError \nullLast error

createChatStore Options

OptionTypeDefaultDescription
modelstringModel ID
initialMessagesMessage[][]Seed conversation

SvelteKit — Server Route

For server-side calls, use the raw API directly (no browser auth exposure):

// src/routes/api/chat/+server.ts
import { AINATIVE_API_KEY } from '$env/static/private';
import type { RequestHandler } from './$types';

export const POST: RequestHandler = async ({ request }) => { const { messages } = await request.json();

const resp = await fetch('https://api.ainative.studio/v1/public/chat/completions', { method: 'POST', headers: { 'X-API-Key': AINATIVE_API_KEY, 'Content-Type': 'application/json', }, body: JSON.stringify({ model: 'claude-3-5-sonnet-20241022', messages, }), });

return new Response(resp.body, { headers: { 'Content-Type': 'application/json' }, }); };

Environment Variables

# .env
VITE_AINATIVE_API_KEY=ak_your_key         # Client-safe (public key only)
AINATIVE_API_KEY=ak_your_key              # Server-side (SvelteKit $env/static/private)
Use server routes for production — never expose API keys in client bundles.

Exports

import {
  createChatStore,
  setAINativeConfig,
  ainativeConfig,
  type Message,
  type ChatState,
  type AINativeError,
} from '@ainative/svelte-sdk';

References

  • packages/sdks/svelte/src/stores/chat.ts — Chat store implementation
  • packages/sdks/svelte/src/stores/config.ts — Config store
  • packages/sdks/svelte/src/index.ts — Package exports
数据来源:ClawHub ↗ · 中文优化:龙虾技能库
OpenClaw 技能定制 / 插件定制 / 私有工作流定制

免费技能或插件可能存在安全风险,如需更匹配、更安全的方案,建议联系付费定制

了解定制服务