Integrate upstream langchain-ai/openwiki into fork (merge only) - #25
Merged
Conversation
Parse LangGraph protocol events directly so agent streaming no longer needs legacy tuple normalization for message and tool events.
…eam-events Co-authored-by: Cursor <cursoragent@cursor.com> # Conflicts: # src/agent/index.ts
fix: use v3 stream events for agent output
…-ai#196) Co-authored-by: Colin Francis <131073567+colifran@users.noreply.github.com>
…angchain-ai#153) * fix: run --init/--update non-interactively when stdin is not a TTY Ink requires raw-mode stdin, so launching openwiki --init or --update from CI, cron, or any piped shell without --print rendered the UI, printed "Raw mode is not supported", and hung without exiting. The entry point already anticipated non-TTY runs (the startup credential check gates on `command.print || !process.stdin.isTTY`) but still routed them into the Ink renderer. Route runnable non-TTY commands through the existing print path instead, so they execute the agent, write output to stdout, and exit with a meaningful code. Interactive chat without a message still requires a TTY. Fixes langchain-ai#149 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix: fail fast with a clear error for non-TTY interactive chat Bare `openwiki` with a non-TTY stdin used to reach the Ink chat UI, which needs raw-mode stdin, and died with the cryptic "Raw mode is not supported" error (or hung). Resolve it to a startup error instead, so the existing error path prints a clear message to stderr and exits 1. Suggested in PR langchain-ai#153 review. Help, dry-run, and all TTY behavior are unchanged. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com> Co-authored-by: Colin Francis <131073567+colifran@users.noreply.github.com>
Co-authored-by: Eva <eva@100yen.org>
…ile tool calls without aborting the run (langchain-ai#122) * fix: recover from malformed file tool calls * refactor and rework * lint --------- Co-authored-by: Colin Francis <colin.francis@langchain.dev> Co-authored-by: Colin Francis <131073567+colifran@users.noreply.github.com>
…ware (langchain-ai#224) * bump deepagents version * bump langchain version * middleware no longer needed
* feat: Make general purpose * cr * cr * fix gmail * make it much better * add cron hooks * better ngrok * write wiki to root * cr * Harrison/vibe code (langchain-ai#109) * some vibe coding * cr * cr * cr * cr * fix gh action --------- Co-authored-by: bracesproul <braceasproul@gmail.com> * update readme * fix oauth link clicking * drop just openwiki --init * fix: oauth connection flow * improve prompting * cr * cr * brain->personal (langchain-ai#226) * cr * write instructions to INSTRUCTIONS.md file * cr --------- Co-authored-by: Harrison Chase <hw.chase.17@gmail.com> Co-authored-by: Colin Francis <131073567+colifran@users.noreply.github.com>
…n-ai#245) The sanitizeDiagnosticText function redacted secrets for 6 provider API keys but was missing OPENAI_COMPATIBLE_API_KEY. Users of the openai-compatible provider could have their API keys leaked in error messages. Added OPENAI_COMPATIBLE_API_KEY_ENV_KEY to both the import and the redaction loop in diagnostics.ts, and added a test case to verify the redaction works. Co-authored-by: Test User <test@example.com>
Co-authored-by: Eva <eva@100yen.org> Co-authored-by: Colin Francis <131073567+colifran@users.noreply.github.com>
* feat: add OpenAI ChatGPT-login provider (Codex OAuth) Add an `openai-chatgpt` provider that authenticates model calls with a ChatGPT/Codex OAuth login instead of a metered API key, so usage draws on the ChatGPT subscription's included Codex usage. It reuses `@langchain/openai`'s ChatOpenAI Responses-API integration pointed at the Codex backend (`useResponsesApi` + `zdrEnabled` for `store: false`, base URL and account/originator/beta headers), so DeepAgents' tool-calling and streaming keep working with zero changes to the agent harness. Two Codex-backend quirks are handled at model construction: forcing `stream: true`, and rewriting the `system` input role to `developer`. Includes a PKCE browser login + token refresh, an `oauth-login` step in the existing credential wizard, token persistence in `~/.openwiki/.env`, tests, and docs. * feat: make ChatGPT login URL copyable (borderless render + c-to-copy via OSC 52) * feat: let users paste the ChatGPT OAuth callback URL/code to finish login Adds a manual-paste fallback to the browser login: while the loopback callback server waits, the user can paste the redirect URL (or bare code) into the wizard and press Enter to complete the login in-process. Removes the need to curl the callback or set up SSH port forwarding on remote hosts. Whichever arrives first — browser callback or pasted value — wins. * feat: show ChatGPT account info and re-ask model after login - Decode the signed-in email and plan (plus/pro/etc.) from the access-token JWT, persist them, show them in the ChatGPT login step, and add an "account:" line to the run header. - Continue to the model and LangSmith steps after the ChatGPT login just like the API-key providers. Selecting a provider in the wizard now re-asks for the model even if one is stored, so a stale model id from a previous provider is not carried over. * refactor: address review feedback on the ChatGPT login provider - Centralize the CodexTokens <-> env mapping in openai-chatgpt-oauth.ts as codexTokensToEnv() and readCodexTokensFromEnv(), and use them from both the agent's refresh-at-startup and the credential wizard. The env contract now lives next to the type it serializes and is tested with the OAuth flow. readCodexTokensFromEnv() also returns null on a partial token set, so a leftover access token without an account id no longer looks signed in. - Move formatChatGptAccount() into the same module and use it from cli.tsx instead of a second copy. - Fix opening the browser on Windows. Under shell: true, cmd treats the & in the auth URL's query string as a command separator and mangles the URL. Use cmd /c start with a quoted URL and windowsVerbatimArguments instead. * fix succ login msg --------- Co-authored-by: Colin Francis <131073567+colifran@users.noreply.github.com> Co-authored-by: bracesproul <braceasproul@gmail.com>
# Conflicts: # .github/workflows/openwiki-update.yml # examples/openwiki-update.gitlab-ci.yml # examples/openwiki-update.yml # package.json # pnpm-lock.yaml # src/agent/index.ts # src/agent/prompt.ts # src/agent/utils.ts # src/cli.tsx # src/commands.ts # src/constants.ts # src/env.ts
The new upstream startup.test.ts fixture shells out to `git commit` in a throwaway repo but inherited the developer's global commit.gpgsign, which fails in the non-TTY test runner (gpg pinentry unavailable). Pin commit.gpgsign=false in the fixture repo, alongside the user.name/email it already sets, so the test is independent of local git config. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
needsCredentialSetup folds personal-mode onboarding completeness into its result, which reads the developer's real ~/.openwiki/onboarding.json. That made "needs no setup once token, model, and langsmith are all set" fail on any machine without a completed onboarding file (including a pristine upstream/main checkout). Mock isOpenWikiOnboardingCompleteSync to true so the test exercises only the credential-step logic it targets; the missing/expired token cases still assert true via the credential checks. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This was referenced Jul 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes part 1 of #17.
Scope
This PR is the upstream integration merge only — a single merge of
langchain-ai/openwiki@maininto the fork, with all 12 conflicts resolved and the OKF carrier kept working under upstream's new general-purpose / multi-mode model.Per the plan in #17, the "make the OKF
typetaxonomy pluggable per mode" refactor is intentionally deferred to a follow-up PR — it can only be done correctly now that themodeaxis exists in the tree (this merge lands it).What upstream brought in
feat: Make OpenWiki general purpose (#48)(mode axiscode/personal+ connectors subsystem),openai-chatgptOAuth provider (langchain-ai#151), non-interactive init/update when stdin isn't a TTY (langchain-ai#153), init/update write-constraint (langchain-ai#230), v3 stream events, configurable provider retries (langchain-ai#239),OPENAI_COMPATIBLE_API_KEYredaction (langchain-ai#245), releases 0.0.3/0.0.4→0.1.0, and dep bumps.Conflict resolutions (12 files)
package.json/pnpm-lock.yaml— kept both dep sets; version auto-resolved to upstream's0.1.0; lockfile regenerated viapnpm install(not hand-merged).pnpm-workspace.yaml(auto-merge produced a duplicate key) — folded the fork'sviteexclusion into upstream'sminimumReleaseAgeExcludelist; singleminimumReleaseAge.openwiki code --update --print, preserved the--okfguidance comments.src/constants.ts/src/env.ts— additive keep-both for env keys; kept the fork's OKF taxonomy +resolveOkfEnabledalongside upstream's connector keys +resolveProviderRetryAttempts.src/cli.tsx— took upstream'ssetupPromise/ensureCodeModeRepoSetuprun structure and re-applied theokfoption; merged the non-interactive dispatch so--okf-checkstill renders the interactiveOkfCheckView(AND-in!command.okfCheckafter upstream'sshouldRunNonInteractivelytype-guard).src/agent/prompt.ts— merged into a single options bag:createSystemPrompt(command, { outputMode?, okf? }), re-inserting the OKF contract section into upstream's rewritten prompt; kept upstream'screateModeInstructions(command, outputMode).src/agent/index.ts— additive imports; call site updated to the merged prompt signature.src/agent/utils.ts— kept the fork'svisitOpenWikiDirectorysnapshot walk but sourced its root from upstream's mode-awaregetWikiContentRoot(cwd, outputMode); dropped upstream's now-deadaddDirectoryToSnapshot.Follow-up test adaptations (needed by upstream's API changes)
test/agent-okf-integration.test.ts— mock now exposesstreamEvents(v3), runs inoutputMode: "repository".test/commands.test.ts—--initnow requires a mode upstream, so the OKF combo test usescode --okf --init.src/startup.ts— exempted--okf-checkfrom the new "interactive chat requires a terminal" non-TTY gate (it is inherently non-interactive).Verification
pnpm build/typecheck/lint:check/format:checkall pass. Tests: 239 passed, 1 failed. The single failure (openai-chatgpt-credentials.test.ts→ "needs no setup once token, model, and langsmith are all set") is pre-existing onupstream/main— verified by running the identical test in a pristineupstream/mainworktree, where it also fails. It depends on a local~/.openwiki/onboarding.json; not a regression from this merge.Watch-list
DEFAULT_PROVIDERmovesopenrouter→openai(the fork never changed it from base; upstream deliberately did — correct 3-way resolution). The fork's CI setsOPENROUTER_API_KEYexplicitly, but consider settingOPENWIKI_PROVIDERin the workflow if openrouter should remain the default.OPENAI_COMPATIBLE_API_KEYredaction (fix: add missingOPENAI_COMPATIBLE_API_KEYto secret redaction langchain-ai/openwiki#245) is preserved.claude.ymlsandbox perms / OpenSpec tool allowances may need to permit any new tools/commands they introduce.Deferred to PR #2 (per #17)
The pluggable-per-mode OKF
typetaxonomy:DocTypeTaxonomyshape, renameREPO_DOC_TYPES→CODE_DOC_TYPES,getTaxonomyForMode(mode), apersonaltaxonomy, threading it throughcreateSystemPrompt/runOkfPass, and the corresponding test updates.🤖 Generated with Claude Code