@vinaverse/client 0.1.0-alpha.10 → 0.1.0-alpha.11

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 (51) hide show
  1. package/README.md +19 -3
  2. package/dist/agent/index.cjs +2 -0
  3. package/dist/agent/index.cjs.map +1 -1
  4. package/dist/agent/index.d.cts +3 -3
  5. package/dist/agent/index.d.ts +3 -3
  6. package/dist/agent/index.js +1 -1
  7. package/dist/backend/index.cjs +37 -10
  8. package/dist/backend/index.cjs.map +1 -1
  9. package/dist/backend/index.d.cts +13 -3
  10. package/dist/backend/index.d.ts +13 -3
  11. package/dist/backend/index.js +38 -11
  12. package/dist/backend/index.js.map +1 -1
  13. package/dist/chunk-D56MNG3E.js +9 -0
  14. package/dist/{chunk-YNUHXJD6.js.map → chunk-D56MNG3E.js.map} +1 -1
  15. package/dist/{chunk-O3NLAZGZ.js → chunk-JI6HUXH3.js} +4 -2
  16. package/dist/chunk-JI6HUXH3.js.map +1 -0
  17. package/dist/contract-Be2oVHNr.d.cts +6 -0
  18. package/dist/contract-Be2oVHNr.d.ts +6 -0
  19. package/dist/conversation/index.cjs +2 -2
  20. package/dist/conversation/index.cjs.map +1 -1
  21. package/dist/conversation/index.d.cts +5 -5
  22. package/dist/conversation/index.d.ts +5 -5
  23. package/dist/conversation/index.js +1 -1
  24. package/dist/history/index.cjs +282 -0
  25. package/dist/history/index.cjs.map +1 -0
  26. package/dist/history/index.d.cts +91 -0
  27. package/dist/history/index.d.ts +91 -0
  28. package/dist/history/index.js +261 -0
  29. package/dist/history/index.js.map +1 -0
  30. package/dist/index.cjs +2 -2
  31. package/dist/index.cjs.map +1 -1
  32. package/dist/index.d.cts +2 -2
  33. package/dist/index.d.ts +2 -2
  34. package/dist/index.js +1 -1
  35. package/dist/{runtime-Z1RI10lU.d.ts → runtime-6O0qIPmo.d.cts} +25 -2
  36. package/dist/{runtime-CISPp9nJ.d.cts → runtime-CNgz2_8G.d.ts} +25 -2
  37. package/dist/{session-CPz4pcPu.d.cts → session-D0ijOQX3.d.cts} +98 -5
  38. package/dist/{session-CPz4pcPu.d.ts → session-D0ijOQX3.d.ts} +98 -5
  39. package/dist/{store-DZka9T2-.d.ts → store-CGRSxVcL.d.ts} +1 -1
  40. package/dist/{store-BxiicOKG.d.cts → store-CxoHwd64.d.cts} +1 -1
  41. package/dist/testing/index.cjs +158 -14
  42. package/dist/testing/index.cjs.map +1 -1
  43. package/dist/testing/index.d.cts +42 -5
  44. package/dist/testing/index.d.ts +42 -5
  45. package/dist/testing/index.js +159 -15
  46. package/dist/testing/index.js.map +1 -1
  47. package/package.json +24 -1
  48. package/dist/chunk-O3NLAZGZ.js.map +0 -1
  49. package/dist/chunk-YNUHXJD6.js +0 -9
  50. package/dist/contract-DmQs8amJ.d.cts +0 -6
  51. package/dist/contract-DmQs8amJ.d.ts +0 -6
package/README.md CHANGED
@@ -139,7 +139,8 @@ app comes back to the foreground).
139
139
  **Your backend, in two lines** (`@vinaverse/client/backend`): `backendFromFetch({ routes, headers })` is an
140
140
  `AgentBackend` over your own routes, sending the person's credentials from `headers`, never in a body.
141
141
  `backendRoutes(base)` gives the routes the .NET SDK's `MapVinaverseAgentSessions` serves by default (`session`,
142
- `refresh`, `status`, `feedback`, `end`, `context`, `delete`); give your own where they differ. Both sides speak
142
+ `refresh`, `status`, `feedback`, `end`, `context`, `delete`, and history's `list` and `read`, answered
143
+ `{ version: 1, page }` as the gateway wrote the page); give your own where they differ. Both sides speak
143
144
  `vinaverse.agent-backend/1` (vinaverse-contracts `docs/agent-backend.md`, tested here against its fixture): successes
144
145
  wrapped with the version (`{ version: 1, session }`, `{ version: 1, client_secret: { value, expires_at } }`,
145
146
  `{ version: 1, status }`, or 204), and one failure body for every route. Every session creation (a first open, a
@@ -192,8 +193,23 @@ For a mock mode and tests, `@vinaverse/client/testing` has a scripted agent:
192
193
  `createMockAgent({ script, reply, refuse, welcome })` gives an `AgentBackend` and a WebSocket factory that speaks the
193
194
  protocol (`conversation.transport.webSocket`). `script` is the replies in order, one per turn, each with its text, its
194
195
  cards or a failure; `reply` answers after it. `mockCards` gives the cards your tools would: `professional`,
195
- `workspace`, `timeSlots`, `proposal` (pending, confirmed in your app) and `links`. Scripted history comes with the
196
- runtime's history.
196
+ `workspace`, `timeSlots`, `proposal` (pending, confirmed in your app) and `links`. `history` scripts past
197
+ conversations (`{ id, title, state, items: [{ role, text, refusal? }, { card, proposal_outcome? }] }`): listed, read
198
+ back, continued with their messages, deleted (then `not_found`); a conversation begun in the mock is listed too once
199
+ something was said.
200
+
201
+ **History** (`@vinaverse/client/history`, an entry of its own): `createAgentHistory({ runtime, mode, scope, agent,
202
+ pageSize })` is the person's past conversations, newest activity first, a page at a time (`refresh`, `loadMore`, and
203
+ `retry` for the page that failed, the first or the next; `failure` says `off` when your backend serves no
204
+ `listConversations`; a cursor the gateway no longer takes, refused `unavailable` with its `invalid_request`, starts the
205
+ list over once, and any other refusal is said); `remove(key, id)` deletes through `runtime.deleteConversation` and drops
206
+ the row, one already gone too. `createAgentTranscript({ runtime, conversationId })` reads one back, the newest page
207
+ first and earlier pages prepended (`load`, `loadEarlier`, `retry`; a stale cursor reads back from the newest page
208
+ once), its items as the kits draw them (`historyItems`: messages
209
+ as sent, a cut-off reply and a guardrail's refusal kept, cards restored and inert, a proposal with the outcome it
210
+ had). `continueKey(conversation, subject)` is the key it continues under (its side and business as bound when it
211
+ started), for `runtime.continue` and `deleteConversation`. Nothing begun before a sign-out lands after it
212
+ (`runtime.epoch()`), nor a page from before a newer read.
197
213
 
198
214
  The contract's types are exported too (`paths`, `components`, `operations`, `Schemas`): import them instead of copying
199
215
  the spec. Design: [docs/architecture/agent-runtime.md](../../docs/architecture/agent-runtime.md).
@@ -3126,6 +3126,8 @@ function createAgentRuntime(options) {
3126
3126
  },
3127
3127
  getStatus: () => status?.value ?? null,
3128
3128
  getStatusState: () => statusState,
3129
+ backend,
3130
+ epoch: () => generation,
3129
3131
  getName: () => sessionName ?? status?.value.displayName ?? null,
3130
3132
  subscribe(listener) {
3131
3133
  listeners.add(listener);