thinyai 0.1.0 → 0.1.1

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.
Files changed (3) hide show
  1. package/README.md +143 -19
  2. package/dist/bin.js +13 -8
  3. package/package.json +5 -5
package/README.md CHANGED
@@ -1,38 +1,162 @@
1
- # @thiny/cli
1
+ # thinyai
2
2
 
3
- > Beautiful TUI agent CLI with interactive chat and tool execution
3
+ > A beautiful terminal AI agent interactive chat, tools, cross-session memory on **Walrus**, and grounded **Sui** execution. The command is `thiny`.
4
4
 
5
- [![npm](https://img.shields.io/npm/v/@thiny/cli)](https://www.npmjs.com/package/@thiny/cli)
5
+ [![npm](https://img.shields.io/npm/v/thinyai)](https://www.npmjs.com/package/thinyai)
6
+
7
+ ```text
8
+ _____ _ _ _ ___
9
+ |_ _| |__ (_)_ __ _ _ / \ |_ _|
10
+ | | | '_ \| | '_ \| | | | / _ \ | |
11
+ | | | | | | | | | | |_| |/ ___ \ | |
12
+ |_| |_| |_|_|_| |_|\__, /_/ \_\___|
13
+ |___/
14
+ ```
15
+
16
+ ---
6
17
 
7
18
  ## Install
8
19
 
9
20
  ```bash
10
- pnpm add -g @thiny/cli
21
+ bun add -g thinyai # or: npm i -g thinyai / pnpm add -g thinyai
11
22
  ```
12
23
 
13
- ## Usage
24
+ This installs one command: **`thiny`**. No `.env`, no config files to hand-edit — the first run sets you up.
14
25
 
15
26
  ```bash
16
- # Start interactive chat
17
- thiny
27
+ thiny # first launch runs setup, then starts chatting
28
+ ```
29
+
30
+ ---
31
+
32
+ ## Commands
33
+
34
+ | Command | What it does |
35
+ |---|---|
36
+ | `thiny` | Start the interactive agent. Runs first-time setup if needed. |
37
+ | `thiny init` | (Re)run base setup — pick a model + agent name + API key. |
38
+ | `thiny sui init` | Add Sui on-chain capabilities — pick a network + wallet. |
39
+ | `thiny help` | Show all commands. |
40
+ | `thiny --version` | Print the version. |
41
+
42
+ Everything is saved to **`~/.thiny/config.json`** (chmod `0600` — it holds your API key and any Sui key). No `.env` required.
43
+
44
+ ---
45
+
46
+ ## First run / `thiny init`
47
+
48
+ The first time you run `thiny` (or any time you run `thiny init`), an arrow-key wizard asks:
49
+
50
+ 1. **Agent name** — what the assistant calls itself (default `ThinyAI`).
51
+ 2. **Model** — pick from the list, or **Custom** for any OpenAI-compatible endpoint:
52
+
53
+ | Choice | Notes |
54
+ |---|---|
55
+ | OpenAI · gpt-4o-mini | fast, cheap |
56
+ | OpenAI · gpt-4o | |
57
+ | Anthropic · claude-haiku-4-5 | |
58
+ | Anthropic · claude-sonnet-4-6 | |
59
+ | Ollama | local, no key (`http://localhost:11434/v1`) |
60
+ | Custom | enter model id + base URL + key — works with Groq, Together, OpenRouter, LM Studio, vLLM, Mimo, Azure, … |
61
+
62
+ 3. **API key** — pasted securely (masked); skipped for keyless setups like Ollama.
63
+
64
+ That's it — `thiny` starts.
65
+
66
+ ---
67
+
68
+ ## Sui setup / `thiny sui init`
69
+
70
+ Adds grounded, capped on-chain execution. If you haven't run base setup yet, this runs it first.
71
+
72
+ 1. **Network** — `Testnet` (recommended) or `Mainnet`. You can change this later by re-running `thiny sui init`.
73
+ 2. **Wallet** — choose one:
74
+
75
+ | Option | What happens |
76
+ |---|---|
77
+ | **Paste an existing private key** | Enter a `suiprivkey…` key (masked). |
78
+ | **Generate a new key pair locally** | A fresh Ed25519 key is created and stored in your config. |
79
+ | **Agent wallet (Rill)** | Generates a signer key and stores your per-user Rill MCP URL for grounded execution. |
80
+
81
+ After setup it prints your **address** — you must **fund it** before sending transactions:
18
82
 
19
- # With specific model
20
- thiny --model openai/gpt-4o
83
+ ```text
84
+ Fund this address (testnet) before sending transactions
85
+ 0xabc…
86
+ Faucet: https://faucet.sui.io (or `sui client faucet`)
87
+ ```
88
+
89
+ > Mainnet is gated: the signer refuses to sign on mainnet unless explicitly enabled, and per-tx / budget / expiry caps are enforced **on-chain** by the agent-wallet contract — the local policy is only a soft UX layer.
90
+
91
+ ---
92
+
93
+ ## In-chat commands
94
+
95
+ While chatting, type a slash command:
96
+
97
+ | Command | Description |
98
+ |---|---|
99
+ | `/new` | Start a fresh session (long-term memory carries over). |
100
+ | `/tools` | List available tools. |
101
+ | `/skills` | List available skills. |
102
+ | `/session` | Show the current session id. |
103
+ | `/stats` | Session totals (turns, tokens, tool calls). |
104
+ | `/verify <blobId>` | Re-fetch and replay a stored Walrus audit trail. |
105
+ | `/clear` | Clear the screen. |
106
+ | `/help` | Show these commands. |
21
107
 
22
- # Non-interactive query
23
- thiny run "What is the ETH price?"
108
+ Press **Ctrl-D** (or Ctrl-C) to exit.
109
+
110
+ ---
111
+
112
+ ## Memory (Walrus)
113
+
114
+ Thiny remembers across sessions. Durable facts about you are stored on **Walrus** (content-addressed, verifiable, portable — not locked to one machine) and auto-injected at the start of each conversation. When a fact is saved you'll see a compact, verifiable line:
115
+
116
+ ```text
117
+ ✓ memory saved on Walrus · https://walruscan.com/testnet/blob/…
24
118
  ```
25
119
 
26
- ## Features
120
+ Writes are non-blocking — you can keep chatting while they upload. Set `MEMWAL_*` env vars to use MemWal (semantic memory) instead.
121
+
122
+ ---
123
+
124
+ ## Output
125
+
126
+ Responses render as **markdown** in the terminal — bold, italics, `inline code`, lists, headings, blockquotes, fenced code blocks, and clickable `[links](url)`. Model reasoning (`<think>…</think>`) streams dimmed.
127
+
128
+ ---
129
+
130
+ ## Config reference
131
+
132
+ `~/.thiny/config.json`:
133
+
134
+ ```jsonc
135
+ {
136
+ "agentName": "ThinyAI",
137
+ "userId": "default",
138
+ "model": "openai:gpt-4o-mini", // or "anthropic:…", or a bare id with baseUrl
139
+ "baseUrl": "https://…/v1", // optional — for OpenAI-compatible endpoints
140
+ "apiKey": "sk-…",
141
+ "sui": { // present after `thiny sui init`
142
+ "network": "testnet",
143
+ "address": "0x…",
144
+ "wallet": { "type": "generated", "secretKey": "suiprivkey…" },
145
+ "rillMcpUrl": "https://…" // optional — Rill agent wallet
146
+ }
147
+ }
148
+ ```
149
+
150
+ Environment variables override the config when set (handy for CI/dev): `THINY_MODEL`, `THINY_OPENAI_API_KEY`, `THINY_ANTHROPIC_API_KEY`, `THINY_OPENAI_BASE_URL`, `THINY_PERSONA_NAME`, `THINY_USER_ID`, `SUI_NETWORK`, `SUI_SECRET_KEY`, `MCP_URL`.
151
+
152
+ ---
27
153
 
28
- - Interactive TUI with ASCII art header
29
- - Streaming SSE responses
30
- - Multi-session support
31
- - Tool call visualization
32
- - EVM + Solana wallet integration
154
+ ## Troubleshooting
33
155
 
34
- [📖 Full docs →](https://github.com/thiny-ai/thiny/tree/main/heads/cli)
156
+ - **`(model returned empty response)` / API error** — wrong model id, base URL, or key. Re-run `thiny init`, or edit `~/.thiny/config.json`. The CLI prints the underlying provider error.
157
+ - **Transactions fail** — make sure the address from `thiny sui init` is funded.
158
+ - **Logs** — written to `~/.thiny/cli.log` (never to the chat). Tail with `tail -f ~/.thiny/cli.log`.
35
159
 
36
160
  ---
37
161
 
38
- *Part of the [Thiny AI](https://github.com/thiny-ai/thiny) framework*
162
+ *Part of the [Thiny](https://github.com/ESES-Labs/thinyai-walrus) framework — a tiny, hexagonal agent kernel for Web2 + Web3.*
package/dist/bin.js CHANGED
@@ -4,6 +4,9 @@
4
4
  import { createInterface } from "readline/promises";
5
5
  import { clearLine, cursorTo } from "readline";
6
6
  import { stdin, stdout } from "process";
7
+ import { mkdirSync } from "fs";
8
+ import { homedir } from "os";
9
+ import { join } from "path";
7
10
  import { z as z4 } from "zod";
8
11
 
9
12
  // ../../packages/core/src/domain/messages.ts
@@ -1792,8 +1795,10 @@ function parseSkillArgs() {
1792
1795
  }
1793
1796
  var currentSessionId = `cli-${(/* @__PURE__ */ new Date()).getTime().toString()}`;
1794
1797
  async function runCli() {
1798
+ const thinyDir = join(homedir(), ".thiny");
1799
+ mkdirSync(thinyDir, { recursive: true });
1795
1800
  const envLogFile = process.env.THINY_LOG_FILE?.trim();
1796
- const logFile = envLogFile && envLogFile.length > 0 ? envLogFile : `${process.env.HOME ?? "."}/thiny-cli.log`;
1801
+ const logFile = envLogFile && envLogFile.length > 0 ? envLogFile : join(thinyDir, "cli.log");
1797
1802
  const fileLogger = pinoLogger({ level: process.env.LOG_LEVEL ?? "info", file: logFile });
1798
1803
  const turn = { inputTokens: 0, outputTokens: 0, toolCalls: 0, modelCalls: 0 };
1799
1804
  const session = { inputTokens: 0, outputTokens: 0, toolCalls: 0, turns: 0 };
@@ -2082,16 +2087,16 @@ Audit trail ${blobId}
2082
2087
  }
2083
2088
 
2084
2089
  // src/onboarding.ts
2085
- import { existsSync as existsSync2, readFileSync as readFileSync2, writeFileSync, mkdirSync, chmodSync } from "fs";
2086
- import { homedir } from "os";
2087
- import { join, dirname as dirname2 } from "path";
2090
+ import { existsSync as existsSync2, readFileSync as readFileSync2, writeFileSync, mkdirSync as mkdirSync2, chmodSync } from "fs";
2091
+ import { homedir as homedir2 } from "os";
2092
+ import { join as join2, dirname as dirname2 } from "path";
2088
2093
  import { fileURLToPath } from "url";
2089
2094
  import * as p from "@clack/prompts";
2090
- var THINY_DIR = join(homedir(), ".thiny");
2091
- var CONFIG = join(THINY_DIR, "config.json");
2095
+ var THINY_DIR = join2(homedir2(), ".thiny");
2096
+ var CONFIG = join2(THINY_DIR, "config.json");
2092
2097
  function version() {
2093
2098
  try {
2094
- const pkg = join(dirname2(fileURLToPath(import.meta.url)), "../package.json");
2099
+ const pkg = join2(dirname2(fileURLToPath(import.meta.url)), "../package.json");
2095
2100
  return JSON.parse(readFileSync2(pkg, "utf8")).version ?? "0.0.0";
2096
2101
  } catch {
2097
2102
  return "0.0.0";
@@ -2101,7 +2106,7 @@ function loadConfig() {
2101
2106
  return existsSync2(CONFIG) ? JSON.parse(readFileSync2(CONFIG, "utf8")) : null;
2102
2107
  }
2103
2108
  function saveConfig(cfg) {
2104
- mkdirSync(THINY_DIR, { recursive: true });
2109
+ mkdirSync2(THINY_DIR, { recursive: true });
2105
2110
  chmodSync(THINY_DIR, 448);
2106
2111
  writeFileSync(CONFIG, JSON.stringify(cfg, null, 2));
2107
2112
  chmodSync(CONFIG, 384);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thinyai",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Thiny AI — a beautiful terminal agent: interactive chat, tools, Walrus memory, and Sui execution.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -36,14 +36,14 @@
36
36
  "devDependencies": {
37
37
  "tsup": "^8.5.1",
38
38
  "typescript": "^5.5.0",
39
- "@thiny/core": "0.1.0",
40
39
  "@thiny/mcp": "0.1.0",
40
+ "@thiny/core": "0.1.0",
41
41
  "@thiny/model-aisdk": "0.1.0",
42
- "@thiny/logger-pino": "0.1.0",
43
42
  "@thiny/memory-memwal": "0.1.0",
43
+ "@thiny/logger-pino": "0.1.0",
44
44
  "@thiny/walrus": "0.1.0",
45
- "@thiny/skills": "0.1.0",
46
- "@thiny/plugin-agents": "0.1.0"
45
+ "@thiny/plugin-agents": "0.1.0",
46
+ "@thiny/skills": "0.1.0"
47
47
  },
48
48
  "author": "Thiny AI",
49
49
  "engines": {