@jrkropp/codex-js-react 0.2.1 → 0.3.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,17 @@
1
1
  # @jrkropp/codex-js-react
2
2
 
3
+ ## 0.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Update the React package docs and examples around the split package model,
8
+ generated stylesheet import, and Cloudflare example integration path.
9
+
10
+ ### Patch Changes
11
+
12
+ - Updated dependencies:
13
+ - @jrkropp/codex-js@0.3.0
14
+
3
15
  ## 0.2.1
4
16
 
5
17
  ### Patch Changes
package/README.md CHANGED
@@ -1,19 +1,19 @@
1
1
  # @jrkropp/codex-js-react
2
2
 
3
- React UI for `@jrkropp/codex-js`, including `CodexChat`, hooks, shadcn-compatible primitives, and a generated stylesheet.
3
+ React UI package for `@jrkropp/codex-js`. It includes `CodexChat`, React hooks, shadcn-compatible primitives, and generated CSS.
4
4
 
5
5
  ## Install
6
6
 
7
7
  ```sh
8
- pnpm add @jrkropp/codex-js @jrkropp/codex-js-react react react-dom
8
+ npm install @jrkropp/codex-js @jrkropp/codex-js-react react react-dom
9
9
  ```
10
10
 
11
11
  Requirements:
12
12
 
13
13
  - Node.js 20 or newer.
14
- - ESM projects only. This package does not ship CommonJS.
14
+ - ESM only. CommonJS output is not shipped.
15
15
  - React 18.3 or React 19.
16
- - A browser bundler that can import CSS.
16
+ - A bundler that supports CSS imports.
17
17
 
18
18
  ## Usage
19
19
 
@@ -23,7 +23,11 @@ import { CodexChat } from "@jrkropp/codex-js-react";
23
23
  import "@jrkropp/codex-js-react/styles.css";
24
24
 
25
25
  const appServer = createCodexAppServerClient({
26
- url: () => "ws://localhost:1466/api/codex/app-server",
26
+ url: async () => {
27
+ const session = await fetch("/api/codex/session", { method: "POST" });
28
+ const { webSocketUrl } = await session.json();
29
+ return webSocketUrl;
30
+ },
27
31
  });
28
32
 
29
33
  export function App() {
@@ -32,13 +36,12 @@ export function App() {
32
36
  appServer={appServer}
33
37
  threadId="00000000-0000-4000-8000-000000000001"
34
38
  title="Codex"
35
- subtitle="React package consumer"
36
39
  />
37
40
  );
38
41
  }
39
42
  ```
40
43
 
41
- ## Stable Imports
44
+ ## Public Imports
42
45
 
43
46
  ```ts
44
47
  import { CodexChat } from "@jrkropp/codex-js-react";
@@ -52,4 +55,4 @@ The React package exposes only:
52
55
  - `@jrkropp/codex-js-react/shadcn`
53
56
  - `@jrkropp/codex-js-react/styles.css`
54
57
 
55
- Runtime and server APIs remain in `@jrkropp/codex-js`.
58
+ Runtime, server, and testing APIs live in `@jrkropp/codex-js`.
package/dist/index.js CHANGED
@@ -6779,17 +6779,13 @@ function useTimelineRowContext() {
6779
6779
  }
6780
6780
  return context;
6781
6781
  }
6782
- function MessageTimelineRow({
6783
- row
6784
- }) {
6782
+ function MessageTimelineRow({ row }) {
6785
6783
  if (row.item.type === "UserMessage") {
6786
6784
  return /* @__PURE__ */ jsx(UserTimelineRow, { row });
6787
6785
  }
6788
6786
  return /* @__PURE__ */ jsx(AssistantTimelineRow, { row });
6789
6787
  }
6790
- function UserTimelineRow({
6791
- row
6792
- }) {
6788
+ function UserTimelineRow({ row }) {
6793
6789
  const copyText = userInputTextForCopy(row.item.content);
6794
6790
  return /* @__PURE__ */ jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ jsxs("div", { className: "group relative max-w-[80%] rounded-2xl rounded-br-sm border border-border bg-secondary px-4 py-3", children: [
6795
6791
  /* @__PURE__ */ jsx(UserInputContent, { content: row.item.content }),
@@ -6811,7 +6807,13 @@ function AssistantTimelineRow({
6811
6807
  });
6812
6808
  return /* @__PURE__ */ jsxs("div", { className: "min-w-0 px-1 py-0.5", children: [
6813
6809
  row.showCompletionDivider ? /* @__PURE__ */ jsx(AssistantCompletionDivider, { row }) : null,
6814
- /* @__PURE__ */ jsx(ChatMarkdown_default, { text: messageText, isStreaming: row.item.phase === "streaming" }),
6810
+ /* @__PURE__ */ jsx(
6811
+ ChatMarkdown_default,
6812
+ {
6813
+ text: messageText,
6814
+ isStreaming: row.item.phase === "streaming"
6815
+ }
6816
+ ),
6815
6817
  /* @__PURE__ */ jsx(
6816
6818
  AssistantChangedFilesSection,
6817
6819
  {
@@ -6865,7 +6867,9 @@ function WorkTimelineRow({
6865
6867
  expanded
6866
6868
  });
6867
6869
  const hasOverflow = row.groupedEntries.length > visible.entries.length;
6868
- const onlyToolEntries = row.groupedEntries.every((entry) => entry.tone === "tool");
6870
+ const onlyToolEntries = row.groupedEntries.every(
6871
+ (entry) => entry.tone === "tool"
6872
+ );
6869
6873
  const showHeader = hasOverflow || !onlyToolEntries;
6870
6874
  const groupLabel = onlyToolEntries ? "Tool calls" : "Work log";
6871
6875
  return /* @__PURE__ */ jsxs(
@@ -7160,7 +7164,10 @@ function formatWorkingTimer(startIso, endIso) {
7160
7164
  if (!Number.isFinite(startedAtMs) || !Number.isFinite(endedAtMs)) {
7161
7165
  return null;
7162
7166
  }
7163
- const elapsedSeconds = Math.max(0, Math.floor((endedAtMs - startedAtMs) / 1e3));
7167
+ const elapsedSeconds = Math.max(
7168
+ 0,
7169
+ Math.floor((endedAtMs - startedAtMs) / 1e3)
7170
+ );
7164
7171
  if (elapsedSeconds < 60) {
7165
7172
  return `${elapsedSeconds}s`;
7166
7173
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jrkropp/codex-js-react",
3
- "version": "0.2.1",
3
+ "version": "0.3.0",
4
4
  "description": "React components and shadcn-compatible UI for codex-js.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -29,7 +29,7 @@
29
29
  "./styles.css": "./dist/styles.css"
30
30
  },
31
31
  "dependencies": {
32
- "@jrkropp/codex-js": "^0.2.0",
32
+ "@jrkropp/codex-js": "^0.3.0",
33
33
  "@legendapp/list": "^3.0.0-beta.44",
34
34
  "@lexical/react": "^0.44.0",
35
35
  "class-variance-authority": "^0.7.1",