thinyai 0.1.4 → 0.1.5
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 +30 -7
- package/package.json +6 -6
package/dist/bin.js
CHANGED
|
@@ -8,7 +8,7 @@ import { fileURLToPath as fileURLToPath2 } from "url";
|
|
|
8
8
|
import { createInterface } from "readline/promises";
|
|
9
9
|
import { clearLine, cursorTo, emitKeypressEvents } from "readline";
|
|
10
10
|
import { stdin, stdout } from "process";
|
|
11
|
-
import { mkdirSync as mkdirSync2 } from "fs";
|
|
11
|
+
import { mkdirSync as mkdirSync2, readFileSync as readFileSync3, writeFileSync as writeFileSync2 } from "fs";
|
|
12
12
|
import { homedir as homedir2 } from "os";
|
|
13
13
|
import { join as join2 } from "path";
|
|
14
14
|
import { z as z6 } from "zod";
|
|
@@ -1440,14 +1440,14 @@ function suiPlugin(opts) {
|
|
|
1440
1440
|
});
|
|
1441
1441
|
const executePtb = defineTool({
|
|
1442
1442
|
name: "sui_execute_ptb",
|
|
1443
|
-
description: "Sign and submit an unsigned Sui programmable transaction (PTB)
|
|
1443
|
+
description: "Sign and submit an unsigned Sui programmable transaction (PTB) produced by an external builder/MCP (e.g. Rill). Re-simulates \u2192 soft policy \u2192 approval gate \u2192 sign + submit. Pass the builder's `unsignedTx`: the JSON string from `Transaction.toJSON()`, built with NO sender and NO gas (the signer fills both). On-chain caps may still abort it. For your OWN transfers/calls use sui_transfer / sui_move_call instead.",
|
|
1444
1444
|
sensitive: true,
|
|
1445
1445
|
parameters: z4.object({
|
|
1446
|
-
|
|
1446
|
+
unsignedTx: z4.string().min(1).describe("Unsigned PTB \u2014 the JSON string from Transaction.toJSON() (no sender, no gas).")
|
|
1447
1447
|
}),
|
|
1448
|
-
execute: async ({
|
|
1449
|
-
const tx = Transaction2.from(
|
|
1450
|
-
return await executeTx(tx, "sui_execute_ptb", {
|
|
1448
|
+
execute: async ({ unsignedTx }) => {
|
|
1449
|
+
const tx = Transaction2.from(unsignedTx);
|
|
1450
|
+
return await executeTx(tx, "sui_execute_ptb", { unsignedTx }, "sign and submit a Sui PTB");
|
|
1451
1451
|
}
|
|
1452
1452
|
});
|
|
1453
1453
|
const transfer = defineTool({
|
|
@@ -2238,6 +2238,28 @@ function parseSkillArgs() {
|
|
|
2238
2238
|
return (args[idx + 1] ?? "").split(",").map((s) => s.trim()).filter(Boolean);
|
|
2239
2239
|
}
|
|
2240
2240
|
var currentSessionId = `cli-${(/* @__PURE__ */ new Date()).getTime().toString()}`;
|
|
2241
|
+
function isNewerVersion(latest, current) {
|
|
2242
|
+
const a = latest.split(".").map((n) => Number(n) || 0);
|
|
2243
|
+
const b = current.split(".").map((n) => Number(n) || 0);
|
|
2244
|
+
for (let i = 0; i < 3; i++) {
|
|
2245
|
+
if ((a[i] ?? 0) !== (b[i] ?? 0)) return (a[i] ?? 0) > (b[i] ?? 0);
|
|
2246
|
+
}
|
|
2247
|
+
return false;
|
|
2248
|
+
}
|
|
2249
|
+
function notifyIfUpdate(thinyDir) {
|
|
2250
|
+
const cur = version();
|
|
2251
|
+
const cacheFile = join2(thinyDir, "update-check.json");
|
|
2252
|
+
try {
|
|
2253
|
+
const cached = JSON.parse(readFileSync3(cacheFile, "utf8"));
|
|
2254
|
+
if (cached.latest && isNewerVersion(cached.latest, cur)) {
|
|
2255
|
+
renderInfo(`Update available: ${cur} \u2192 ${cached.latest} \u2014 run \`thiny update\``);
|
|
2256
|
+
}
|
|
2257
|
+
} catch {
|
|
2258
|
+
}
|
|
2259
|
+
void fetch("https://registry.npmjs.org/thinyai/latest").then((r) => r.json()).then((j) => {
|
|
2260
|
+
if (j.version) writeFileSync2(cacheFile, JSON.stringify({ latest: j.version, at: Date.now() }));
|
|
2261
|
+
}).catch(() => void 0);
|
|
2262
|
+
}
|
|
2241
2263
|
async function runCli() {
|
|
2242
2264
|
const thinyDir = join2(homedir2(), ".thiny");
|
|
2243
2265
|
mkdirSync2(thinyDir, { recursive: true });
|
|
@@ -2349,7 +2371,7 @@ async function runCli() {
|
|
|
2349
2371
|
model,
|
|
2350
2372
|
logger: agentLogger,
|
|
2351
2373
|
persona,
|
|
2352
|
-
systemPrompt: "You are a helpful AI assistant. Use tools when they help you answer better. Be concise.\n\nMEMORY: You have persistent long-term memory across sessions, stored on Walrus. What you already know about the user is injected automatically at the start of each conversation under \u201C[User Memory \u2026]\u201D. When the user shares anything durable about themselves \u2014 their name, role, preferences, projects, or goals, even casually \u2014 immediately call remember_fact to save it. If asked what you remember, answer from the injected user memory (or call recall_memory). You DO remember across sessions \u2014 never say you lack memory or that each session starts fresh.\n\nFor multi-step work, call update_plan to track steps and delegate_task to hand focused sub-problems to a sub-agent.\n\nSUI: You can operate on the Sui blockchain. " + (suiSignerRef ? `A wallet
|
|
2374
|
+
systemPrompt: "You are a helpful AI assistant. Use tools when they help you answer better. Be concise.\n\nMEMORY: You have persistent long-term memory across sessions, stored on Walrus. What you already know about the user is injected automatically at the start of each conversation under \u201C[User Memory \u2026]\u201D. When the user shares anything durable about themselves \u2014 their name, role, preferences, projects, or goals, even casually \u2014 immediately call remember_fact to save it. If asked what you remember, answer from the injected user memory (or call recall_memory). You DO remember across sessions \u2014 never say you lack memory or that each session starts fresh.\n\nFor multi-step work, call update_plan to track steps and delegate_task to hand focused sub-problems to a sub-agent.\n\nSUI: You can operate on the Sui blockchain directly with your own tools \u2014 do NOT tell the user to install a browser wallet extension. " + (suiSignerRef ? `A wallet IS configured on ${suiNetwork} at ${suiSignerRef.address ?? "(unknown)"}. ` : "No wallet is set up yet \u2014 when the user wants Sui, call sui_setup (generate / import / rill) to create or connect one, then tell them to fund the returned address. ") + "Your Sui tools: sui_setup (create/import a wallet), sui_balance and sui_object (read), sui_transfer (send SUI or any coin to an address \u2014 amounts in MIST, 1 SUI = 1e9), sui_move_call (call ANY Move function on any package \u2014 the general way to run any on-chain action), and sui_execute_ptb (sign a PTB an external builder/Rill produced). Prefer sui_transfer for sends and sui_move_call for contract calls. Always confirm details and remind the user to fund the wallet. Never claim you cannot transact on Sui \u2014 you can, via these tools.",
|
|
2353
2375
|
tools: [echoTool, suiSetupTool],
|
|
2354
2376
|
plugins: [
|
|
2355
2377
|
{
|
|
@@ -2408,6 +2430,7 @@ async function runCli() {
|
|
|
2408
2430
|
`Sui: ${suiNetwork} \xB7 ${suiSignerRef.address ?? "?"}${process.env.MCP_URL ? " \xB7 Rill MCP connected" : ""}`
|
|
2409
2431
|
);
|
|
2410
2432
|
else renderInfo("Sui: no wallet \u2014 ask the agent to set one up, or run `thiny sui init`");
|
|
2433
|
+
notifyIfUpdate(thinyDir);
|
|
2411
2434
|
const rl = createInterface({ input: stdin, output: stdout });
|
|
2412
2435
|
emitKeypressEvents(stdin);
|
|
2413
2436
|
const spinner = new Spinner();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "thinyai",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
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/
|
|
42
|
-
"@thiny/walrus": "0.1.0",
|
|
41
|
+
"@thiny/mcp": "0.1.0",
|
|
43
42
|
"@thiny/logger-pino": "0.1.0",
|
|
44
|
-
"@thiny/
|
|
45
|
-
"@thiny/
|
|
43
|
+
"@thiny/walrus": "0.1.0",
|
|
44
|
+
"@thiny/model-aisdk": "0.1.0",
|
|
46
45
|
"@thiny/plugin-agents": "0.1.0",
|
|
46
|
+
"@thiny/memory-memwal": "0.1.0",
|
|
47
47
|
"@thiny/signer-sui": "0.1.0",
|
|
48
48
|
"@thiny/plugin-sui": "0.1.0",
|
|
49
|
-
"@thiny/
|
|
49
|
+
"@thiny/skills": "0.1.0"
|
|
50
50
|
},
|
|
51
51
|
"author": "Thiny AI",
|
|
52
52
|
"engines": {
|