@skaile/workspace-bridge-react 0.29.1 → 0.31.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/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.31.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`2c7fe23`](https://github.com/skaile-ai/workspaces/commit/2c7fe23e751bd9efd6ad0af11033f2489deeb2d3), [`a1afc6a`](https://github.com/skaile-ai/workspaces/commit/a1afc6a8e4a5f347619f5c75d80a29f38994563a)]:
8
+ - @skaile/workspaces@0.31.0
9
+
10
+ ## 0.30.1
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies [[`72e099c`](https://github.com/skaile-ai/workspaces/commit/72e099cc09577d0c0c3c8f2445927fc8c880eaf5)]:
15
+ - @skaile/workspaces@0.30.1
16
+
17
+ ## 0.30.0
18
+
19
+ ### Patch Changes
20
+
21
+ - Updated dependencies [[`fe1066f`](https://github.com/skaile-ai/workspaces/commit/fe1066f746ea2eaf88e0618998a12df399640deb), [`dd48d44`](https://github.com/skaile-ai/workspaces/commit/dd48d44e4dd5d72ba92b47af3788c5ba70d18e3c), [`963fa56`](https://github.com/skaile-ai/workspaces/commit/963fa56c921d94d4defffa651f26de7d283c006a), [`ed78a7d`](https://github.com/skaile-ai/workspaces/commit/ed78a7d1f9e9de7cca8be861c6198b600aa85ba1)]:
22
+ - @skaile/workspaces@0.30.0
23
+
3
24
  ## 0.29.1
4
25
 
5
26
  ### Patch Changes
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { useCallback, useMemo, useSyncExternalStore } from \"react\";\nimport type {\n AgentStore,\n AgentStoreSnapshot,\n ConnectionStatus,\n ResourceClient,\n ResourceClientSnapshot,\n SubscribableStore,\n} from \"@skaile/workspaces/store\";\n\n/**\n * Subscribe to any {@link SubscribableStore} and re-render when its snapshot changes.\n *\n * Generic hook — works for {@link AgentStore}, {@link ResourceClient}, or any\n * future store implementing the same `subscribe`/`getSnapshot` contract.\n * Uses `useSyncExternalStore` internally for concurrent-mode safety.\n *\n * @typeParam T - Snapshot type the store exposes via `getSnapshot()`.\n * @param store - The store to subscribe to.\n * @returns The current immutable snapshot.\n *\n * @since 0.8.0\n */\nexport function useSubscribableStore<T>(store: SubscribableStore<T>): T {\n const subscribe = useCallback(\n (onStoreChange: () => void) => store.subscribe(onStoreChange),\n [store],\n );\n const getSnapshot = useCallback(() => store.getSnapshot(), [store]);\n return useSyncExternalStore(subscribe, getSnapshot, getSnapshot);\n}\n\n/**\n * Subscribe to an {@link AgentStore} and re-render whenever state changes.\n *\n * @param store - The store to subscribe to.\n * @returns Current immutable state snapshot.\n *\n * @example\n * ```tsx\n * function ChatPanel({ store }: { store: AgentStore }) {\n * const { messages, streamingText, phase } = useAgentStore(store)\n * // ...\n * }\n * ```\n */\nexport function useAgentStore(store: AgentStore): AgentStoreSnapshot {\n return useSubscribableStore(store);\n}\n\n/**\n * Return stable action dispatchers bound to an {@link AgentStore}.\n *\n * The returned object is referentially stable across renders (memoised on\n * `store` identity), so it is safe to pass as a dependency to `useCallback`\n * or `useMemo` without causing unnecessary re-computations.\n *\n * @param store - The store to bind actions to.\n *\n * @example\n * ```tsx\n * function ChatInput({ store }: { store: AgentStore }) {\n * const { prompt, cancel } = useAgentStoreActions(store)\n * return <button onClick={() => prompt('Hello')}>Send</button>\n * }\n * ```\n */\nexport function useAgentStoreActions(store: AgentStore) {\n return useMemo(\n () => ({\n /** Send a user prompt to the agent. */\n prompt: (text: string) => store.prompt(text),\n /** Send a reply to the agent's pending question. */\n reply: (answer: string) => store.reply(answer),\n /** Cancel the current agent turn. */\n cancel: () => store.cancel(),\n /** Load the previous page of messages. */\n loadPreviousMessages: () => store.loadPreviousMessages(),\n /** Programmatically update the connection status. */\n setStatus: (status: ConnectionStatus) => store.setStatus(status),\n }),\n [store],\n );\n}\n\n/**\n * Subscribe to a {@link ResourceClient} and re-render when resources change.\n *\n * @param client - The resource client to subscribe to.\n * @returns Current immutable resource snapshot (mounts + connectors).\n *\n * @example\n * ```tsx\n * function ResourcePanel({ client }: { client: ResourceClient }) {\n * const { mounts, connectors } = useResourceClient(client)\n * // ...\n * }\n * ```\n */\nexport function useResourceClient(client: ResourceClient): ResourceClientSnapshot {\n return useSubscribableStore(client);\n}\n"],"mappings":";AAAA,SAAS,aAAa,SAAS,4BAA4B;AAuBpD,SAAS,qBAAwB,OAAgC;AACtE,QAAM,YAAY;AAAA,IAChB,CAAC,kBAA8B,MAAM,UAAU,aAAa;AAAA,IAC5D,CAAC,KAAK;AAAA,EACR;AACA,QAAM,cAAc,YAAY,MAAM,MAAM,YAAY,GAAG,CAAC,KAAK,CAAC;AAClE,SAAO,qBAAqB,WAAW,aAAa,WAAW;AACjE;AAgBO,SAAS,cAAc,OAAuC;AACnE,SAAO,qBAAqB,KAAK;AACnC;AAmBO,SAAS,qBAAqB,OAAmB;AACtD,SAAO;AAAA,IACL,OAAO;AAAA;AAAA,MAEL,QAAQ,CAAC,SAAiB,MAAM,OAAO,IAAI;AAAA;AAAA,MAE3C,OAAO,CAAC,WAAmB,MAAM,MAAM,MAAM;AAAA;AAAA,MAE7C,QAAQ,MAAM,MAAM,OAAO;AAAA;AAAA,MAE3B,sBAAsB,MAAM,MAAM,qBAAqB;AAAA;AAAA,MAEvD,WAAW,CAAC,WAA6B,MAAM,UAAU,MAAM;AAAA,IACjE;AAAA,IACA,CAAC,KAAK;AAAA,EACR;AACF;AAgBO,SAAS,kBAAkB,QAAgD;AAChF,SAAO,qBAAqB,MAAM;AACpC;","names":[]}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type {\n AgentStore,\n AgentStoreSnapshot,\n ConnectionStatus,\n ResourceClient,\n ResourceClientSnapshot,\n SubscribableStore,\n} from \"@skaile/workspaces/store\";\nimport { useCallback, useMemo, useSyncExternalStore } from \"react\";\n\n/**\n * Subscribe to any {@link SubscribableStore} and re-render when its snapshot changes.\n *\n * Generic hook — works for {@link AgentStore}, {@link ResourceClient}, or any\n * future store implementing the same `subscribe`/`getSnapshot` contract.\n * Uses `useSyncExternalStore` internally for concurrent-mode safety.\n *\n * @typeParam T - Snapshot type the store exposes via `getSnapshot()`.\n * @param store - The store to subscribe to.\n * @returns The current immutable snapshot.\n *\n * @since 0.8.0\n */\nexport function useSubscribableStore<T>(store: SubscribableStore<T>): T {\n const subscribe = useCallback(\n (onStoreChange: () => void) => store.subscribe(onStoreChange),\n [store],\n );\n const getSnapshot = useCallback(() => store.getSnapshot(), [store]);\n return useSyncExternalStore(subscribe, getSnapshot, getSnapshot);\n}\n\n/**\n * Subscribe to an {@link AgentStore} and re-render whenever state changes.\n *\n * @param store - The store to subscribe to.\n * @returns Current immutable state snapshot.\n *\n * @example\n * ```tsx\n * function ChatPanel({ store }: { store: AgentStore }) {\n * const { messages, streamingText, phase } = useAgentStore(store)\n * // ...\n * }\n * ```\n */\nexport function useAgentStore(store: AgentStore): AgentStoreSnapshot {\n return useSubscribableStore(store);\n}\n\n/**\n * Return stable action dispatchers bound to an {@link AgentStore}.\n *\n * The returned object is referentially stable across renders (memoised on\n * `store` identity), so it is safe to pass as a dependency to `useCallback`\n * or `useMemo` without causing unnecessary re-computations.\n *\n * @param store - The store to bind actions to.\n *\n * @example\n * ```tsx\n * function ChatInput({ store }: { store: AgentStore }) {\n * const { prompt, cancel } = useAgentStoreActions(store)\n * return <button onClick={() => prompt('Hello')}>Send</button>\n * }\n * ```\n */\nexport function useAgentStoreActions(store: AgentStore) {\n return useMemo(\n () => ({\n /** Send a user prompt to the agent. */\n prompt: (text: string) => store.prompt(text),\n /** Send a reply to the agent's pending question. */\n reply: (answer: string) => store.reply(answer),\n /** Cancel the current agent turn. */\n cancel: () => store.cancel(),\n /** Load the previous page of messages. */\n loadPreviousMessages: () => store.loadPreviousMessages(),\n /** Programmatically update the connection status. */\n setStatus: (status: ConnectionStatus) => store.setStatus(status),\n }),\n [store],\n );\n}\n\n/**\n * Subscribe to a {@link ResourceClient} and re-render when resources change.\n *\n * @param client - The resource client to subscribe to.\n * @returns Current immutable resource snapshot (mounts + connectors).\n *\n * @example\n * ```tsx\n * function ResourcePanel({ client }: { client: ResourceClient }) {\n * const { mounts, connectors } = useResourceClient(client)\n * // ...\n * }\n * ```\n */\nexport function useResourceClient(client: ResourceClient): ResourceClientSnapshot {\n return useSubscribableStore(client);\n}\n"],"mappings":";AAQA,SAAS,aAAa,SAAS,4BAA4B;AAepD,SAAS,qBAAwB,OAAgC;AACtE,QAAM,YAAY;AAAA,IAChB,CAAC,kBAA8B,MAAM,UAAU,aAAa;AAAA,IAC5D,CAAC,KAAK;AAAA,EACR;AACA,QAAM,cAAc,YAAY,MAAM,MAAM,YAAY,GAAG,CAAC,KAAK,CAAC;AAClE,SAAO,qBAAqB,WAAW,aAAa,WAAW;AACjE;AAgBO,SAAS,cAAc,OAAuC;AACnE,SAAO,qBAAqB,KAAK;AACnC;AAmBO,SAAS,qBAAqB,OAAmB;AACtD,SAAO;AAAA,IACL,OAAO;AAAA;AAAA,MAEL,QAAQ,CAAC,SAAiB,MAAM,OAAO,IAAI;AAAA;AAAA,MAE3C,OAAO,CAAC,WAAmB,MAAM,MAAM,MAAM;AAAA;AAAA,MAE7C,QAAQ,MAAM,MAAM,OAAO;AAAA;AAAA,MAE3B,sBAAsB,MAAM,MAAM,qBAAqB;AAAA;AAAA,MAEvD,WAAW,CAAC,WAA6B,MAAM,UAAU,MAAM;AAAA,IACjE;AAAA,IACA,CAAC,KAAK;AAAA,EACR;AACF;AAgBO,SAAS,kBAAkB,QAAgD;AAChF,SAAO,qBAAqB,MAAM;AACpC;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skaile/workspace-bridge-react",
3
- "version": "0.29.1",
3
+ "version": "0.31.0",
4
4
  "description": "React 18+ bindings for @skaile/workspaces (useAgentStore, useResourceClient, useSubscribableStore)",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -19,7 +19,7 @@
19
19
  ],
20
20
  "sideEffects": false,
21
21
  "dependencies": {
22
- "@skaile/workspaces": "^0.29.1"
22
+ "@skaile/workspaces": "^0.31.0"
23
23
  },
24
24
  "peerDependencies": {
25
25
  "react": ">=18"