@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 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 runId)
77
+ ### Subagents (shared threadId)
78
78
 
79
- Group orchestrator and subagent calls under one run by **sharing a `runId`**. Any `aiSdkMiddleware({ runId })` / `createLogger({ runId })` with the same id appends its steps to the same run, in the order they fire. The viewer shows them as one row whose steps tell the whole story.
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 { generateRunId, aiSdkMiddleware } from '@ailog/cli';
83
-
84
- const runId = generateRunId();
82
+ import { aiSdkMiddleware } from '@ailog/cli';
85
83
 
86
84
  const orchestrator = wrapLanguageModel({
87
85
  middleware: aiSdkMiddleware({
88
- runId,
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
- // Same runId the subagent's step joins the orchestrator's run.
100
- middleware: aiSdkMiddleware({ runId }),
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
- - `runId` is auto-generated when omitted.
113
- - The **first** writer that creates a given run sets its `functionId` / `metadata`; later writers reusing the id keep those values (idempotent).
114
- - `step_number` is assigned by the DB based on the run's current step count, so concurrent writers within the same process produce a stable monotonic sequence without coordinating.
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