@@ -48,10 +48,10 @@ const agent = await ctx.chatluna.createAgent({
4848``` ts twoslash
4949// @noImplicitAny: false
5050// @strictNullChecks: false
51- import { Context , Schema } from ' koishi'
51+ import { Context , Schema , type Session } from ' koishi'
5252
5353const ctx = new Context ()
54-
54+ const session = {} as Session
5555
5656import type {} from " koishi-plugin-chatluna/services/chat" ;
5757
@@ -100,10 +100,10 @@ console.log(result.message);
100100``` ts twoslash
101101// @noImplicitAny: false
102102// @strictNullChecks: false
103- import { Context , Schema } from ' koishi'
103+ import { Context , Schema , type Session } from ' koishi'
104104
105105const ctx = new Context ()
106-
106+ const session = {} as Session
107107
108108import type {} from " koishi-plugin-chatluna/services/chat" ;
109109
@@ -147,10 +147,10 @@ console.log(result.output);
147147``` ts twoslash
148148// @noImplicitAny: false
149149// @strictNullChecks: false
150- import { Context , Schema } from ' koishi'
150+ import { Context , Schema , type Session } from ' koishi'
151151
152152const ctx = new Context ()
153-
153+ const session = {} as Session
154154
155155import type {} from " koishi-plugin-chatluna/services/chat" ;
156156
@@ -309,7 +309,6 @@ import { Context, Schema } from 'koishi'
309309
310310const ctx = new Context ()
311311
312-
313312import type {} from " koishi-plugin-chatluna/services/chat" ;
314313import {
315314 createTaskTool ,
@@ -390,16 +389,19 @@ const main = await ctx.chatluna.createAgent({
390389``` ts twoslash
391390// @noImplicitAny: false
392391// @strictNullChecks: false
393- import { Context , Schema } from ' koishi'
392+ import { Context , Schema , type Session } from ' koishi'
394393
395394const ctx = new Context ()
395+ const session = {} as Session
396+ const modelRef = await ctx .chatluna .createChatModel (" openai/gpt-5-nano" )
396397
397398
398399import type {} from " koishi-plugin-chatluna/services/chat" ;
399400import {
400401 createTaskTool ,
401402 renderAvailableAgents ,
402403} from " koishi-plugin-chatluna/llm-core/agent" ;
404+ import type { ChatLunaToolRunnable } from " koishi-plugin-chatluna/llm-core/platform/types" ;
403405
404406const planner = await ctx .chatluna .createAgent ({
405407 name: " planner" ,
@@ -447,21 +449,23 @@ const taskRuntime = createTaskTool({
447449});
448450
449451// ---cut---
452+ const runConfig = {
453+ configurable: {
454+ session ,
455+ conversationId: " conversation-id" ,
456+ source: " chatluna" ,
457+ model: modelRef .value ,
458+ },
459+ } as ChatLunaToolRunnable ;
460+
450461const result = await taskRuntime .runTask (
451462 {
452463 action: " run" ,
453464 agent: " researcher" ,
454465 prompt: " 搜索 Anthropic 最近发布的模型更新,并整理成中文摘要" ,
455466 background: true ,
456467 },
457- {
458- configurable: {
459- session ,
460- conversationId: " conversation-id" ,
461- source: " chatluna" ,
462- model: modelRef .value ,
463- },
464- } as any ,
468+ runConfig ,
465469);
466470
467471console .log (result );
@@ -472,16 +476,18 @@ console.log(result);
472476``` ts twoslash
473477// @noImplicitAny: false
474478// @strictNullChecks: false
475- import { Context , Schema } from ' koishi'
479+ import { Context , Schema , type Session } from ' koishi'
476480
477481const ctx = new Context ()
478-
482+ const session = {} as Session
483+ const modelRef = await ctx .chatluna .createChatModel (" openai/gpt-5-nano" )
479484
480485import type {} from " koishi-plugin-chatluna/services/chat" ;
481486import {
482487 createTaskTool ,
483488 renderAvailableAgents ,
484489} from " koishi-plugin-chatluna/llm-core/agent" ;
490+ import type { ChatLunaToolRunnable } from " koishi-plugin-chatluna/llm-core/platform/types" ;
485491
486492const planner = await ctx .chatluna .createAgent ({
487493 name: " planner" ,
@@ -529,6 +535,15 @@ const taskRuntime = createTaskTool({
529535});
530536
531537// ---cut---
538+ const runConfig = {
539+ configurable: {
540+ session ,
541+ conversationId: " conversation-id" ,
542+ source: " chatluna" ,
543+ model: modelRef .value ,
544+ },
545+ } as ChatLunaToolRunnable ;
546+
532547await taskRuntime .runTask ({ action: " list" }, runConfig );
533548await taskRuntime .runTask ({ action: " status" , id: " task-id" }, runConfig );
534549await taskRuntime .runTask (
0 commit comments