@skaile/forge-voice 0.1.0 → 0.1.1

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 (3) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/README.md +42 -1
  3. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # @skaile/forge-voice
2
2
 
3
+ ## 0.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - c981694: Steer: push a message into the agent's running turn instead of waiting for it to end.
8
+
9
+ - `@skaile/forge-agent-runtime`: the app runner host's `POST /runs/:id/commands` accepts `steer` (`promptId`, `text`, `urgency` `fold`/`now`, optional `author`, `turnId`; `meta` and anything else are dropped). The run answers with a `steer_result` event.
10
+ - `@skaile/forge-chat`: `ChatSession.steer(text, urgency = 'fold')` sends into the running turn and shows the text as a user message at once (while idle it is `send`); `ChatSession.canSteer` says whether the transport can. New optional `ChatTransport.steer` and `SkaileLink.steer`; `mapSkaileEvent` maps `steer_result` to the new `steer-result` stream event (the reducer ignores it); `createWorkspacesClientLink` steers and resends an `unsupported` steer as a prompt (after a `cancel` for `now`). `useChat()` exposes `steer`. New types `ChatSteerUrgency`, `ChatSteerOutcome`.
11
+ - `@skaile/forge-layer-workspace-agent`: new action `workspaceAgent.steer { threadId, text, urgency }` (people only, scope `agents:write`), used by the `skaile` engine's link. A run whose `protocol_info` lists `steer.v1` gets a real `steer`; otherwise (the `omp` harness today) `fold` goes out as a queued prompt and `now` cancels the turn and goes out as a prompt the runner runs right after it. `steer_result` and `prompt_ack` reach the tabs and are not stored.
12
+ - `@skaile/forge-voice`: the README shows a `ConversationPort` over a forge-chat session that steers in `skaile` mode and falls back to `withSteerFallback` in `byok`.
13
+
3
14
  ## 0.1.0
4
15
 
5
16
  ### Minor Changes
package/README.md CHANGED
@@ -172,7 +172,7 @@ and buttons.
172
172
  import { createRelayTransport, createTalk, talkPhase, withSteerFallback } from '@skaile/forge-voice/browser'
173
173
 
174
174
  const talk = createTalk({
175
- conversation: withSteerFallback(myConversationPort), // drop the wrapper if your agent can steer
175
+ conversation: withSteerFallback(myConversationPort), // drop the wrapper if your agent can steer (see below)
176
176
  speech: createRelayTransport({ baseUrl: '/api', scope: () => ({ spaceId }) }),
177
177
  storage: localStorage, // home language, tool durations; optional
178
178
  voice: { voiceId, speakLanguages: ['de', 'en'], deviceLocale: navigator.language },
@@ -206,6 +206,47 @@ A `now` send then cancels the turn, waits for it to end (5 s at most) and goes o
206
206
  a `fold` send is held until the turn ends. Held words are sent once: a `now` message carries those it
207
207
  does not already repeat, and `cancelTurn` (a hush, a tap) drops them with the turn.
208
208
 
209
+ #### A forge app: real steer in `skaile` mode, the fallback in `byok`
210
+
211
+ A `@skaile/forge-chat` session steers when its transport does (`session.canSteer`): the `skaile`
212
+ engine of `@skaile/forge-layer-workspace-agent` sends `workspaceAgent.steer`, and the server picks
213
+ the way (a real `steer` where the run's harness takes one; otherwise a queued prompt for `fold`, and
214
+ a cancel and resend for `now`). The AI SDK transport of `byok` has no `steer`, so that port goes through
215
+ `withSteerFallback`. The send side of such a port:
216
+
217
+ ```ts
218
+ import type { ChatSession } from '@skaile/forge-chat'
219
+ import type { ConversationPort } from '@skaile/forge-voice/browser'
220
+ import { withSteerFallback } from '@skaile/forge-voice/browser'
221
+
222
+ function chatConversation(session: ChatSession, subscribe: ConversationPort['subscribe']): ConversationPort {
223
+ // `send` is false for a turn the barge-in cancelled too (AI SDK): only a real error may be retried.
224
+ const failed = () => {
225
+ const error = session.state.get().error
226
+ if (error) throw new Error(error)
227
+ return undefined
228
+ }
229
+ const port: ConversationPort = {
230
+ async send({ text, steer }) {
231
+ if (steer && session.canSteer) {
232
+ const sent = await session.steer(text, steer) // shown in the transcript at once
233
+ return sent ? sent.promptId : failed()
234
+ }
235
+ return (await session.send(text)) ? undefined : failed()
236
+ },
237
+ cancelTurn: () => void session.abort(),
238
+ markInterrupted: async () => ({ marked: true }), // or add "the user heard up to: …" to the next prompt
239
+ subscribe, // turn / text / toolStarted / toolEnded / turnEnded from the session's events
240
+ }
241
+ // Without steer a send while the turn runs would be refused: hold or cancel-and-resend it instead.
242
+ return session.canSteer ? port : withSteerFallback(port)
243
+ }
244
+ ```
245
+
246
+ `session.steer` while no turn runs is a plain `send`. The skaile server answers a real steer with a
247
+ `steer-result` event (`steered`, `started_turn`, or `unsupported`, which it has already resent as a
248
+ prompt), which the session hands to `onEvent`.
249
+
209
250
  ### Options and controls
210
251
 
211
252
  | Option | Notes |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skaile/forge-voice",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "type": "module",
5
5
  "description": "Headless voice conversation stack: shared speech types and wire protocol, audio tags, keyterm budget, a browser engine (capture, VAD and barge-in, echo filter, streaming speech playback) with a relay transport and a turn-taking Talk session over the host's agent, and a framework-free relay to Deepgram (speech to text) and ElevenLabs (text to speech) with forced provider privacy settings, plus an h3 adapter.",
6
6
  "license": "MIT",