@fungi.computer/agar 0.0.0-stage → 0.0.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.
- package/LICENSE +21 -0
- package/README.md +766 -2
- package/dist/agent-message-meta.d.ts +74 -0
- package/dist/agent-message-meta.js +63 -0
- package/dist/agents.d.ts +170 -0
- package/dist/agents.js +218 -0
- package/dist/app-build-contract.d.ts +43 -0
- package/dist/app-build-contract.js +24 -0
- package/dist/apps.d.ts +66 -0
- package/dist/apps.js +47 -0
- package/dist/backend-declaration.d.ts +6 -0
- package/dist/backend-declaration.js +65 -0
- package/dist/backend-definition.d.ts +88 -0
- package/dist/backend-definition.js +158 -0
- package/dist/backend-refusal.d.ts +10 -0
- package/dist/backend-refusal.js +10 -0
- package/dist/backend.d.ts +30 -0
- package/dist/backend.js +28 -0
- package/dist/capabilities.d.ts +30 -0
- package/dist/capabilities.js +50 -0
- package/dist/channels.d.ts +142 -0
- package/dist/channels.js +97 -0
- package/dist/commands.d.ts +33 -0
- package/dist/commands.js +46 -0
- package/dist/computer-contracts.d.ts +73 -0
- package/dist/computer-contracts.js +57 -0
- package/dist/computer.d.ts +294 -0
- package/dist/computer.js +319 -0
- package/dist/connect.d.ts +11 -0
- package/dist/connect.js +211 -0
- package/dist/errors.d.ts +34 -0
- package/dist/errors.js +106 -0
- package/dist/failure.d.ts +2 -0
- package/dist/failure.js +9 -0
- package/dist/files.d.ts +25 -0
- package/dist/files.js +84 -0
- package/dist/game-servers.d.ts +530 -0
- package/dist/game-servers.js +244 -0
- package/dist/gills.d.ts +43 -0
- package/dist/gills.js +174 -0
- package/dist/git-commit.d.ts +143 -0
- package/dist/git-commit.js +251 -0
- package/dist/git-rpc.d.ts +310 -0
- package/dist/git-rpc.js +166 -0
- package/dist/git-steps.d.ts +579 -0
- package/dist/git-steps.js +804 -0
- package/dist/git-wire.d.ts +33 -0
- package/dist/git-wire.js +240 -0
- package/dist/git.d.ts +322 -0
- package/dist/git.js +98 -0
- package/dist/host.d.ts +97 -0
- package/dist/host.js +732 -0
- package/dist/inbox.d.ts +99 -0
- package/dist/inbox.js +184 -0
- package/dist/index.d.ts +31 -0
- package/dist/index.js +15 -0
- package/dist/inference.d.ts +17 -0
- package/dist/inference.js +115 -0
- package/dist/internal/app-error.d.ts +8 -0
- package/dist/internal/app-error.js +36 -0
- package/dist/internal/app-session.d.ts +8 -0
- package/dist/internal/app-session.js +551 -0
- package/dist/internal/back-inputs.d.ts +22 -0
- package/dist/internal/back-inputs.js +93 -0
- package/dist/internal/browser-bridge.d.ts +30 -0
- package/dist/internal/browser-bridge.js +203 -0
- package/dist/internal/capabilities.d.ts +13 -0
- package/dist/internal/capabilities.js +138 -0
- package/dist/internal/commands.d.ts +9 -0
- package/dist/internal/commands.js +257 -0
- package/dist/internal/disconnect-host.d.ts +7 -0
- package/dist/internal/disconnect-host.js +19 -0
- package/dist/internal/git-edit-tree.d.ts +6 -0
- package/dist/internal/git-edit-tree.js +46 -0
- package/dist/internal/memory-fs.d.ts +39 -0
- package/dist/internal/memory-fs.js +154 -0
- package/dist/internal/protocol.d.ts +116 -0
- package/dist/internal/protocol.js +6 -0
- package/dist/internal/query-feed.d.ts +23 -0
- package/dist/internal/query-feed.js +111 -0
- package/dist/internal/result.d.ts +22 -0
- package/dist/internal/result.js +61 -0
- package/dist/internal/rpc-contract.d.ts +24 -0
- package/dist/internal/rpc-contract.js +78 -0
- package/dist/internal/schemas.d.ts +307 -0
- package/dist/internal/schemas.js +524 -0
- package/dist/internal/store.d.ts +8 -0
- package/dist/internal/store.js +30 -0
- package/dist/internal/terminal-gate.d.ts +17 -0
- package/dist/internal/terminal-gate.js +94 -0
- package/dist/lifecycle.d.ts +44 -0
- package/dist/lifecycle.js +1 -0
- package/dist/marketplace.d.ts +159 -0
- package/dist/marketplace.js +102 -0
- package/dist/media-json.d.ts +181 -0
- package/dist/media-json.js +204 -0
- package/dist/media-library.d.ts +11 -0
- package/dist/media-library.js +15 -0
- package/dist/media-request-id.d.ts +7 -0
- package/dist/media-request-id.js +16 -0
- package/dist/media.d.ts +354 -0
- package/dist/media.js +654 -0
- package/dist/method-refusal.d.ts +64 -0
- package/dist/method-refusal.js +48 -0
- package/dist/pending.d.ts +10 -0
- package/dist/pending.js +10 -0
- package/dist/query.d.ts +76 -0
- package/dist/query.js +195 -0
- package/dist/react-mount.d.ts +23 -0
- package/dist/react-mount.js +108 -0
- package/dist/react.d.ts +41 -0
- package/dist/react.js +111 -0
- package/dist/read-copy.d.ts +103 -0
- package/dist/read-copy.js +195 -0
- package/dist/roles/files.d.ts +295 -0
- package/dist/roles/files.js +184 -0
- package/dist/root.d.ts +21 -0
- package/dist/root.js +1 -0
- package/dist/rpc.d.ts +1 -0
- package/dist/rpc.js +1 -0
- package/dist/status.d.ts +17 -0
- package/dist/status.js +50 -0
- package/dist/storage-wire.d.ts +167 -0
- package/dist/storage-wire.js +115 -0
- package/dist/storage.d.ts +72 -0
- package/dist/storage.js +143 -0
- package/dist/store.d.ts +11 -0
- package/dist/store.js +1 -0
- package/dist/test-kit/git.d.ts +31 -0
- package/dist/test-kit/git.js +174 -0
- package/dist/ui.d.ts +169 -0
- package/dist/ui.js +10 -0
- package/dist/window.d.ts +41 -0
- package/dist/window.js +15 -0
- package/dist/world.d.ts +16 -0
- package/dist/world.js +17 -0
- package/docs/api/README.md +28 -0
- package/docs/api/app-build-contract.md +113 -0
- package/docs/api/backend-declaration.md +62 -0
- package/docs/api/backend-definition.md +215 -0
- package/docs/api/backend.md +269 -0
- package/docs/api/errors.md +169 -0
- package/docs/api/files.md +91 -0
- package/docs/api/gills.md +164 -0
- package/docs/api/git-commit.md +279 -0
- package/docs/api/git-rpc.md +243 -0
- package/docs/api/git-steps.md +1010 -0
- package/docs/api/git-wire.md +197 -0
- package/docs/api/git.md +579 -0
- package/docs/api/index.md +2880 -0
- package/docs/api/media-json.md +507 -0
- package/docs/api/media-request-id.md +32 -0
- package/docs/api/modules.md +32 -0
- package/docs/api/query.md +253 -0
- package/docs/api/react.md +216 -0
- package/docs/api/read-copy.md +204 -0
- package/docs/api/rpc.md +128 -0
- package/docs/api/storage.md +620 -0
- package/package.json +197 -3
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
<!-- Generated by Botanical API docs (TypeDoc + typedoc-plugin-markdown). Do not edit. -->
|
|
2
|
+
|
|
3
|
+
[**@fungi.computer/agar**](README.md)
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
[@fungi.computer/agar](modules.md) / query
|
|
8
|
+
|
|
9
|
+
# query
|
|
10
|
+
|
|
11
|
+
## Type Aliases
|
|
12
|
+
|
|
13
|
+
### FeedSnapshot
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
type FeedSnapshot<T> =
|
|
17
|
+
| Readonly<{
|
|
18
|
+
status: "live";
|
|
19
|
+
data: T;
|
|
20
|
+
}>
|
|
21
|
+
| Readonly<{
|
|
22
|
+
status: "loading" | "error";
|
|
23
|
+
data?: T;
|
|
24
|
+
}>;
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
A feed can lose its connection without losing its last owner snapshot.
|
|
28
|
+
|
|
29
|
+
#### Type Parameters
|
|
30
|
+
|
|
31
|
+
| Type Parameter |
|
|
32
|
+
| -------------- |
|
|
33
|
+
| `T` |
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
### FeedWatch
|
|
38
|
+
|
|
39
|
+
```ts
|
|
40
|
+
type FeedWatch<T> = (onChange, signal) => Disposer | Promise<Disposer>;
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Start a live feed, calling `onChange` with each snapshot until `signal` aborts;
|
|
44
|
+
the returned (or resolved) Disposer tears it down.
|
|
45
|
+
|
|
46
|
+
#### Type Parameters
|
|
47
|
+
|
|
48
|
+
| Type Parameter |
|
|
49
|
+
| -------------- |
|
|
50
|
+
| `T` |
|
|
51
|
+
|
|
52
|
+
#### Parameters
|
|
53
|
+
|
|
54
|
+
| Parameter | Type |
|
|
55
|
+
| ---------- | ---------------------- |
|
|
56
|
+
| `onChange` | (`snapshot`) => `void` |
|
|
57
|
+
| `signal` | `AbortSignal` |
|
|
58
|
+
|
|
59
|
+
#### Returns
|
|
60
|
+
|
|
61
|
+
\| [`Disposer`](index.md#disposer) \|
|
|
62
|
+
`Promise`\<[`Disposer`](index.md#disposer)\>
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
### QueryApp
|
|
67
|
+
|
|
68
|
+
```ts
|
|
69
|
+
type QueryApp = Pick<AppRoot, "identity" | "context" | "capabilities">;
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
The App-owned identity and grants needed by the query integration.
|
|
73
|
+
|
|
74
|
+
## Variables
|
|
75
|
+
|
|
76
|
+
### queryKeys
|
|
77
|
+
|
|
78
|
+
```ts
|
|
79
|
+
const queryKeys: object;
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Cache identity belongs to an App surface and its selected Computer.
|
|
83
|
+
|
|
84
|
+
#### Type Declaration
|
|
85
|
+
|
|
86
|
+
| Name | Type | Description |
|
|
87
|
+
| ------ | ------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- |
|
|
88
|
+
| `of()` | (`app`, ...`parts`) => readonly \[`string` \| `null`, `string` \| `null`, `unknown`\] | Build a cache key scoped to this App's surface and its currently selected Computer, followed by the given key parts. |
|
|
89
|
+
|
|
90
|
+
## Functions
|
|
91
|
+
|
|
92
|
+
### useFeedQuery()
|
|
93
|
+
|
|
94
|
+
```ts
|
|
95
|
+
function useFeedQuery<T>(
|
|
96
|
+
queryKey,
|
|
97
|
+
watch,
|
|
98
|
+
options?,
|
|
99
|
+
): UseQueryResult<FeedSnapshot<T>, AppError>;
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Query owns sharing and teardown; Effect supplies a bounded latest-snapshot
|
|
103
|
+
queue.
|
|
104
|
+
|
|
105
|
+
#### Type Parameters
|
|
106
|
+
|
|
107
|
+
| Type Parameter |
|
|
108
|
+
| -------------- |
|
|
109
|
+
| `T` |
|
|
110
|
+
|
|
111
|
+
#### Parameters
|
|
112
|
+
|
|
113
|
+
| Parameter | Type |
|
|
114
|
+
| ------------------ | ---------------------------------------------------------------------- |
|
|
115
|
+
| `queryKey` | readonly `unknown`[] |
|
|
116
|
+
| `watch` | [`FeedWatch`](#feedwatch)\<`T`\> |
|
|
117
|
+
| `options` | \{ `enabled?`: `boolean`; `meta?`: `Record`\<`string`, `unknown`\>; \} |
|
|
118
|
+
| `options.enabled?` | `boolean` |
|
|
119
|
+
| `options.meta?` | `Record`\<`string`, `unknown`\> |
|
|
120
|
+
|
|
121
|
+
#### Returns
|
|
122
|
+
|
|
123
|
+
`UseQueryResult`\<[`FeedSnapshot`](#feedsnapshot)\<`T`\>,
|
|
124
|
+
[`AppError`](errors.md#apperror)\>
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
### createQueryClient()
|
|
129
|
+
|
|
130
|
+
```ts
|
|
131
|
+
function createQueryClient(): QueryClient;
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
App defaults and grant lifetime binding, using the host's ordinary cache.
|
|
135
|
+
|
|
136
|
+
#### Returns
|
|
137
|
+
|
|
138
|
+
`QueryClient`
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
### capabilityQuery()
|
|
143
|
+
|
|
144
|
+
```ts
|
|
145
|
+
function capabilityQuery<H, T>(
|
|
146
|
+
app,
|
|
147
|
+
contract,
|
|
148
|
+
queryKey,
|
|
149
|
+
run,
|
|
150
|
+
): OmitKeyof<UseQueryOptions<T, AppError, T, readonly unknown[]>, "queryFn"> &
|
|
151
|
+
object &
|
|
152
|
+
QueryKeyWithDataTag<readonly unknown[], T, AppError>;
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
Decode capabilities through their owner; Query owns cancellation and retries.
|
|
156
|
+
|
|
157
|
+
#### Type Parameters
|
|
158
|
+
|
|
159
|
+
| Type Parameter |
|
|
160
|
+
| -------------- |
|
|
161
|
+
| `H` |
|
|
162
|
+
| `T` |
|
|
163
|
+
|
|
164
|
+
#### Parameters
|
|
165
|
+
|
|
166
|
+
| Parameter | Type |
|
|
167
|
+
| ---------- | ---------------------------------------------------------- |
|
|
168
|
+
| `app` | [`QueryApp`](#queryapp) \| `null` |
|
|
169
|
+
| `contract` | [`CapabilityContract`](index.md#capabilitycontract)\<`H`\> |
|
|
170
|
+
| `queryKey` | readonly `unknown`[] |
|
|
171
|
+
| `run` | (`handle`, `signal`) => `Promise`\<`T`\> |
|
|
172
|
+
|
|
173
|
+
#### Returns
|
|
174
|
+
|
|
175
|
+
`OmitKeyof`\<`UseQueryOptions`\<`T`, [`AppError`](errors.md#apperror), `T`,
|
|
176
|
+
readonly `unknown`[]\>, `"queryFn"`\> & `object` &
|
|
177
|
+
`QueryKeyWithDataTag`\<readonly `unknown`[], `T`,
|
|
178
|
+
[`AppError`](errors.md#apperror)\>
|
|
179
|
+
|
|
180
|
+
---
|
|
181
|
+
|
|
182
|
+
### optimisticMutation()
|
|
183
|
+
|
|
184
|
+
```ts
|
|
185
|
+
function optimisticMutation<TData, TVars, TResult>(
|
|
186
|
+
options,
|
|
187
|
+
): WithRequired<
|
|
188
|
+
UseMutationOptions<
|
|
189
|
+
TResult,
|
|
190
|
+
AppError,
|
|
191
|
+
TVars,
|
|
192
|
+
| {
|
|
193
|
+
previous: TData;
|
|
194
|
+
optimistic: TData | undefined;
|
|
195
|
+
}
|
|
196
|
+
| undefined
|
|
197
|
+
>,
|
|
198
|
+
"mutationKey"
|
|
199
|
+
>;
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
Optimistic writes for one cache entry, followed by owner reconciliation. Apply
|
|
203
|
+
must return new data. Concurrent writes to this key run in order; queued writes
|
|
204
|
+
wait for reconciliation instead of stacking rollback snapshots.
|
|
205
|
+
|
|
206
|
+
#### Type Parameters
|
|
207
|
+
|
|
208
|
+
| Type Parameter | Default type |
|
|
209
|
+
| -------------- | ------------ |
|
|
210
|
+
| `TData` | - |
|
|
211
|
+
| `TVars` | - |
|
|
212
|
+
| `TResult` | `unknown` |
|
|
213
|
+
|
|
214
|
+
#### Parameters
|
|
215
|
+
|
|
216
|
+
| Parameter | Type |
|
|
217
|
+
| -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
218
|
+
| `options` | \{ `queryKey`: readonly `unknown`[]; `mutationFn`: `MutationFunction`\<`TResult`, `TVars`\>; `apply`: (`previous`, `variables`) => `TData`; \} |
|
|
219
|
+
| `options.queryKey` | readonly `unknown`[] |
|
|
220
|
+
| `options.mutationFn` | `MutationFunction`\<`TResult`, `TVars`\> |
|
|
221
|
+
| `options.apply` | (`previous`, `variables`) => `TData` |
|
|
222
|
+
|
|
223
|
+
#### Returns
|
|
224
|
+
|
|
225
|
+
`WithRequired`\<`UseMutationOptions`\<`TResult`,
|
|
226
|
+
[`AppError`](errors.md#apperror), `TVars`, \| \{ `previous`: `TData`;
|
|
227
|
+
`optimistic`: `TData` \| `undefined`; \} \| `undefined`\>, `"mutationKey"`\>
|
|
228
|
+
|
|
229
|
+
---
|
|
230
|
+
|
|
231
|
+
### useMemberInbox()
|
|
232
|
+
|
|
233
|
+
```ts
|
|
234
|
+
function useMemberInbox(app): object;
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
One shared inbox watch; reloads and stream failures retain the last live rows.
|
|
238
|
+
|
|
239
|
+
#### Parameters
|
|
240
|
+
|
|
241
|
+
| Parameter | Type |
|
|
242
|
+
| --------- | --------------------------------- |
|
|
243
|
+
| `app` | [`QueryApp`](#queryapp) \| `null` |
|
|
244
|
+
|
|
245
|
+
#### Returns
|
|
246
|
+
|
|
247
|
+
| Name | Type | Default value | Description |
|
|
248
|
+
| ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------- | ------------------------------------------------------------------------------------------------- |
|
|
249
|
+
| `items` | readonly ( \| \{ `agentId`: `string`; `sessionId`: `string`; `title`: `string`; `triggerId?`: `string`; `createdAt`: `number`; `lastActivityAt`: `number`; `settledAt?`: `number`; `visitedAt?`: `number`; `state`: `"running"` \| `"done"` \| `"needs_you"` \| `"errored"`; \} \| \{ `agentId`: `string`; `sessionId`: `string`; `state`: `"unavailable"`; \} \| \{ `kind`: `"workflow-review"`; `key`: \{ `runId`: `string`; `nodeId`: `string`; `iteration`: `string`; \}; `installationId`: `string`; `workflowId`: `string` \| `null`; `workflowTitle`: `string`; `reviewTitle`: `string`; `reviewers`: `"runner"` \| `"owners"`; `show`: readonly `Json`[]; `choices?`: readonly `string`[]; `openedAt`: `number`; `expiresAt`: `number`; `state`: `"pending"` \| `"closed"` \| `"answered"` \| `"delivered"` \| `"timed_out"`; \})[] | - | - |
|
|
250
|
+
| `status` | `"error"` \| `"loading"` \| `"live"` | - | - |
|
|
251
|
+
| `error` | [`AppError`](errors.md#apperror) \| `null` | `query.error` | - |
|
|
252
|
+
| `refresh()` | () => `void` | - | Restart the inbox watch; use after a change that the live feed would not otherwise observe. |
|
|
253
|
+
| `visit()` | (`agentId`, `sessionId`) => `Promise`\<`void`\> | - | Record that the member visited one agent session, so the inbox can clear its unread state for it. |
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
<!-- Generated by Botanical API docs (TypeDoc + typedoc-plugin-markdown). Do not edit. -->
|
|
2
|
+
|
|
3
|
+
[**@fungi.computer/agar**](README.md)
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
[@fungi.computer/agar](modules.md) / react
|
|
8
|
+
|
|
9
|
+
# react
|
|
10
|
+
|
|
11
|
+
## Type Aliases
|
|
12
|
+
|
|
13
|
+
### AppMountState
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
type AppMountState = Readonly<
|
|
17
|
+
| {
|
|
18
|
+
app: AppRoot;
|
|
19
|
+
status: "live";
|
|
20
|
+
}
|
|
21
|
+
| {
|
|
22
|
+
app: null;
|
|
23
|
+
status: "connecting" | "standalone" | "ended";
|
|
24
|
+
}
|
|
25
|
+
>;
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
The App connection state passed to `mountApp`'s `render` callback: `live` once
|
|
29
|
+
connected, or `connecting`/`standalone`/`ended` while there is no usable App.
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
### AppMountOptions
|
|
34
|
+
|
|
35
|
+
```ts
|
|
36
|
+
type AppMountOptions = Readonly<{
|
|
37
|
+
name: string;
|
|
38
|
+
queryClient?: QueryClient;
|
|
39
|
+
}>;
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Options passed to `mountApp`.
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
### HostNavigationOptions
|
|
47
|
+
|
|
48
|
+
```ts
|
|
49
|
+
type HostNavigationOptions = Readonly<{
|
|
50
|
+
canGoBack: boolean;
|
|
51
|
+
title?: string;
|
|
52
|
+
onBack: AppBackHandler;
|
|
53
|
+
}>;
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
What an App's router can do now, and how it goes back.
|
|
57
|
+
|
|
58
|
+
## Functions
|
|
59
|
+
|
|
60
|
+
### mountApp()
|
|
61
|
+
|
|
62
|
+
```ts
|
|
63
|
+
function mountApp(element, options, render): Disposer;
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Own this page's React root, authenticated App connection and host theme.
|
|
67
|
+
|
|
68
|
+
#### Parameters
|
|
69
|
+
|
|
70
|
+
| Parameter | Type |
|
|
71
|
+
| --------- | ------------------------------------- |
|
|
72
|
+
| `element` | `HTMLElement` |
|
|
73
|
+
| `options` | [`AppMountOptions`](#appmountoptions) |
|
|
74
|
+
| `render` | (`state`) => `ReactNode` |
|
|
75
|
+
|
|
76
|
+
#### Returns
|
|
77
|
+
|
|
78
|
+
[`Disposer`](index.md#disposer)
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
### useStore()
|
|
83
|
+
|
|
84
|
+
```ts
|
|
85
|
+
function useStore<T>(store): T | undefined;
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Read an SDK snapshot and release its subscription when the store changes.
|
|
89
|
+
|
|
90
|
+
#### Type Parameters
|
|
91
|
+
|
|
92
|
+
| Type Parameter |
|
|
93
|
+
| -------------- |
|
|
94
|
+
| `T` |
|
|
95
|
+
|
|
96
|
+
#### Parameters
|
|
97
|
+
|
|
98
|
+
| Parameter | Type |
|
|
99
|
+
| --------- | --------------------------------------------------------------- |
|
|
100
|
+
| `store` | [`ReadonlyStore`](index.md#readonlystore)\<`T`\> \| `undefined` |
|
|
101
|
+
|
|
102
|
+
#### Returns
|
|
103
|
+
|
|
104
|
+
`T` \| `undefined`
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
### useAppContext()
|
|
109
|
+
|
|
110
|
+
```ts
|
|
111
|
+
function useAppContext(app): AppContext | null;
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Read the App's live context (focus, visibility, Computer selection, any pending
|
|
115
|
+
open request), or null while there is no connected App.
|
|
116
|
+
|
|
117
|
+
#### Parameters
|
|
118
|
+
|
|
119
|
+
| Parameter | Type |
|
|
120
|
+
| --------- | ------------------------------------------------------ |
|
|
121
|
+
| `app` | [`AppRoot`](index.md#approot) \| `null` \| `undefined` |
|
|
122
|
+
|
|
123
|
+
#### Returns
|
|
124
|
+
|
|
125
|
+
[`AppContext`](index.md#appcontext) \| `null`
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
### useComputerId()
|
|
130
|
+
|
|
131
|
+
```ts
|
|
132
|
+
function useComputerId(app): string | null;
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Read the id of the Computer currently selected for this App, or null when no App
|
|
136
|
+
is connected or no Computer is selected yet.
|
|
137
|
+
|
|
138
|
+
#### Parameters
|
|
139
|
+
|
|
140
|
+
| Parameter | Type |
|
|
141
|
+
| --------- | ------------------------------------------------------ |
|
|
142
|
+
| `app` | [`AppRoot`](index.md#approot) \| `null` \| `undefined` |
|
|
143
|
+
|
|
144
|
+
#### Returns
|
|
145
|
+
|
|
146
|
+
`string` \| `null`
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
### useWindowStatus()
|
|
151
|
+
|
|
152
|
+
```ts
|
|
153
|
+
function useWindowStatus(app, items, onAction?, onReportFailure?): void;
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
Keep this window's status bar items current in the host while mounted, and hear
|
|
157
|
+
the person use them. Items compare by value; the bar clears on unmount.
|
|
158
|
+
|
|
159
|
+
#### Parameters
|
|
160
|
+
|
|
161
|
+
| Parameter | Type | Description |
|
|
162
|
+
| ------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------ |
|
|
163
|
+
| `app` | `Pick`\<[`AppRoot`](index.md#approot), `"ui"`\> \| `null` \| `undefined` | - |
|
|
164
|
+
| `items` | readonly [`AppStatusItem`](index.md#appstatusitem)[] | - |
|
|
165
|
+
| `onAction?` | [`AppStatusActionHandler`](index.md#appstatusactionhandler) | - |
|
|
166
|
+
| `onReportFailure?` | (`cause`) => `void` | Hear a report the host refused, so the App can say so. |
|
|
167
|
+
|
|
168
|
+
#### Returns
|
|
169
|
+
|
|
170
|
+
`void`
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
### useAppCommandCatalog()
|
|
175
|
+
|
|
176
|
+
```ts
|
|
177
|
+
function useAppCommandCatalog(app, __namedParameters, build): WhistleRuntime;
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
Own one catalog's local slash runtime and host registrations. Memoize `build`
|
|
181
|
+
with useCallback; changing it replaces the catalog and its availability.
|
|
182
|
+
|
|
183
|
+
#### Parameters
|
|
184
|
+
|
|
185
|
+
| Parameter | Type |
|
|
186
|
+
| ------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
187
|
+
| `app` | [`AppRoot`](index.md#approot) \| `null` \| `undefined` |
|
|
188
|
+
| `__namedParameters` | `Pick`\<`WhistleContribution`, `"sourceId"` \| `"namespace"`\> |
|
|
189
|
+
| `build` | () => readonly `Readonly`\<\{ `id`: `string`; `title`: `string`; `category`: `string`; `description?`: `string`; `projections?`: \{ `bindings?`: \{ `order?`: `number`; `values`: readonly `string`[]; \}; `agent?`: \{ `keybind?`: `string`; `order?`: `number`; \}; `help?`: \{ `order?`: `number`; \}; `menu?`: \{ `order?`: `number`; \}; `palette?`: \{ `order?`: `number`; \}; `slash?`: \{ `aliases`: readonly `string`[]; `order?`: `number`; `arguments?`: \{ `hint`: `string`; `words?`: ... \| ...; `text?`: ... \| ...; \}; \}; \}; `action?`: \{ `inputSchema?`: \{ \[`key`: `string`\]: \| `string` \| `number` \| `boolean` \| readonly string \| number \| boolean \| readonly (string \| number \| boolean \| readonly (string \| number \| boolean \| readonly (string \| number \| boolean \| readonly (string \| number \| boolean \| readonly (string \| number \| boolean \| readonly (string \| ... 4 more ... \| null)\[\] \| \{ ...; \} \| null)\[\] \| \{ ...; \} \| null)\[\] \| \{ ...; \} \| ...[] \| \{ \[`key`: `string`\]: string \| number \| boolean \| readonly (string \| number \| boolean \| readonly (string \| number \| boolean \| readonly (string \| number \| boolean \| readonly (string \| number \| boolean \| readonly (string \| number \| boolean \| readonly (string \| ... 4 more ... \| null)\[\] \| \{ ...; \} \| null)\[\] \| \{ ...; \} \| null)\[\] \| \{ ...; \} \| ...; \} \| `null`; \}; `outputSchema?`: \{ \[`key`: `string`\]: \| `string` \| `number` \| `boolean` \| readonly string \| number \| boolean \| readonly (string \| number \| boolean \| readonly (string \| number \| boolean \| readonly (string \| number \| boolean \| readonly (string \| number \| boolean \| readonly (string \| number \| boolean \| readonly (string \| ... 4 more ... \| null)\[\] \| \{ ...; \} \| null)\[\] \| \{ ...; \} \| null)\[\] \| \{ ...; \} \| ...[] \| \{ \[`key`: `string`\]: string \| number \| boolean \| readonly (string \| number \| boolean \| readonly (string \| number \| boolean \| readonly (string \| number \| boolean \| readonly (string \| number \| boolean \| readonly (string \| number \| boolean \| readonly (string \| ... 4 more ... \| null)\[\] \| \{ ...; \} \| null)\[\] \| \{ ...; \} \| null)\[\] \| \{ ...; \} \| ...; \} \| `null`; \}; `presentation?`: \| \{ `type`: `"action"`; \} \| \{ `type`: `"custom"`; `data`: \{ \[`key`: `string`\]: \| `string` \| `number` \| `boolean` \| readonly ...[] \| \{ \[`key`: ...\]: ...; \} \| `null`; \}; \} \| \{ `type`: `"choice"`; `options`: readonly `object`[]; \} \| \{ `type`: `"form"`; `submitLabel?`: `string`; \} \| \{ `type`: `"confirmation"`; `message`: `string`; `confirmLabel?`: `string`; `cancelLabel?`: `string`; \}; \}; `availability?`: () => `WhistleAvailability`; `handler`: (`input`) => `unknown`; \}\>[] |
|
|
190
|
+
|
|
191
|
+
#### Returns
|
|
192
|
+
|
|
193
|
+
`WhistleRuntime`
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
### useHostNavigation()
|
|
198
|
+
|
|
199
|
+
```ts
|
|
200
|
+
function useHostNavigation(navigation, __namedParameters): void;
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
Publish an App's navigation state to its host and own the host's Back requests
|
|
204
|
+
while mounted. Pass `app?.window.navigation`; with no connected App it does
|
|
205
|
+
nothing. Unmounting withdraws Back from the host chrome.
|
|
206
|
+
|
|
207
|
+
#### Parameters
|
|
208
|
+
|
|
209
|
+
| Parameter | Type |
|
|
210
|
+
| ------------------- | -------------------------------------------------------------------------------------------------------------------------- |
|
|
211
|
+
| `navigation` | \| `Readonly`\<\{ `publish`: `Promise`\<`void`\>; `onBack`: [`Disposer`](index.md#disposer); \}\> \| `null` \| `undefined` |
|
|
212
|
+
| `__namedParameters` | [`HostNavigationOptions`](#hostnavigationoptions) |
|
|
213
|
+
|
|
214
|
+
#### Returns
|
|
215
|
+
|
|
216
|
+
`void`
|