thinyai 0.1.10 → 0.1.11
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.
- package/dist/bin.js +27 -10
- package/package.json +7 -7
package/dist/bin.js
CHANGED
|
@@ -164,7 +164,7 @@ var SlashPrompt = class {
|
|
|
164
164
|
|
|
165
165
|
// src/main.ts
|
|
166
166
|
import { stdin, stdout } from "process";
|
|
167
|
-
import { mkdirSync as
|
|
167
|
+
import { mkdirSync as mkdirSync3, readFileSync as readFileSync4, writeFileSync as writeFileSync3 } from "fs";
|
|
168
168
|
import { homedir as homedir2 } from "os";
|
|
169
169
|
import { join as join2 } from "path";
|
|
170
170
|
import { z as z7 } from "zod";
|
|
@@ -1182,6 +1182,7 @@ function memwalFactsPlugin(opts) {
|
|
|
1182
1182
|
|
|
1183
1183
|
// ../../packages/adapters/walrus/src/index.ts
|
|
1184
1184
|
import { mkdir, readFile, writeFile } from "fs/promises";
|
|
1185
|
+
import { mkdirSync, readFileSync as readFileSync2, writeFileSync, existsSync as existsSync2 } from "fs";
|
|
1185
1186
|
import { dirname } from "path";
|
|
1186
1187
|
import { z as z2 } from "zod";
|
|
1187
1188
|
var DEFAULT_PUBLISHER = "https://publisher.walrus-testnet.walrus.space";
|
|
@@ -1319,6 +1320,13 @@ function walrusMemoryPlugin(opts) {
|
|
|
1319
1320
|
let pending = Promise.resolve();
|
|
1320
1321
|
async function load() {
|
|
1321
1322
|
if (cache) return cache;
|
|
1323
|
+
if (opts.cacheFile && existsSync2(opts.cacheFile)) {
|
|
1324
|
+
try {
|
|
1325
|
+
cache = JSON.parse(readFileSync2(opts.cacheFile, "utf8"));
|
|
1326
|
+
return cache;
|
|
1327
|
+
} catch {
|
|
1328
|
+
}
|
|
1329
|
+
}
|
|
1322
1330
|
loading ??= (async () => {
|
|
1323
1331
|
try {
|
|
1324
1332
|
const blobId = await opts.pointers.get(key);
|
|
@@ -1334,6 +1342,13 @@ function walrusMemoryPlugin(opts) {
|
|
|
1334
1342
|
}
|
|
1335
1343
|
function save(facts) {
|
|
1336
1344
|
cache = facts;
|
|
1345
|
+
if (opts.cacheFile) {
|
|
1346
|
+
try {
|
|
1347
|
+
mkdirSync(dirname(opts.cacheFile), { recursive: true });
|
|
1348
|
+
writeFileSync(opts.cacheFile, JSON.stringify(facts, null, 2));
|
|
1349
|
+
} catch {
|
|
1350
|
+
}
|
|
1351
|
+
}
|
|
1337
1352
|
opts.onStoreStart?.();
|
|
1338
1353
|
pending = pending.then(async () => {
|
|
1339
1354
|
try {
|
|
@@ -1956,7 +1971,7 @@ var SkillRegistry = class {
|
|
|
1956
1971
|
var defaultRegistry = new SkillRegistry();
|
|
1957
1972
|
|
|
1958
1973
|
// src/onboarding.ts
|
|
1959
|
-
import { existsSync as
|
|
1974
|
+
import { existsSync as existsSync3, readFileSync as readFileSync3, writeFileSync as writeFileSync2, mkdirSync as mkdirSync2, chmodSync } from "fs";
|
|
1960
1975
|
import { homedir } from "os";
|
|
1961
1976
|
import { join, dirname as dirname2 } from "path";
|
|
1962
1977
|
import { fileURLToPath } from "url";
|
|
@@ -1966,18 +1981,18 @@ var CONFIG = join(THINY_DIR, "config.json");
|
|
|
1966
1981
|
function version() {
|
|
1967
1982
|
try {
|
|
1968
1983
|
const pkg = join(dirname2(fileURLToPath(import.meta.url)), "../package.json");
|
|
1969
|
-
return JSON.parse(
|
|
1984
|
+
return JSON.parse(readFileSync3(pkg, "utf8")).version ?? "0.0.0";
|
|
1970
1985
|
} catch {
|
|
1971
1986
|
return "0.0.0";
|
|
1972
1987
|
}
|
|
1973
1988
|
}
|
|
1974
1989
|
function loadConfig() {
|
|
1975
|
-
return
|
|
1990
|
+
return existsSync3(CONFIG) ? JSON.parse(readFileSync3(CONFIG, "utf8")) : null;
|
|
1976
1991
|
}
|
|
1977
1992
|
function saveConfig(cfg) {
|
|
1978
|
-
|
|
1993
|
+
mkdirSync2(THINY_DIR, { recursive: true });
|
|
1979
1994
|
chmodSync(THINY_DIR, 448);
|
|
1980
|
-
|
|
1995
|
+
writeFileSync2(CONFIG, JSON.stringify(cfg, null, 2));
|
|
1981
1996
|
chmodSync(CONFIG, 384);
|
|
1982
1997
|
}
|
|
1983
1998
|
function applyConfig(cfg) {
|
|
@@ -2538,19 +2553,19 @@ function notifyIfUpdate(thinyDir) {
|
|
|
2538
2553
|
const cur = version();
|
|
2539
2554
|
const cacheFile = join2(thinyDir, "update-check.json");
|
|
2540
2555
|
try {
|
|
2541
|
-
const cached = JSON.parse(
|
|
2556
|
+
const cached = JSON.parse(readFileSync4(cacheFile, "utf8"));
|
|
2542
2557
|
if (cached.latest && isNewerVersion(cached.latest, cur)) {
|
|
2543
2558
|
renderInfo(`Update available: ${cur} \u2192 ${cached.latest} \u2014 run \`thiny update\``);
|
|
2544
2559
|
}
|
|
2545
2560
|
} catch {
|
|
2546
2561
|
}
|
|
2547
2562
|
void fetch("https://registry.npmjs.org/thinyai/latest").then((r) => r.json()).then((j) => {
|
|
2548
|
-
if (j.version)
|
|
2563
|
+
if (j.version) writeFileSync3(cacheFile, JSON.stringify({ latest: j.version, at: Date.now() }));
|
|
2549
2564
|
}).catch(() => void 0);
|
|
2550
2565
|
}
|
|
2551
2566
|
async function runCli() {
|
|
2552
2567
|
const thinyDir = join2(homedir2(), ".thiny");
|
|
2553
|
-
|
|
2568
|
+
mkdirSync3(thinyDir, { recursive: true });
|
|
2554
2569
|
const envLogFile = process.env.THINY_LOG_FILE?.trim();
|
|
2555
2570
|
const logFile = envLogFile && envLogFile.length > 0 ? envLogFile : join2(thinyDir, "cli.log");
|
|
2556
2571
|
const fileLogger = pinoLogger({ level: process.env.LOG_LEVEL ?? "info", file: logFile });
|
|
@@ -2598,6 +2613,8 @@ async function runCli() {
|
|
|
2598
2613
|
// directory `thiny` is launched from — a cwd-relative file would fragment per folder.
|
|
2599
2614
|
pointers: filePointerStore(process.env.WALRUS_POINTERS ?? join2(thinyDir, "thiny-pointers.json")),
|
|
2600
2615
|
userId,
|
|
2616
|
+
// Instant, reliable local mirror — cross-session memory no longer waits on the slow Walrus PUT.
|
|
2617
|
+
cacheFile: join2(thinyDir, `memory-${userId}.json`),
|
|
2601
2618
|
onStoreStart: () => pendingWrites += 1,
|
|
2602
2619
|
onStore: (ref) => {
|
|
2603
2620
|
if (pendingWrites > 0) pendingWrites -= 1;
|
|
@@ -2855,7 +2872,7 @@ async function runCli() {
|
|
|
2855
2872
|
HOW TO ACT: When a request maps to one of your tools, CALL THE TOOL automatically \u2014 figure out the right tool yourself; do not ask the user which tool to run, do not ask permission for read-only actions, and never say you can't do something one of your tools covers. Chain tools when needed (e.g. web_search \u2192 fetch_url \u2192 act).
|
|
2856
2873
|
|
|
2857
2874
|
YOUR TOOLS:
|
|
2858
|
-
\u2022 Memory \u2014 remember_fact
|
|
2875
|
+
\u2022 Memory \u2014 remember_fact: durable memory across sessions. Whenever the user shares anything durable about themselves (name, role, preferences, projects, goals), call remember_fact ONCE to save it. Your known facts are AUTO-INJECTED at the top of every conversation under \u201C[User Memory \u2026]\u201D, so answer \u201Cwhat do you remember / what's my name\u201D directly from that context \u2014 do NOT call recall_memory unless the injected memory is empty and you truly need to re-check. You DO remember across sessions; never say otherwise.
|
|
2859
2876
|
\u2022 Links \u2014 fetch_url: read ANY URL the user shares (a skill.md, docs, JSON, an API/MCP endpoint). Always fetch shared links instead of saying you can't open URLs.
|
|
2860
2877
|
` + (webSearchOn ? "\u2022 Web search \u2014 web_search: search the web for anything you don't know (news, prices, docs). web_search FINDS pages by query; fetch_url READS a specific URL \u2014 use them together.\n" : "") + "\u2022 Planning \u2014 update_plan (track multi-step work), delegate_task (hand a focused subtask to a sub-agent).\n\u2022 Sui blockchain \u2014 you transact yourself; NEVER tell the user to install a browser wallet. " + (suiSignerRef ? `The active wallet is on ${suiNetwork} at ${suiSignerRef.address ?? "?"}. ` : "No wallet yet \u2014 call sui_create_wallet (or sui_import_wallet) when the user wants Sui, then have them fund the address. ") + "Wallets: sui_wallets (list ALL the user's wallets + addresses \u2014 use this to answer 'what's my address / what wallets do I have'), sui_create_wallet (new key pair), sui_import_wallet (restore from a suiprivkey), sui_export_wallet (reveal a private key \u2014 only when asked), sui_use_wallet (switch the active wallet). On-chain: sui_balance & sui_object (read), sui_transfer (send SUI/any coin \u2014 amounts in MIST, 1 SUI = 1e9), sui_move_call (call ANY Move function), sui_execute_ptb (sign a builder/Rill PTB). Prefer sui_transfer for sends and sui_move_call for contract calls; confirm details before signing.",
|
|
2861
2878
|
tools: [echoTool, suiSetupTool, ...walletTools, fetchUrlTool, ...webTools],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "thinyai",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.11",
|
|
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",
|
|
@@ -38,15 +38,15 @@
|
|
|
38
38
|
"tsup": "^8.5.1",
|
|
39
39
|
"typescript": "^5.5.0",
|
|
40
40
|
"@thiny/core": "0.1.0",
|
|
41
|
-
"@thiny/walrus": "0.1.0",
|
|
42
|
-
"@thiny/plugin-agents": "0.1.0",
|
|
43
|
-
"@thiny/plugin-web-search": "0.1.0",
|
|
44
41
|
"@thiny/logger-pino": "0.1.0",
|
|
45
|
-
"@thiny/mcp": "0.1.0",
|
|
46
42
|
"@thiny/memory-memwal": "0.1.0",
|
|
47
|
-
"@thiny/signer-sui": "0.1.0",
|
|
48
|
-
"@thiny/plugin-sui": "0.1.0",
|
|
49
43
|
"@thiny/model-aisdk": "0.1.0",
|
|
44
|
+
"@thiny/mcp": "0.1.0",
|
|
45
|
+
"@thiny/plugin-sui": "0.1.0",
|
|
46
|
+
"@thiny/plugin-agents": "0.1.0",
|
|
47
|
+
"@thiny/plugin-web-search": "0.1.0",
|
|
48
|
+
"@thiny/walrus": "0.1.0",
|
|
49
|
+
"@thiny/signer-sui": "0.1.0",
|
|
50
50
|
"@thiny/skills": "0.1.0"
|
|
51
51
|
},
|
|
52
52
|
"author": "Thiny AI",
|