@agentskit/chat 0.1.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/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 AgentsKit
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
package/README.md ADDED
@@ -0,0 +1,31 @@
1
+ # @agentskit/chat
2
+
3
+ Framework-neutral application definitions for AgentsKit Chat.
4
+
5
+ Actionable choices use `createActionConfirmation`, which delegates validation, canonical confirmation state, approval, denial, and execution to AgentsKit.
6
+
7
+ Use `createCapabilityPolicy` and `withActionPolicy` to default-deny actions from trusted session capabilities while keeping enforcement in AgentsKit.
8
+
9
+ The package also provides session-scoped deterministic routes and explicit conversation-state projections while unresolved turns stay on the upstream AgentsKit controller. Conversation definitions compile to published `@agentskit/statechart`; this package retains application routing and session composition rather than implementing another transition engine.
10
+
11
+ ```ts
12
+ const definition = defineChat({ id: 'support', chat: agentskitChatConfig })
13
+ ```
14
+
15
+ `defineChat` preserves the upstream `ChatConfig`; it does not create another runtime.
16
+
17
+ Use `resumeChatSession(definition, { sessionId, storage })` for cross-client application metadata and pass the returned session to any renderer. Keep messages in `definition.chat.memory` using upstream `ChatMemory`.
18
+
19
+ The package also owns the runtime-validated semantic fallback envelope shared by native renderers:
20
+
21
+ ```ts
22
+ const fallback = parseSemanticFallback({ kind: 'chart', summary: 'Revenue rose 12%.' })
23
+ formatSemanticFallback(fallback)
24
+ // [unsupported visual: chart] Revenue rose 12%.
25
+ ```
26
+
27
+ Custom application UI is declared through `defineComponentManifest`. The first schema-backed component is `ChoiceListComponent`; untrusted frames must pass `resolveComponentFrame` before rendering.
28
+
29
+ Shared Ask-service hosts use `createAskAdapter` and `createAskSessionMemory`. The adapter owns the validated NDJSON boundary and ordered text/source projection; memory composes `@agentskit/memory/web-storage` rather than implementing another message store. See [`docs/protocol/ask-service.md`](../../docs/protocol/ask-service.md).
30
+
31
+ To answer exact local facts before Ask or another backend, verify the artifact and compose `createDeterministicAnswerAdapter({ artifact, expectedContentHash, expectedSiteId, fallbackMode, fallback })`. Wire its `resolveChoiceSubmission` into `definition.choiceSubmission` so only adapter-projected, single-use choices can submit their visible alias. One exact match renders locally, ambiguity exposes visible unique choices across all seven renderers, disabled fallback never calls the backend, and bounded successful backend streams receive the same answer envelope on completion. The contract is accepted in ADR-0024; see [`docs/protocol/deterministic-answers.md`](../../docs/protocol/deterministic-answers.md).