Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions CLA.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# WeiBei Contributor License Agreement

This Contributor License Agreement ("Agreement") applies to each contribution
you submit to the WeiBei project.

By stating that you agree to this Agreement in a pull request, you confirm that:

1. You have the legal right to submit the contribution and to grant the rights
below.
2. The contribution is your original work, or you have clearly identified any
third-party material and have the right to submit it.
3. You grant the WeiBei project owner and recipients of the project a
perpetual, worldwide, non-exclusive, royalty-free, irrevocable copyright
license to reproduce, prepare derivative works of, publicly display,
publicly perform, sublicense, and distribute your contribution and
derivative works.
4. You grant the WeiBei project owner and recipients a perpetual, worldwide,
non-exclusive, royalty-free, irrevocable patent license under patent claims
you control that are necessarily infringed by your contribution alone or in
combination with the project at the time of submission.
5. The project owner may license your contribution as part of WeiBei under
`AGPL-3.0-only` and may also offer it under separate commercial terms.
6. You retain ownership of your contribution. Except for the licenses stated
here, no copyright assignment is made.
7. Your contribution is provided without warranties or promises of support,
except where applicable law does not allow that exclusion.

If you submit on behalf of an employer or another organization, you confirm
that you are authorized to bind that organization to this Agreement.

If you cannot make these confirmations, do not submit the contribution. Open an
issue instead so the licensing question can be resolved first.
42 changes: 42 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Contributing to WeiBei

Thank you for helping improve WeiBei.

## Before opening a pull request

1. Open or reference an issue that explains the learner problem and the intended
scope.
2. Keep each pull request focused on one change.
3. Run the relevant checks:

```bash
./script/build_and_run.sh check
./script/build_and_run.sh --verify
```

4. Describe what changed, what was intentionally left out, and which checks
passed.
5. Do not commit course files, notes, credentials, model outputs containing
private data, or material you do not have the right to distribute.

## Contribution license

Contributions are accepted under the Contributor License Agreement in
[`CLA.md`](CLA.md). Add this exact statement to your first pull request:

> I have read and agree to the WeiBei Contributor License Agreement.

This keeps the public project under `AGPL-3.0-only` while allowing the
maintainer to offer separate commercial terms without taking ownership of a
contributor's work.

Pull requests that do not include this agreement will not be merged.

## Product principles

- Keep the learner in control of note and learning-state changes.
- Preserve source provenance and expose incomplete indexing honestly.
- Prefer plain, readable answers; use interactive forms only when they improve
understanding.
- Do not add unrestricted file, terminal, credential, or network access to the
Agent.
661 changes: 661 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

75 changes: 75 additions & 0 deletions LICENSING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# WeiBei licensing guide

WeiBei uses a mixed licensing model so the software can remain open source
without giving away the project's identity or misrepresenting third-party
material.

## Software

Unless a file or directory says otherwise, source code and developer
documentation authored for WeiBei are licensed under the GNU Affero General
Public License version 3 only (`AGPL-3.0-only`). The complete license text is in
[`LICENSE`](LICENSE).

The AGPL permits commercial use. If you distribute a modified version, you must
provide its corresponding source under the AGPL. If your modified version
supports remote network interaction, it must offer those remote users the
corresponding source as required by section 13.

The copyright holder may also offer separate commercial terms. A commercial
license does not revoke or weaken rights already granted under the AGPL.

## Brand and project media

The following are not licensed under the AGPL:

- the WeiBei / 魏碑 names, logos, product identity, and trade dress;
- `Sources/WeiBei/Resources/Fonts/`;
- `DesignReferences/`;
- WeiBei-authored screenshots, videos, and release evidence under
`Docs/release-evidence/`;
- `Attachments/pasted-image.png` and `Attachments/pasted-image-2.png`.

Copyright in those materials is reserved. You may keep the font files and
project media while cloning, forking, building, and privately evaluating this
repository. You may not redistribute those files, use them to brand another
product, or offer them as standalone assets without prior permission. Remove or
replace them before distributing a fork.

