Skip to content
Open
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,6 @@ client-config.json
# Editor / agent local state
.obsidian/
.claude/

# Stray local builds (go build ./... drops binaries in the repo root)
/*.exe
14 changes: 13 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
.PHONY: build build-cross build-android test test-router lint vet clean tidy install-browser
.PHONY: build build-desktop build-cross build-android test test-router lint vet clean tidy install-browser

GO ?= go
GOFLAGS ?= -trimpath
LDFLAGS ?= -s -w
BUILD_DIR ?= dist
DESKTOP_TARGETS ?= linux/amd64 linux/arm64 darwin/amd64 darwin/arm64 windows/amd64 windows/arm64
ANDROID_TARGETS ?= android/arm64
HOST_GOOS := $(shell $(GO) env GOOS)
DESKTOP_EXT :=
DESKTOP_LDFLAGS = $(LDFLAGS)
ifeq ($(HOST_GOOS),windows)
DESKTOP_EXT := .exe
DESKTOP_LDFLAGS = -H windowsgui $(LDFLAGS)
endif

# Versioning baked at build time
VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")
Expand All @@ -20,6 +27,11 @@ build:
$(GO) build $(GOFLAGS) -ldflags="$(LDFLAGS)" -o $(BUILD_DIR)/gocoon ./cmd/gocoon
$(GO) build $(GOFLAGS) -ldflags="$(LDFLAGS)" -o $(BUILD_DIR)/gocoon-runner ./cmd/gocoon-runner

build-desktop:
mkdir -p $(BUILD_DIR)
$(GO) build $(GOFLAGS) -tags desktop -ldflags="$(DESKTOP_LDFLAGS)" -o $(BUILD_DIR)/gocoon-desktop$(DESKTOP_EXT) ./cmd/gocoon
$(GO) build $(GOFLAGS) -ldflags="$(LDFLAGS)" -o $(BUILD_DIR)/gocoon-runner$(DESKTOP_EXT) ./cmd/gocoon-runner

build-cross:
@set -e; for target in $(DESKTOP_TARGETS); do \
goos=$${target%/*}; goarch=$${target#*/}; ext=""; \
Expand Down
29 changes: 27 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ Pure-Go COCOON client. Run decentralized AI inference on TON without Telegram's
C++ runner build chain.

- Standalone CLI with an **OpenAI-compatible local HTTP API**
- Built-in local **wallet + chat UI** (`gocoon ui`) and desktop app
(`gocoon-desktop`)
- OpenAI **function calling** support (`tools` array, `tool_calls` response)
- Full on-chain payment flow: stake → chat → close → withdraw
- Static cross-platform binaries (linux / darwin / windows × amd64 / arm64,
Expand All @@ -22,11 +24,34 @@ make build
export PATH="$PWD/dist:$PATH"
```

`make build-cross` and `make build-android` produce release-grade static
`make build-desktop` produces a host desktop app binary (`gocoon-desktop.exe`
on Windows, `gocoon-desktop` on macOS/Linux) plus `gocoon-runner`.
`make build-cross` and `make build-android` produce release-grade static CLI
binaries for every supported target.

## Quick Start

For the local UI:

```bash
gocoon ui --dir ./gocoon-data
```

The UI creates the wallet/config bundle, shows the recovery phrase and full
backup JSON once, shows the funding address, starts the local runner, lists
models once a proxy session is ready, and provides a simple chat screen.

For a standalone desktop window instead of a browser tab:

```bash
gocoon-desktop
```

Keep `gocoon-runner` next to `gocoon-desktop`; the desktop app starts it when
you press **Connect to Cocoon**.

For CLI-only setup:

```bash
gocoon init --dir ./gocoon-data
```
Expand Down Expand Up @@ -69,7 +94,7 @@ gocoon wallet withdraw \

| Path | Role |
| ------------------- | -------------------------------------------------------- |
| `cmd/gocoon` | Standalone CLI |
| `cmd/gocoon` | Standalone CLI and local web UI |
| `cmd/gocoon-runner` | Local runner, HTTP control plane on `127.0.0.1:10000` |
| `pkg/cocoon` | Client library: sessions, inference, payments, discovery |
| `pkg/contracts` | COCOON root / client / wallet contract helpers |
Expand Down
Loading