@ailog/cli 0.2.6 → 0.3.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/README.md +9 -11
- package/dist/client/assets/index-BBTm7Mxn.js +160 -0
- package/dist/client/assets/index-x-B7u97h.css +1 -0
- package/dist/client/index.html +4 -4
- package/dist/index.d.ts +35 -57
- package/dist/index.js +153 -81
- package/dist/viewer/server.js +117 -64
- package/package.json +1 -1
- package/dist/client/assets/index-BMqO0rJT.js +0 -190
- package/dist/client/assets/index-CdQ1JjwT.css +0 -1
package/README.md
CHANGED
|
@@ -74,18 +74,16 @@ await createLogger({
|
|
|
74
74
|
|
|
75
75
|
Rendered as `key: value` pills on the run header.
|
|
76
76
|
|
|
77
|
-
### Subagents (shared
|
|
77
|
+
### Subagents (shared threadId)
|
|
78
78
|
|
|
79
|
-
|
|
79
|
+
Each `aiSdkMiddleware` instance owns one Run automatically. To group orchestrator and subagent calls — each constructed with its own wrapped model — share a `threadId`. They show up side-by-side under the same Thread in the viewer.
|
|
80
80
|
|
|
81
81
|
```ts
|
|
82
|
-
import {
|
|
83
|
-
|
|
84
|
-
const runId = generateRunId();
|
|
82
|
+
import { aiSdkMiddleware } from '@ailog/cli';
|
|
85
83
|
|
|
86
84
|
const orchestrator = wrapLanguageModel({
|
|
87
85
|
middleware: aiSdkMiddleware({
|
|
88
|
-
|
|
86
|
+
threadId: 'tokyo',
|
|
89
87
|
functionId: 'orchestrator',
|
|
90
88
|
metadata: { userId: '...' },
|
|
91
89
|
}),
|
|
@@ -96,8 +94,8 @@ const tools = {
|
|
|
96
94
|
research: tool({
|
|
97
95
|
execute: async ({ question }) => {
|
|
98
96
|
const sub = wrapLanguageModel({
|
|
99
|
-
//
|
|
100
|
-
middleware: aiSdkMiddleware({
|
|
97
|
+
// Share only the threadId — each tool call gets its own Run in the same Thread.
|
|
98
|
+
middleware: aiSdkMiddleware({ threadId: 'tokyo', functionId: 'researcher' }),
|
|
101
99
|
model,
|
|
102
100
|
});
|
|
103
101
|
return { answer: (await generateText({ model: sub, prompt: question })).text };
|
|
@@ -109,9 +107,9 @@ await generateText({ model: orchestrator, tools, ... });
|
|
|
109
107
|
```
|
|
110
108
|
|
|
111
109
|
Rules:
|
|
112
|
-
- `
|
|
113
|
-
-
|
|
114
|
-
-
|
|
110
|
+
- `threadId` is auto-generated (`auto-<short>`) when omitted, so every run still belongs to a Thread.
|
|
111
|
+
- `metadata` lives on the Thread record (not the Run). First-writer-wins: only the call that creates the Thread sets it.
|
|
112
|
+
- Run ids are always auto-generated; you can't reuse one across loggers. Share a Thread, not a Run.
|
|
115
113
|
|
|
116
114
|
### Viewer
|
|
117
115
|
|