See [`TRADEMARKS.md`](TRADEMARKS.md) for the project identity policy.

## Third-party software

Third-party components keep their original licenses:

- `Vendor/PiRuntime/` is licensed under the MIT License documented in that
directory.
- JavaScript dependencies are recorded in the root and prototype
`package-lock.json` files. Generated bundles retain embedded upstream notices.
- Apple system frameworks are used under the terms supplied by Apple and are
not part of this repository's AGPL grant.

See [`THIRD_PARTY_NOTICES.md`](THIRD_PARTY_NOTICES.md) for the distribution
notice and source locations.

## Reference and verification material

Third-party and public-domain reference assets are not relicensed under the
AGPL:

- `Attachments/RichAnswerVerificationAssets/` is governed by its
`manifest.json` and `ATTRIBUTION.md`.
- `Sources/WeiBei/Resources/RichAnswerVerificationAssets/` is governed by its
`ATTRIBUTION.md`.
- `Sources/WeiBei/Resources/Inspiration/` records the source and rights basis in
`SOURCES.md` and in the associated catalog.

Preserve all required attribution and usage restrictions when using those
materials. A repository-wide license never overrides an upstream copyright,
public-domain statement, or attribution requirement.

## No private course content

WeiBei does not license or claim ownership of course files, notes, credentials,
or other content imported by a user. Those files remain under the control and
rights of their respective owners.
1 change: 1 addition & 0 deletions Prototypes/RichAnswerWebRuntime/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Prototypes/RichAnswerWebRuntime/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "weibei-rich-answer-web-runtime-throwaway",
"version": "0.0.1",
"private": true,
"license": "AGPL-3.0-only",
"type": "module",
"scripts": {
"dev": "vite --host 127.0.0.1",
Expand Down
23 changes: 21 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ WeiBei is a source-grounded macOS study workspace for reading course materials,

It is submitted to the **Education** track of OpenAI Build Week 2026.

WeiBei's source code is open source under `AGPL-3.0-only`. Brand assets, custom
fonts, project media, and third-party reference material have separate terms;
see [Licensing](#licensing).

## Why I built it

During final-exam revision, I was reading PDFs and HTML pages in a browser, asking questions in a separate AI chat, and writing Markdown notes in another app. Each tool worked on its own, but the learning flow broke whenever I switched windows and reconstructed the context.
Expand Down Expand Up @@ -116,9 +120,24 @@ Live-provider checks require valid local credentials and are not silently replac
- The Agent proposes note and learning-state changes. The learner must approve the final write.
- Large or difficult source files may be reported as partially indexed or incomplete.
- The repository version is `0.1.0` and remains a pre-release candidate, not a signed and notarized 1.0 release.
- A project-level redistribution license has not been selected. Do not assume permission to redistribute the app or its custom brand fonts.

## Licensing

WeiBei-authored source code and developer documentation are licensed under the
[GNU Affero General Public License version 3 only](LICENSE).

The WeiBei / 魏碑 names, visual identity, custom fonts, project screenshots, and
release media are not licensed under the AGPL. Third-party software and
reference assets retain their original terms. Read
[`LICENSING.md`](LICENSING.md) before redistributing a fork or packaged app.

Separate commercial licensing may be available for organizations that cannot
use AGPL-covered code under the AGPL. Open a GitHub issue to discuss the use
case.

Contributions are welcome under [`CONTRIBUTING.md`](CONTRIBUTING.md) and the
[`CLA.md`](CLA.md). Security issues should follow [`SECURITY.md`](SECURITY.md).

## Technology

Swift, SwiftUI, AppKit, PDFKit, WebKit, Vision OCR, SQLite FTS5, Milkdown, KaTeX, Mermaid, Pi, OpenAI Codex OAuth

29 changes: 29 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Security policy

## Supported version

WeiBei is currently a pre-release project. Security fixes are applied to the
latest commit on the main development line; older commits and local builds are
not maintained as separate supported releases.

## Reporting a vulnerability

Do not open a public issue for a vulnerability that could expose course
content, credentials, local files, or a user's machine.

Use GitHub's private vulnerability reporting or a private security advisory for
this repository. Include:

- the affected commit and macOS version;
- the smallest reproducible steps;
- the security impact;
- whether credentials or private course data were exposed;
- any proposed mitigation.

Do not include real credentials or private course documents in the report.

## Security boundary

WeiBei's Agent receives bounded snapshots selected by the host application. It
must not receive unrestricted file, terminal, credential, or network access.
Reports that cross this boundary are treated as high priority.
2 changes: 1 addition & 1 deletion Sources/WeiBeiSelfCheck/PiTerminalRuntimeSelfChecks.swift
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ private func checkGenericEventsDoNotDefeatWatchdog(_ fixture: PiTerminalRuntimeF
let completionSeconds = Date().timeIntervalSince(startedAt)
await runtime.shutdown()

guard outcome.contains("PI produced no events for five minutes"), completionSeconds < 1.5 else {
guard outcome == "error:PI 命令超时:prompt", completionSeconds < 1.5 else {
throw PiTerminalRuntimeSelfCheckError.failed(
"PI generic event spam defeated the inactivity watchdog (outcome=\(outcome), seconds=\(completionSeconds))"
)
Expand Down
37 changes: 37 additions & 0 deletions THIRD_PARTY_NOTICES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Third-party notices

WeiBei includes and builds upon third-party open-source software. Those
components remain under their original licenses; the project's AGPL license
does not replace them.

## Pi coding agent

WeiBei downloads and packages a pinned standalone Pi coding agent runtime.
Version, source commit, artifact digests, MIT license, and notices are recorded
under [`Vendor/PiRuntime/`](Vendor/PiRuntime/).

## JavaScript components

The Milkdown editor and rich-answer runtime use packages including Milkdown,
KaTeX, Mermaid, PrismJS, React, ECharts, zrender, Vite, TypeScript, Zod, and
their transitive dependencies.

Exact package versions and declared licenses are recorded in:

- [`package-lock.json`](package-lock.json)
- [`Prototypes/RichAnswerWebRuntime/package-lock.json`](Prototypes/RichAnswerWebRuntime/package-lock.json)

Generated JavaScript bundles retain embedded copyright and license notices.
Rebuilds must preserve those notices.

## Reference assets

Image and text reference sources, rights bases, and required credits are
documented in:

- [`Attachments/RichAnswerVerificationAssets/ATTRIBUTION.md`](Attachments/RichAnswerVerificationAssets/ATTRIBUTION.md)
- [`Attachments/RichAnswerVerificationAssets/manifest.json`](Attachments/RichAnswerVerificationAssets/manifest.json)
- [`Sources/WeiBei/Resources/RichAnswerVerificationAssets/ATTRIBUTION.md`](Sources/WeiBei/Resources/RichAnswerVerificationAssets/ATTRIBUTION.md)
- [`Sources/WeiBei/Resources/Inspiration/SOURCES.md`](Sources/WeiBei/Resources/Inspiration/SOURCES.md)

Redistributors must review and preserve the terms that apply to each asset.
12 changes: 12 additions & 0 deletions TRADEMARKS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# WeiBei name and brand

The AGPL license for WeiBei's source code does not grant permission to use the
WeiBei / 魏碑 names, logos, icons, custom fonts, or visual identity to suggest
that a modified version is the official project.

You may make truthful, nominative references such as "a fork of WeiBei" and may
retain notices that are legally required. A publicly distributed modified
version must use a distinct product name and identity unless the WeiBei
maintainer gives prior written permission.

This policy does not limit any right granted by applicable trademark law.
4 changes: 3 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
{
"name": "weibei",
"private": true,
"license": "AGPL-3.0-only",
"repository": "https://github.com/taekchef/weibei",
"scripts": {
"build:editor": "esbuild Sources/WeiBei/WebEditor/src/editor.js --bundle --format=iife --outfile=Sources/WeiBei/Resources/Editor/editor.js --minify --loader:.woff=file --loader:.woff2=file --loader:.ttf=file --asset-names=fonts/[name]"
},
Expand Down