@collective-intelligence/ai 0.11.0 → 0.12.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.
@@ -226,7 +226,7 @@ Your server invokes an Agent with `agents.invoke({ agentId, input })`, which ret
226
226
 
227
227
  For a multi-turn chat, use the shared chat. Start a Conversation with the Agent with `ci.chat.createConversation({ organizationId, payload: { agentId } })`, send each message with `createChatClient(ci, { organizationId }).send({ conversationId, message })` from `@collective-intelligence/external-apps-server-sdk/chat`, and read earlier turns with `ci.chat.getTranscript`. Each turn is an ordinary Agent run, and the earlier successful turns, with their saved Agent Output, become the model's conversation history. A message sent while a turn still runs steers that turn and starts no second turn, and a resend with the same message `id` adds nothing.
228
228
 
229
- `send` resolves `{ ok: true, value, runId }`: `runId` is the id of the turn's run, which the answer message also carries as `metadata.invocationId`, and `turnRunId(message)` reads it from any answer message. `runs.get`, `runs.sources` and `runs.feedback` accept that id like the `runId` of `agents.invoke`. They answer only the caller that owns the Conversation (the member, the app server or the visitor) through the application where the Conversation started, and answer `not_found` to every other caller. As for any run, only a signed-in member reads `runs.sources` and gives `runs.feedback`. `runs.get` gives the status and `result: { message, output? }`, where `output` is the Agent Output that the turn saved. `runs.feedback` also rates a succeeded turn whose answer is only its Agent Output, with the Output's JSON text as the rated answer; a turn with neither text nor Output has no answer to rate and gets `not_found`. The member can also rate and clear the answer with `ci.chat.putAnswerFeedback` and `ci.chat.clearAnswerFeedback` (`params: { invocationId: runId }`); it is the same rating. Each completed Agent turn with an answer to rate (its text or its Agent Output) of `ci.chat.getTranscript` gives that member `feedbackTargetId` (the turn's run id) and `currentUserFeedback`, so the app shows a saved rating again after a reload. `runs.sources` gives the searched Document Versions with their pages and a download link. `runs.stream` and `runs.cancel` read only runs that `agents.invoke` started: follow a turn with `GET /runs/:runId/stream` of the chat mount, and stop it with `ci.chat.cancelTurn`.
229
+ `send` resolves `{ ok: true, value, runId }`: `runId` is the id of the turn's run, which the answer message also carries as `metadata.invocationId`, and `turnRunId(message)` reads it from any answer message. `runs.get`, `runs.stream`, `runs.cancel`, `runs.sources` and `runs.feedback` accept that id like the `runId` of `agents.invoke`. They answer only the caller that owns the Conversation (the member, the app server or the visitor) through the application where the Conversation started, and answer `not_found` to every other caller. As for any run, only a signed-in member reads `runs.sources` and gives `runs.feedback`. `runs.get` gives the status and `result: { message, output? }`, where `output` is the Agent Output that the turn saved. `runs.feedback` also rates a succeeded turn whose answer is only its Agent Output, with the Output's JSON text as the rated answer; a turn with neither text nor Output has no answer to rate and gets `not_found`. The member can also rate and clear the answer with `ci.chat.putAnswerFeedback` and `ci.chat.clearAnswerFeedback` (`params: { invocationId: runId }`); it is the same rating. Each completed Agent turn with an answer to rate (its text or its Agent Output) of `ci.chat.getTranscript` gives that member `feedbackTargetId` (the turn's run id) and `currentUserFeedback`, so the app shows a saved rating again after a reload. `runs.sources` gives the searched Document Versions with their pages and a download link. `runs.stream` pages the turn's events as for `agents.invoke`: `accepted`, the `agent.*` events and the application events that its tools publish, then one terminal event with the `runs.get` result. `runs.cancel` stops the turn. The answer itself streams from `GET /runs/:runId/stream` of the chat mount.
230
230
 
231
231
  Anonymous visitors can chat with an Agent only when its audience has `anonymous: [app]` for that application and the call passes `caller: { kind: "anonymous_visitor", visitor: { issuer, subjectId } }`. Their turns run with the Agent's own bindings, never with the application's grants, and visitors never see each other's conversations.
232
232
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@collective-intelligence/ai",
3
- "version": "0.11.0",
3
+ "version": "0.12.0",
4
4
  "description": "The Collective Intelligence AI package: the CI message domain, the chat contract, the chat transports, the headless chat session and the chat views, one subpath per layer.",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -58,8 +58,8 @@
58
58
  },
59
59
  "peerDependencies": {
60
60
  "@ai-sdk/react": "^4.0.177",
61
- "@collective-intelligence/effect-xstate": "0.11.0",
62
- "@collective-intelligence/ui-react": "0.11.0",
61
+ "@collective-intelligence/effect-xstate": "0.12.0",
62
+ "@collective-intelligence/ui-react": "0.12.0",
63
63
  "@tanstack/react-query": "^5.101.4",
64
64
  "@xstate/react": "^6.1.0",
65
65
  "ai": ">=7.0.173 <8",
@@ -95,8 +95,8 @@
95
95
  },
96
96
  "devDependencies": {
97
97
  "@ai-sdk/react": "4.0.177",
98
- "@collective-intelligence/effect-xstate": "0.11.0",
99
- "@collective-intelligence/ui-react": "0.11.0",
98
+ "@collective-intelligence/effect-xstate": "0.12.0",
99
+ "@collective-intelligence/ui-react": "0.12.0",
100
100
  "@effect/eslint-plugin": "0.3.2",
101
101
  "@oxlint/plugins": "1.94.0",
102
102
  "@punks/lints": "0.2.0",
@@ -121,5 +121,5 @@
121
121
  "vitest": "5.0.2",
122
122
  "xstate": "5.33.3"
123
123
  },
124
- "gitHead": "8d52a59042026b9044f6e4c49084efbd34868c0c"
124
+ "gitHead": "995aa5542f6f440c5cebe836b57bc9bae57ae7e8"
125
125
  }