@intelligo-dev/chat 1.0.0-beta.14 → 1.0.0-beta.15

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.
Files changed (2) hide show
  1. package/README.md +29 -0
  2. package/package.json +5 -5
package/README.md CHANGED
@@ -71,6 +71,35 @@ route to get:
71
71
  None carry product vocabulary; all close over the caller's tenancy, so the
72
72
  model is never told which workspace it is in.
73
73
 
74
+ `resolveAgent`, `agent.tools(turn)` and `deriveTitle` receive a `ChatTurnContext`; the later
75
+ seams — `prepareMessages`, `streamTurn`, `persist` — receive a `ChatTurn`, which
76
+ is the same context plus the resolved agent and `history()`. The context
77
+ carries `workspaceId` and `userId`, the `request`, the `conversationId` and its
78
+ row (`conversation`, null on the first turn), the `trigger`, and `body`: the
79
+ fields the client sent beyond the AI SDK's own, such as `ChatPanel`'s `body`
80
+ prop, which is how a page tells a tool which record it is about. `body` is the
81
+ caller's input, so a tool reads a record through the turn's workspace, never
82
+ by the id alone. Beside them sit `write`, `updateMetadata`, `state` and
83
+ `addUsage`:
84
+
85
+ ```ts
86
+ agent: {
87
+ tools: (turn) => ({
88
+ summarize: tool({
89
+ inputSchema: z.object({ section: z.string() }),
90
+ execute: async ({ section }) => {
91
+ // Scoped to the caller's workspace: an id from `body` is untrusted.
92
+ const record = await getRecord(turn.workspaceId, String(turn.body.recordId));
93
+ if (!record) return { error: "not found" };
94
+ const { text, usage } = await summarize(record, section);
95
+ turn.addUsage(usage, { model: "google/gemini-2.5-flash" });
96
+ return text;
97
+ },
98
+ }),
99
+ }),
100
+ },
101
+ ```
102
+
74
103
  A tool reaches the client mid-turn through the turn: `turn.write()` sends a
75
104
  `data-chat-*` part (a status line, a plan), and `createArtifactWriter(turn,
76
105
  { kind, title })` streams a document into the chat's canvas — `append`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intelligo-dev/chat",
3
- "version": "1.0.0-beta.14",
3
+ "version": "1.0.0-beta.15",
4
4
  "description": "The AI-SDK-native chat transport: one Route Handler with auth, rate limits, feature gates, credits and persistence.",
5
5
  "keywords": [
6
6
  "intelligo",
@@ -39,10 +39,10 @@
39
39
  }
40
40
  },
41
41
  "dependencies": {
42
- "@intelligo-dev/auth": "1.0.0-beta.14",
43
- "@intelligo-dev/billing": "1.0.0-beta.14",
44
- "@intelligo-dev/executions": "1.0.0-beta.14",
45
- "@intelligo-dev/core": "1.0.0-beta.14"
42
+ "@intelligo-dev/billing": "1.0.0-beta.15",
43
+ "@intelligo-dev/core": "1.0.0-beta.15",
44
+ "@intelligo-dev/executions": "1.0.0-beta.15",
45
+ "@intelligo-dev/auth": "1.0.0-beta.15"
46
46
  },
47
47
  "peerDependencies": {
48
48
  "ai": "^7.0.0"