@agentskit/cli 0.9.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.cjs +313 -2
- package/dist/bin.cjs.map +1 -1
- package/dist/bin.js +1 -1
- package/dist/{chunk-ZEESHYST.js → chunk-I5P3Y7NG.js} +315 -4
- package/dist/chunk-I5P3Y7NG.js.map +1 -0
- package/dist/index.cjs +313 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +3 -3
- package/dist/chunk-ZEESHYST.js.map +0 -1
package/dist/bin.js
CHANGED
|
@@ -2448,6 +2448,311 @@ out
|
|
|
2448
2448
|
"README.md": readmeFor(ctx)
|
|
2449
2449
|
};
|
|
2450
2450
|
}
|
|
2451
|
+
function expoStarter(ctx) {
|
|
2452
|
+
const deps = {
|
|
2453
|
+
expo: "^54.0.0",
|
|
2454
|
+
"expo-router": "^7.0.0",
|
|
2455
|
+
"expo-secure-store": "^15.0.0",
|
|
2456
|
+
react: "^19.0.0",
|
|
2457
|
+
"react-native": "^0.84.0"
|
|
2458
|
+
};
|
|
2459
|
+
if (ctx.provider !== "demo") deps["@agentskit/adapters"] = "^0.4.0";
|
|
2460
|
+
const adapterCallStr = adapterCall(ctx.provider);
|
|
2461
|
+
const adapterImport2 = ctx.provider === "demo" ? "" : `import { ${PROVIDER_IMPORT[ctx.provider]} } from '@agentskit/adapters'
|
|
2462
|
+
`;
|
|
2463
|
+
const demoSnippet = ctx.provider === "demo" ? demoAdapterSnippet() : "";
|
|
2464
|
+
return {
|
|
2465
|
+
"package.json": JSON.stringify(
|
|
2466
|
+
{
|
|
2467
|
+
name: "agentskit-expo-app",
|
|
2468
|
+
version: "1.0.0",
|
|
2469
|
+
main: "expo-router/entry",
|
|
2470
|
+
scripts: {
|
|
2471
|
+
start: "expo start",
|
|
2472
|
+
android: "expo start --android",
|
|
2473
|
+
ios: "expo start --ios",
|
|
2474
|
+
web: "expo start --web"
|
|
2475
|
+
},
|
|
2476
|
+
dependencies: deps,
|
|
2477
|
+
devDependencies: {
|
|
2478
|
+
"@types/react": "^19.0.0",
|
|
2479
|
+
typescript: "^5.5.0"
|
|
2480
|
+
}
|
|
2481
|
+
},
|
|
2482
|
+
null,
|
|
2483
|
+
2
|
|
2484
|
+
) + "\n",
|
|
2485
|
+
"app.json": JSON.stringify(
|
|
2486
|
+
{
|
|
2487
|
+
expo: {
|
|
2488
|
+
name: "AgentsKit Expo Starter",
|
|
2489
|
+
slug: "agentskit-expo",
|
|
2490
|
+
scheme: "agentskit",
|
|
2491
|
+
plugins: ["expo-router", "expo-secure-store"],
|
|
2492
|
+
ios: { bundleIdentifier: "com.example.agentskit" },
|
|
2493
|
+
android: { package: "com.example.agentskit" }
|
|
2494
|
+
}
|
|
2495
|
+
},
|
|
2496
|
+
null,
|
|
2497
|
+
2
|
|
2498
|
+
) + "\n",
|
|
2499
|
+
"tsconfig.json": JSON.stringify(
|
|
2500
|
+
{ extends: "expo/tsconfig.base", compilerOptions: { strict: true } },
|
|
2501
|
+
null,
|
|
2502
|
+
2
|
|
2503
|
+
) + "\n",
|
|
2504
|
+
"app/_layout.tsx": `import { Stack } from 'expo-router'
|
|
2505
|
+
import { AuthProvider } from '../lib/auth'
|
|
2506
|
+
|
|
2507
|
+
export default function RootLayout() {
|
|
2508
|
+
return (
|
|
2509
|
+
<AuthProvider>
|
|
2510
|
+
<Stack />
|
|
2511
|
+
</AuthProvider>
|
|
2512
|
+
)
|
|
2513
|
+
}
|
|
2514
|
+
`,
|
|
2515
|
+
"app/index.tsx": `import { useState } from 'react'
|
|
2516
|
+
import { Text, TextInput, View, Pressable, ScrollView } from 'react-native'
|
|
2517
|
+
import { useAuth } from '../lib/auth'
|
|
2518
|
+
${adapterImport2}${demoSnippet}export default function Chat() {
|
|
2519
|
+
const { token, signIn, signOut } = useAuth()
|
|
2520
|
+
const [messages, setMessages] = useState<{ role: 'user' | 'assistant'; content: string }[]>([])
|
|
2521
|
+
const [input, setInput] = useState('')
|
|
2522
|
+
|
|
2523
|
+
if (!token) {
|
|
2524
|
+
return (
|
|
2525
|
+
<View style={{ flex: 1, justifyContent: 'center', padding: 24 }}>
|
|
2526
|
+
<Text style={{ fontSize: 20, marginBottom: 12 }}>Sign in to chat</Text>
|
|
2527
|
+
<Pressable onPress={() => signIn('demo-token')}><Text>Sign in</Text></Pressable>
|
|
2528
|
+
</View>
|
|
2529
|
+
)
|
|
2530
|
+
}
|
|
2531
|
+
|
|
2532
|
+
async function send() {
|
|
2533
|
+
if (!input.trim()) return
|
|
2534
|
+
const next = [...messages, { role: 'user' as const, content: input }]
|
|
2535
|
+
setMessages(next)
|
|
2536
|
+
setInput('')
|
|
2537
|
+
const adapter = ${adapterCallStr}
|
|
2538
|
+
const source = adapter.createSource({ messages: next.map((m, i) => ({
|
|
2539
|
+
id: String(i), role: m.role, content: m.content,
|
|
2540
|
+
status: 'complete' as const, createdAt: new Date(0),
|
|
2541
|
+
})) })
|
|
2542
|
+
let acc = ''
|
|
2543
|
+
for await (const chunk of source.stream()) {
|
|
2544
|
+
if (chunk.type === 'text') {
|
|
2545
|
+
acc += chunk.content
|
|
2546
|
+
setMessages([...next, { role: 'assistant', content: acc }])
|
|
2547
|
+
}
|
|
2548
|
+
}
|
|
2549
|
+
}
|
|
2550
|
+
|
|
2551
|
+
return (
|
|
2552
|
+
<View style={{ flex: 1, padding: 16 }}>
|
|
2553
|
+
<Pressable onPress={signOut}><Text>Sign out</Text></Pressable>
|
|
2554
|
+
<ScrollView style={{ flex: 1 }}>
|
|
2555
|
+
{messages.map((m, i) => (
|
|
2556
|
+
<Text key={i} style={{ marginVertical: 4 }}>{m.role}: {m.content}</Text>
|
|
2557
|
+
))}
|
|
2558
|
+
</ScrollView>
|
|
2559
|
+
<TextInput value={input} onChangeText={setInput} onSubmitEditing={send} placeholder="Ask anything\u2026" />
|
|
2560
|
+
</View>
|
|
2561
|
+
)
|
|
2562
|
+
}
|
|
2563
|
+
`,
|
|
2564
|
+
"lib/auth.tsx": `import { createContext, useContext, useEffect, useState, type ReactNode } from 'react'
|
|
2565
|
+
import * as SecureStore from 'expo-secure-store'
|
|
2566
|
+
|
|
2567
|
+
interface AuthValue { token: string | null; signIn: (t: string) => void; signOut: () => void }
|
|
2568
|
+
const AuthCtx = createContext<AuthValue>({ token: null, signIn: () => {}, signOut: () => {} })
|
|
2569
|
+
|
|
2570
|
+
export function AuthProvider({ children }: { children: ReactNode }) {
|
|
2571
|
+
const [token, setToken] = useState<string | null>(null)
|
|
2572
|
+
|
|
2573
|
+
useEffect(() => {
|
|
2574
|
+
SecureStore.getItemAsync('agentskit_token').then(setToken).catch(() => {})
|
|
2575
|
+
}, [])
|
|
2576
|
+
|
|
2577
|
+
return (
|
|
2578
|
+
<AuthCtx.Provider
|
|
2579
|
+
value={{
|
|
2580
|
+
token,
|
|
2581
|
+
signIn: (t) => { SecureStore.setItemAsync('agentskit_token', t); setToken(t) },
|
|
2582
|
+
signOut: () => { SecureStore.deleteItemAsync('agentskit_token'); setToken(null) },
|
|
2583
|
+
}}
|
|
2584
|
+
>
|
|
2585
|
+
{children}
|
|
2586
|
+
</AuthCtx.Provider>
|
|
2587
|
+
)
|
|
2588
|
+
}
|
|
2589
|
+
|
|
2590
|
+
export const useAuth = () => useContext(AuthCtx)
|
|
2591
|
+
`,
|
|
2592
|
+
".env.example": envExampleFor(ctx.provider),
|
|
2593
|
+
".gitignore": "node_modules\n.expo\ndist\n.env\n.env.local\n",
|
|
2594
|
+
"README.md": readmeFor(ctx)
|
|
2595
|
+
};
|
|
2596
|
+
}
|
|
2597
|
+
function denoDeployStarter(ctx) {
|
|
2598
|
+
const adapterCallEdge = ctx.provider === "demo" ? "demoAdapter()" : ctx.provider === "ollama" ? `ollama({ model: '${PROVIDER_DEFAULT_MODEL[ctx.provider]}' })` : `${PROVIDER_IMPORT[ctx.provider]}({ apiKey: Deno.env.get('${PROVIDER_ENV_KEY[ctx.provider]}') ?? '', model: '${PROVIDER_DEFAULT_MODEL[ctx.provider]}' })`;
|
|
2599
|
+
const adapterImport2 = ctx.provider === "demo" ? "" : `import { ${PROVIDER_IMPORT[ctx.provider]} } from 'npm:@agentskit/adapters'
|
|
2600
|
+
`;
|
|
2601
|
+
const demoSnippet = ctx.provider === "demo" ? demoAdapterSnippet() : "";
|
|
2602
|
+
return {
|
|
2603
|
+
"deno.json": JSON.stringify(
|
|
2604
|
+
{
|
|
2605
|
+
tasks: {
|
|
2606
|
+
dev: "deno run --allow-net --allow-env --watch main.ts",
|
|
2607
|
+
start: "deno run --allow-net --allow-env main.ts",
|
|
2608
|
+
deploy: "deployctl deploy --project=agentskit-deno main.ts"
|
|
2609
|
+
},
|
|
2610
|
+
imports: {
|
|
2611
|
+
"@agentskit/adapters": "npm:@agentskit/adapters@^0.4.0"
|
|
2612
|
+
}
|
|
2613
|
+
},
|
|
2614
|
+
null,
|
|
2615
|
+
2
|
|
2616
|
+
) + "\n",
|
|
2617
|
+
"main.ts": `${adapterImport2}${demoSnippet}const adapter = ${adapterCallEdge}
|
|
2618
|
+
|
|
2619
|
+
Deno.serve(async (request) => {
|
|
2620
|
+
const url = new URL(request.url)
|
|
2621
|
+
if (request.method === 'POST' && url.pathname === '/chat') {
|
|
2622
|
+
const { messages } = await request.json() as { messages: Array<{ role: string; content: string }> }
|
|
2623
|
+
const source = adapter.createSource({ messages: messages.map((m, i) => ({
|
|
2624
|
+
id: String(i), role: m.role as 'user' | 'assistant' | 'system',
|
|
2625
|
+
content: m.content, status: 'complete' as const, createdAt: new Date(0),
|
|
2626
|
+
})) })
|
|
2627
|
+
const stream = new ReadableStream<Uint8Array>({
|
|
2628
|
+
async start(controller) {
|
|
2629
|
+
const encoder = new TextEncoder()
|
|
2630
|
+
for await (const chunk of source.stream()) {
|
|
2631
|
+
if (chunk.type === 'text') controller.enqueue(encoder.encode(chunk.content))
|
|
2632
|
+
}
|
|
2633
|
+
controller.close()
|
|
2634
|
+
},
|
|
2635
|
+
})
|
|
2636
|
+
return new Response(stream, { headers: { 'content-type': 'text/plain; charset=utf-8' } })
|
|
2637
|
+
}
|
|
2638
|
+
return new Response(\`<!doctype html><title>AgentsKit Deno Deploy starter</title>
|
|
2639
|
+
<body><pre>POST /chat with { messages: [...] }</pre></body>\`, {
|
|
2640
|
+
headers: { 'content-type': 'text/html' },
|
|
2641
|
+
})
|
|
2642
|
+
})
|
|
2643
|
+
`,
|
|
2644
|
+
".env.example": envExampleFor(ctx.provider),
|
|
2645
|
+
".gitignore": ".env\n.env.local\n",
|
|
2646
|
+
"README.md": readmeFor(ctx)
|
|
2647
|
+
};
|
|
2648
|
+
}
|
|
2649
|
+
function angularStarter(ctx) {
|
|
2650
|
+
const deps = {
|
|
2651
|
+
"@agentskit/angular": "^0.4.0",
|
|
2652
|
+
"@angular/core": "^21.0.0",
|
|
2653
|
+
"@angular/common": "^21.0.0",
|
|
2654
|
+
"@angular/compiler": "^21.0.0",
|
|
2655
|
+
"@angular/platform-browser": "^21.0.0",
|
|
2656
|
+
"@angular/platform-browser-dynamic": "^21.0.0",
|
|
2657
|
+
rxjs: "^7.8.0",
|
|
2658
|
+
"zone.js": "^0.16.1"
|
|
2659
|
+
};
|
|
2660
|
+
if (ctx.provider !== "demo") deps["@agentskit/adapters"] = "^0.4.0";
|
|
2661
|
+
return {
|
|
2662
|
+
"package.json": JSON.stringify(
|
|
2663
|
+
{
|
|
2664
|
+
name: "agentskit-angular-app",
|
|
2665
|
+
private: true,
|
|
2666
|
+
scripts: {
|
|
2667
|
+
dev: "ng serve",
|
|
2668
|
+
build: "ng build",
|
|
2669
|
+
start: "ng serve"
|
|
2670
|
+
},
|
|
2671
|
+
dependencies: deps,
|
|
2672
|
+
devDependencies: {
|
|
2673
|
+
"@angular/cli": "^21.0.0",
|
|
2674
|
+
"@angular/compiler-cli": "^21.0.0",
|
|
2675
|
+
typescript: "^5.5.0"
|
|
2676
|
+
}
|
|
2677
|
+
},
|
|
2678
|
+
null,
|
|
2679
|
+
2
|
|
2680
|
+
) + "\n",
|
|
2681
|
+
"angular.json": JSON.stringify(
|
|
2682
|
+
{
|
|
2683
|
+
$schema: "./node_modules/@angular/cli/lib/config/schema.json",
|
|
2684
|
+
version: 1,
|
|
2685
|
+
projects: {
|
|
2686
|
+
app: {
|
|
2687
|
+
projectType: "application",
|
|
2688
|
+
root: "",
|
|
2689
|
+
sourceRoot: "src",
|
|
2690
|
+
prefix: "ak",
|
|
2691
|
+
architect: {
|
|
2692
|
+
build: {
|
|
2693
|
+
builder: "@angular/build:application",
|
|
2694
|
+
options: { browser: "src/main.ts", tsConfig: "tsconfig.json", index: "src/index.html" }
|
|
2695
|
+
},
|
|
2696
|
+
serve: { builder: "@angular/build:dev-server", options: { buildTarget: "app:build" } }
|
|
2697
|
+
}
|
|
2698
|
+
}
|
|
2699
|
+
}
|
|
2700
|
+
},
|
|
2701
|
+
null,
|
|
2702
|
+
2
|
|
2703
|
+
) + "\n",
|
|
2704
|
+
"tsconfig.json": JSON.stringify(
|
|
2705
|
+
{
|
|
2706
|
+
compilerOptions: {
|
|
2707
|
+
target: "ES2022",
|
|
2708
|
+
module: "preserve",
|
|
2709
|
+
moduleResolution: "bundler",
|
|
2710
|
+
strict: true,
|
|
2711
|
+
experimentalDecorators: true,
|
|
2712
|
+
useDefineForClassFields: false,
|
|
2713
|
+
lib: ["ES2022", "DOM"]
|
|
2714
|
+
},
|
|
2715
|
+
include: ["src/**/*.ts"]
|
|
2716
|
+
},
|
|
2717
|
+
null,
|
|
2718
|
+
2
|
|
2719
|
+
) + "\n",
|
|
2720
|
+
"src/index.html": `<!doctype html>
|
|
2721
|
+
<html><head><title>AgentsKit Angular</title></head>
|
|
2722
|
+
<body><ak-root></ak-root></body></html>
|
|
2723
|
+
`,
|
|
2724
|
+
"src/main.ts": `import { bootstrapApplication } from '@angular/platform-browser'
|
|
2725
|
+
import 'zone.js'
|
|
2726
|
+
import { AppComponent } from './app'
|
|
2727
|
+
|
|
2728
|
+
bootstrapApplication(AppComponent)
|
|
2729
|
+
`,
|
|
2730
|
+
"src/app.ts": `import { Component, signal } from '@angular/core'
|
|
2731
|
+
import { CommonModule } from '@angular/common'
|
|
2732
|
+
|
|
2733
|
+
@Component({
|
|
2734
|
+
selector: 'ak-root',
|
|
2735
|
+
standalone: true,
|
|
2736
|
+
imports: [CommonModule],
|
|
2737
|
+
template: \`
|
|
2738
|
+
<main style="max-width: 640px; margin: 2rem auto;">
|
|
2739
|
+
<h1>AgentsKit \xB7 Angular standalone</h1>
|
|
2740
|
+
<p>Wire @agentskit/angular here. See the docs for the chat service binding.</p>
|
|
2741
|
+
<p>Counter (sanity): {{ count() }}</p>
|
|
2742
|
+
<button (click)="bump()">+1</button>
|
|
2743
|
+
</main>
|
|
2744
|
+
\`,
|
|
2745
|
+
})
|
|
2746
|
+
export class AppComponent {
|
|
2747
|
+
readonly count = signal(0)
|
|
2748
|
+
bump() { this.count.update(n => n + 1) }
|
|
2749
|
+
}
|
|
2750
|
+
`,
|
|
2751
|
+
".env.example": envExampleFor(ctx.provider),
|
|
2752
|
+
".gitignore": "node_modules\ndist\n.angular\n.env\n.env.local\n",
|
|
2753
|
+
"README.md": readmeFor(ctx)
|
|
2754
|
+
};
|
|
2755
|
+
}
|
|
2451
2756
|
function readmeFor(ctx) {
|
|
2452
2757
|
const installCmd = ctx.pm === "npm" ? "npm install" : `${ctx.pm} install`;
|
|
2453
2758
|
const runCmd = ctx.pm === "npm" ? "npm run dev" : `${ctx.pm} dev`;
|
|
@@ -2493,7 +2798,10 @@ var TEMPLATE_FN = {
|
|
|
2493
2798
|
nuxt: nuxtStarter,
|
|
2494
2799
|
"vite-ink": viteInkStarter,
|
|
2495
2800
|
"cloudflare-workers": cloudflareWorkersStarter,
|
|
2496
|
-
bun: bunStarter
|
|
2801
|
+
bun: bunStarter,
|
|
2802
|
+
expo: expoStarter,
|
|
2803
|
+
"deno-deploy": denoDeployStarter,
|
|
2804
|
+
angular: angularStarter
|
|
2497
2805
|
};
|
|
2498
2806
|
async function writeStarterProject(options) {
|
|
2499
2807
|
const ctx = {
|
|
@@ -3299,6 +3607,9 @@ ${kleur3.bold().green("\u25B2")} ${kleur3.bold("agentskit init")}
|
|
|
3299
3607
|
{ name: "Vite + Ink (terminal, hot-reload)", value: "vite-ink", description: "Ink chat with vite-node hot reload" },
|
|
3300
3608
|
{ name: "Cloudflare Workers (edge)", value: "cloudflare-workers", description: "Edge runtime with itty-router + streaming" },
|
|
3301
3609
|
{ name: "Bun server", value: "bun", description: "Bun.serve with hot reload" },
|
|
3610
|
+
{ name: "Deno Deploy", value: "deno-deploy", description: "Deno.serve with deployctl + npm: imports" },
|
|
3611
|
+
{ name: "Expo + auth (mobile)", value: "expo", description: "expo-router + expo-secure-store + chat screen" },
|
|
3612
|
+
{ name: "Angular standalone", value: "angular", description: "Angular 21 standalone bootstrap with @agentskit/angular" },
|
|
3302
3613
|
{ name: "Runtime (headless agent, no UI)", value: "runtime", description: "Autonomous task \u2192 result" },
|
|
3303
3614
|
{ name: "Multi-agent (planner + delegates)", value: "multi-agent", description: "Supervisor pattern, ready to extend" }
|
|
3304
3615
|
]
|
|
@@ -3407,7 +3718,7 @@ function printNextSteps(options) {
|
|
|
3407
3718
|
|
|
3408
3719
|
// src/commands/init.ts
|
|
3409
3720
|
function registerInitCommand(program) {
|
|
3410
|
-
program.command("init").description("Generate a starter project. Run with no flags for interactive mode.").option("--template <template>", "Starter template (react|nextjs|sveltekit|nuxt|ink|vite-ink|cloudflare-workers|bun|runtime|multi-agent)").option("--dir <directory>", "Target directory", "agentskit-app").option("--provider <provider>", "LLM provider (openai|anthropic|gemini|ollama|demo)").option("--tools <tools>", "Comma-separated tools (web_search,filesystem,shell)").option("--memory <backend>", "Memory backend (none|file|sqlite)").option("--pm <packageManager>", "Package manager (pnpm|npm|yarn|bun)").option("-y, --yes", "Skip interactive prompts; use flag values + defaults").action(async (rawOptions) => {
|
|
3721
|
+
program.command("init").description("Generate a starter project. Run with no flags for interactive mode.").option("--template <template>", "Starter template (react|nextjs|sveltekit|nuxt|ink|vite-ink|cloudflare-workers|bun|deno-deploy|expo|angular|runtime|multi-agent)").option("--dir <directory>", "Target directory", "agentskit-app").option("--provider <provider>", "LLM provider (openai|anthropic|gemini|ollama|demo)").option("--tools <tools>", "Comma-separated tools (web_search,filesystem,shell)").option("--memory <backend>", "Memory backend (none|file|sqlite)").option("--pm <packageManager>", "Package manager (pnpm|npm|yarn|bun)").option("-y, --yes", "Skip interactive prompts; use flag values + defaults").action(async (rawOptions) => {
|
|
3411
3722
|
const isCi = !process.stdout.isTTY || rawOptions.yes || rawOptions.template;
|
|
3412
3723
|
let resolved;
|
|
3413
3724
|
if (isCi) {
|
|
@@ -3790,5 +4101,5 @@ function createCli() {
|
|
|
3790
4101
|
}
|
|
3791
4102
|
|
|
3792
4103
|
export { ChatApp, HookDispatcher, McpClient, applyPolicyToTool, applyPolicyToTools, bridgeMcpServers, buildRagFromConfig, computeCost, configHooksToHandlers, createCli, createOpenAiEmbedder, defaultPolicy, derivePreview, disposeMcpClients, evaluatePolicy, findLatestSession, findSession, forkSession, generateSessionId, getPricing, indexSources, listSessions, loadConfig, loadPlugins, mergePluginsIntoBundle, registerPricing, renameSession, renderChatHeader, renderReport, resolveChatProvider, resolveSession, runAgent, runDoctor, sessionFilePath, startDev, startTunnel, writeSessionMeta, writeStarterProject };
|
|
3793
|
-
//# sourceMappingURL=chunk-
|
|
3794
|
-
//# sourceMappingURL=chunk-
|
|
4104
|
+
//# sourceMappingURL=chunk-I5P3Y7NG.js.map
|
|
4105
|
+
//# sourceMappingURL=chunk-I5P3Y7NG.js.map
|