@workerdeck/react 0.7.0 → 0.11.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/README.md +32 -2
- package/build/index.d.mts +579 -8
- package/build/index.mjs +1099 -13
- package/build/index.mjs.map +1 -1
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -77,11 +77,41 @@ stream doesn't carry yet; events stay authoritative once they arrive.
|
|
|
77
77
|
- `pendingApprovals` — permission requests awaiting an approve/deny decision.
|
|
78
78
|
- `status` / `statusDetail`, `model`, `cwd`, `sdkSessionId`, `permissionMode`.
|
|
79
79
|
- `models` and `commands` — what the session can switch to / accepts (from `capabilities`).
|
|
80
|
+
- `capabilities` — **the engine's capability record**, always present: the runner-reported copy
|
|
81
|
+
from the attach snapshot, else the protocol's static default for the engine. Render affordances
|
|
82
|
+
from this rather than switching on the engine name; an absent capability means the control is
|
|
83
|
+
*hidden*, never one that silently does nothing.
|
|
84
|
+
- `session` — the whole attach snapshot, for the facts no event carries (profile, `apiKeySource`,
|
|
85
|
+
`canBypassPermissions`, `createdAt`).
|
|
80
86
|
- `contextUsage`, `rateLimits` (keyed by window; absent for API-key sessions — render nothing,
|
|
81
|
-
not 0%)
|
|
87
|
+
not 0%) with `rateLimitsUpdatedAt`, `totalCostUsd` (session-cumulative), and `lastSeq` for
|
|
88
|
+
replay dedupe.
|
|
82
89
|
|
|
83
90
|
The reducer is pure and immutable: same events in, same state out — which is also how it is
|
|
84
|
-
unit-tested. Keep rendering logic out of it.
|
|
91
|
+
unit-tested. Keep rendering logic out of it. `rateLimitWindows(state)` and `scanPromptTokens(text)`
|
|
92
|
+
are the other pure helpers here, for the same reason: ordered usage windows and `@file` /
|
|
93
|
+
`/command` token recognition are string-and-shape work every client needs and every client should
|
|
94
|
+
agree on.
|
|
95
|
+
|
|
96
|
+
## Composing a message
|
|
97
|
+
|
|
98
|
+
Two more hooks cover what a composer needs beyond text, both capability-aware:
|
|
99
|
+
|
|
100
|
+
```tsx
|
|
101
|
+
const { state, send } = useClaudeSession(client, sessionId)
|
|
102
|
+
// Staging + upload, filtered by `capabilities.attachments`: a kind the engine
|
|
103
|
+
// forswears is refused locally instead of 415'ing at the gateway.
|
|
104
|
+
const attachments = useAttachments(client, sessionId, {
|
|
105
|
+
capabilities: state.capabilities,
|
|
106
|
+
engine: state.engine,
|
|
107
|
+
})
|
|
108
|
+
// `@file` search rooted at the session's cwd. `available` is false when the
|
|
109
|
+
// gateway serves no host files — don't advertise what isn't there.
|
|
110
|
+
const files = useHostFileSearch(client, state.cwd)
|
|
111
|
+
|
|
112
|
+
attachments.add(pickedFiles) // uploads start immediately
|
|
113
|
+
send(text, attachments.readyIds) // the message names ids; bytes never enter the event log
|
|
114
|
+
```
|
|
85
115
|
|
|
86
116
|
## Running tool calls in the tab
|
|
87
117
|
|