Commit Graph

2755 Commits

Author SHA1 Message Date
Tat Dat Duong 66219801db Test 2025-07-02 02:44:04 +02:00
Tat Dat Duong 8fa640beba Update turbo definitions 2025-07-02 02:35:57 +02:00
Tat Dat Duong 799a08edc3 Simplify build process, remove Bun 2025-07-02 01:46:19 +02:00
Josh Rogers c497c8e984 Updating message types to include all base message fields (#5298) 2025-07-01 15:40:13 -07:00
Tat Dat Duong decbaefbc0 Remove old yarn 2025-07-02 00:01:41 +02:00
Tat Dat Duong bcf06be8f7 Another pass at fixing build 2025-07-02 00:00:19 +02:00
Tat Dat Duong 2b211391c8 Update dependencies 2025-07-02 00:00:05 +02:00
Tat Dat Duong ace7c913f6 Merge remote-tracking branch 'langgraphjs-api/main' into dqbd/lgjsapi 2025-07-01 23:58:40 +02:00
David Duong e521f5f35f release(langgraph): 0.3.6 (#1326) 0.3.6 2025-07-01 12:45:05 +00:00
David Duong b0e9239c86 release(langgraph): 0.3.5 (#1325) 2025-07-01 12:37:59 +00:00
David Duong 1dc89b94fd release(sdk-js): 0.0.88 (#5294) 2025-07-01 14:30:37 +02:00
Tat Dat Duong 3463730b44 release(sdk-js): 0.0.88 2025-07-01 14:21:11 +02:00
David Duong d2767e827d feat(react): enhance useStream with initialValues, newThreadId, and onStop callback for improved UX (#5111) 2025-07-01 01:53:28 +02:00
Tat Dat Duong 1288696d8e Make sure to spread stream values 2025-07-01 01:39:53 +02:00
Tat Dat Duong 00550f18ea Fix non-existent assistantId 2025-07-01 01:35:59 +02:00
Tat Dat Duong 67344b3654 Fix typo 2025-07-01 01:33:08 +02:00
Tat Dat Duong 79155789f5 Cleanup 2025-07-01 01:19:07 +02:00
MauritsBrinkman 3b04510c00 test: add useStream onStop callback tests 2025-06-30 16:43:48 +02:00
MauritsBrinkman 55df97d60f feat: add onStop callback to useStream for custom stop behavior
Add onStop callback to useStream hook enabling developers to customize
UI behavior when streams are stopped. This is especially useful for
UI messages with loading states that need to show "stopped" status
instead of remaining in infinite loading state.

The callback provides the same mutate function as onCustomEvent for
immediate local state updates, while users can optionally update
server thread state using the threads client.

Example usage:
```typescript
const stream = useStream({
  assistantId: "my-assistant",
  onStop: async ({ mutate }) => {
    // Immediate UI update - stop loading components
    mutate((prev) => ({
      ...prev,
      ui: prev.ui?.map(component =>
        component.props?.isLoading
          ? {
              ...component,
              props: {
                ...component.props,
                isLoading: false,
                isStopped: true
              }
            }
          : component
      )
    }));

    // Optional server thread state update
    if (stream.threadId) {
      await stream.client.threads.updateState(stream.threadId, {
        values: {
          ui: prev.ui // persist stopped state to server
        }
      });
    }
  }
});
```

This is especially useful for cases where gen UI components have loading states,
where we don't want the loading state to persist on cancellation.
2025-06-30 16:43:13 +02:00
MauritsBrinkman a740542ce7 fix(sdk-js): convert SSE classes to factory functions to resolve tree shaking
- Convert BytesLineDecoder and SSEDecoder from classes extending TransformStream to factory functions
- Fixes tree shaking failures that prevented build completion
- Maintains identical API functionality, just removes 'new' keyword usage
- All tests continue to pass

Resolves tree shaking side effect detection issues with TransformStream extension
2025-06-30 16:43:13 +02:00
MauritsBrinkman 2613fa6b48 docs(react): add documentation and tests for initialValues and newThreadId options
- Document initialValues for cached thread display
- Document newThreadId for optimistic thread creation
- Add comprehensive test coverage for both features
2025-06-30 16:43:12 +02:00
MauritsBrinkman a838d2b824 feat(react): add initialValues option to useStream for cached thread display
Add initialValues parameter to UseStreamOptions to enable immediate display
of cached thread data while official history is being fetched from the server.

This addresses the common use case where applications cache thread data
locally (IndexedDB, localStorage, etc.) and want to show it instantly when
users navigate to existing threads, providing better UX with faster loading.

Key changes:
- Add initialValues?: Partial<StateType> | null to UseStreamOptions interface
- Update values precedence: streamValues > initialValues > historyValues
- Ensure optimisticValues properly override initialValues during submission
- Maintain full backward compatibility with existing API

Example usage:
```typescript
const stream = useStream({
  threadId,
  assistantId: 'my-assistant',
  initialValues: cachedThreadData?.values // Show cached data immediately
});
```

The values flow now follows this priority:
1. Initial load: shows initialValues while history loads
2. During submit: optimisticValues take precedence
3. After server response: official history replaces all
2025-06-30 16:43:12 +02:00
MauritsBrinkman d434e37e77 feat(react): add newThreadId option to useStream for optimistic UI
Add optional newThreadId parameter to useStream hook that allows specifying
a thread ID for new thread creation while keeping threadId null. This enables
optimistic UI patterns where developers need to know the thread ID beforehand
for routing/navigation without causing 404 errors from attempting to fetch
non-existent thread history.

Usage:
- Set threadId: null and newThreadId: "predetermined-id"
- Submit message to create thread with specified ID
- Use onThreadId callback to update threadId after creation

This solves the UX problem of having to await thread creation before
enabling optimistic navigation to e.g. /[threadId] routes.
2025-06-30 16:43:12 +02:00
David Duong 568941dbfb fix: Allow configuring stream mode in useStream.joinStream() (#5146) 2025-06-30 16:37:56 +02:00
David Duong cdddd5f6e8 chore(sdk-js): use embed LGP server for MSW mocking (#5174) 2025-06-30 16:33:47 +02:00
Tat Dat Duong e5d378ec25 Use published package 2025-06-30 13:51:32 +02:00
David Duong 8ca9c3c7e6 Merge pull request #89 from langchain-ai/dqbd/0.0.41
release: 0.0.41
2025-06-30 13:30:19 +02:00
Tat Dat Duong 6925dc7a6c release: 0.0.41 2025-06-30 13:25:37 +02:00
David Duong 40e03a8743 Merge pull request #87 from langchain-ai/dqbd/embed
feat(api): embeddable LGP server for testing
2025-06-28 12:31:57 +02:00
Tat Dat Duong 21e5b48358 Fix issues 2025-06-28 04:26:04 +02:00
Tat Dat Duong b10b25b2fb Mark as experimental 2025-06-28 04:10:36 +02:00
Tat Dat Duong aac3a0db9e Further cleanup 2025-06-28 04:07:45 +02:00
Tat Dat Duong 1277155617 Cleanup 2025-06-28 03:40:23 +02:00
Tat Dat Duong 8687bbfec7 feat(api): embeddable LGP server for testing 2025-06-28 03:19:51 +02:00
David Duong 6a07538cc6 Merge pull request #88 from langchain-ai/dqbd/tests-stability
fix(api): fix race condition for multiple workers
2025-06-28 03:17:54 +02:00
Tat Dat Duong fd6a9c9eb0 fix(api): fix race condition for multiple workers 2025-06-28 03:11:45 +02:00
David Duong 1106538644 fix(langgraph): createReactAgent should accept checkpointer?: boolean (#1323) 2025-06-27 18:21:24 +00:00
David Duong b5e8af1bba fix(sdk-js): avoid stale client when fetching history (#5240) 2025-06-27 20:04:41 +02:00
Tat Dat Duong 87d0a18b18 Bump to 0.0.87 2025-06-27 20:03:03 +02:00
Tat Dat Duong c177d7a13c Use the client hash only in useEffect 2025-06-27 19:59:21 +02:00
Tat Dat Duong ff65479bba fix(sdk-js): avoid stale client when fetching history 2025-06-27 19:51:49 +02:00
lc-arjun 7c3582eed3 chore: sdk bumps (#5220)
* chore: sdk bumps

* uv lock
2025-06-26 17:57:05 -07:00
lc-arjun 7eeaaa6f8d chore: update api ref docs and fix schemas (#5219) 2025-06-26 17:41:03 -07:00
David Duong 6109bf3f65 fix(langgraph): respect streamMode when invoking subgraph in a node (#1320) 2025-06-26 23:17:15 +00:00
bkim14 dbf4f00003 fix(langgraph): change return value of getWriter (#1315) 2025-06-27 00:31:47 +02:00
Xavier Roma ce1161ce1d fix(langgraph): propagate recursionLimit and signal in RemoteGraph (#1238) 2025-06-26 22:31:38 +00:00
David Duong 286a3e0523 feat(langgraph): add "tasks" and "checkpoints" stream mode (#1319) 2025-06-26 22:08:59 +00:00
David Duong a77b4d3967 fix(langgraph): hash the cache key with XXH3 (#1318) 2025-06-26 20:50:16 +00:00
lc-arjun 3c1495ccc2 feat: crons sorting sdk (#5197)
* feat: crons sorting sdk

* update sync clients

* lock file

* lock file

* lock file
2025-06-26 11:27:44 -07:00
David Duong da3b2861f4 feat(langgraph): add support for multiple resumes (#1260) 2025-06-26 20:02:53 +02:00