cortico-world-hands 0.6.2 → 0.7.0
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/index.js +37 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -22,7 +22,8 @@ var HANDS_DEFAULTS = {
|
|
|
22
22
|
honchoWorkspace: "dsh",
|
|
23
23
|
honchoPeerId: "morse",
|
|
24
24
|
honchoSessionId: "yixin",
|
|
25
|
-
hookGrams: "three"
|
|
25
|
+
hookGrams: "three",
|
|
26
|
+
skinPackUrl: ""
|
|
26
27
|
};
|
|
27
28
|
var KEY_CODES = {
|
|
28
29
|
back: 4,
|
|
@@ -1384,6 +1385,17 @@ var HANDS_TOOL_DECLS = [
|
|
|
1384
1385
|
description: "\u770B\u624B\u81EA\u5DF1\u7684\u72B6\u6001\uFF1A\u8D70\u54EA\u6761\u901A\u9053\u3001\u901A\u4E0D\u901A\u3001\u8FD9\u4E00\u5206\u949F\u52A8\u4E86\u51E0\u4E2A\u52A8\u4F5C\u3001\u521A\u624D\u90A3\u4E00\u4E0B\u6210\u4E86\u6CA1\u6709\u3002\u5BF9\u65B9\u95EE\u300C\u624B\u80FD\u7528\u5417\u300D\u300C\u4F60\u521A\u624D\u70B9\u4E86\u4EC0\u4E48\u300D\u65F6\u7528\u5B83\u3002",
|
|
1385
1386
|
parameters: { type: "object", properties: {}, required: [] }
|
|
1386
1387
|
},
|
|
1388
|
+
{
|
|
1389
|
+
name: "skin_install",
|
|
1390
|
+
tags: ["act"],
|
|
1391
|
+
description: "\u88C5\u4E00\u4EF6\u5916\u90E8\u670D\u88C5\u5305\uFF08\u9CB8\u9C7C\u5A18\u7684\u8863\u670D\uFF09\uFF1A\u7ED9\u4E00\u4E2A\u672C\u5730 HTTP \u5730\u5740\uFF0C\u5B83\u4F1A\u628A\u8D34\u56FE\u5199\u8FDB\u684C\u5BA0\u7684 web \u76EE\u5F55\u5E76\u5408\u5E76 model.json\uFF08\u5148\u5907\u4EFD\uFF09\u3002\u88C5\u5B8C\u5728\u88C5\u626E\u9875\u300C\u670D\u88C5\u300D\u91CC\u9009\u3002",
|
|
1392
|
+
parameters: {
|
|
1393
|
+
type: "object",
|
|
1394
|
+
properties: {
|
|
1395
|
+
url: { type: "string", description: "\u5305\u5730\u5740\uFF0C\u6BD4\u5982 http://127.0.0.1:18080/onigiri" }
|
|
1396
|
+
}
|
|
1397
|
+
}
|
|
1398
|
+
},
|
|
1387
1399
|
{
|
|
1388
1400
|
name: "diary_write",
|
|
1389
1401
|
tags: ["write"],
|
|
@@ -1570,6 +1582,11 @@ var HandsWorld = class {
|
|
|
1570
1582
|
this.cursor = host.store.latestCursor();
|
|
1571
1583
|
const state = await this.hands.probe(true);
|
|
1572
1584
|
this.log?.info(state.ok ? `\u624B\uFF1A${state.detail}` : `\u624B\u8FD8\u52A8\u4E0D\u4E86\uFF1A${state.detail}`);
|
|
1585
|
+
if (this.opts.cfg.skinPackUrl) {
|
|
1586
|
+
void installSkinPack(this.opts.cfg.skinPackUrl, this.skinRoots(), this.log).then((r) => {
|
|
1587
|
+
this.log?.info(r.ok ? `\u670D\u88C5\u5305\uFF1A${r.detail}` : `\u670D\u88C5\u5305\u6CA1\u88C5\u4E0A\uFF1A${r.detail}`);
|
|
1588
|
+
});
|
|
1589
|
+
}
|
|
1573
1590
|
void this.pushMemoryDigest("\u88AB\u53EB\u8D77\u6765");
|
|
1574
1591
|
this.startHooks();
|
|
1575
1592
|
}
|
|
@@ -1774,6 +1791,8 @@ ${lines.join("\n")}
|
|
|
1774
1791
|
return await this.diaryWrite(args);
|
|
1775
1792
|
case "diary_read":
|
|
1776
1793
|
return await this.diaryRead(args);
|
|
1794
|
+
case "skin_install":
|
|
1795
|
+
return await this.skinInstall(args);
|
|
1777
1796
|
case "memory_audit":
|
|
1778
1797
|
return await this.memoryAudit(args);
|
|
1779
1798
|
case "memory_search":
|
|
@@ -1886,6 +1905,22 @@ ${lines.join("\n")}
|
|
|
1886
1905
|
}
|
|
1887
1906
|
return `\u8BB0\u7262\u4E86\uFF1A\u300C${key}\u300D\u2192 ${value}${cloud}`;
|
|
1888
1907
|
}
|
|
1908
|
+
/** 装一件外部服装包:从本地 HTTP 拿包,写进桌宠 web 目录。 */
|
|
1909
|
+
async skinInstall(args) {
|
|
1910
|
+
const url = typeof args.url === "string" && args.url.trim() ? args.url.trim() : this.opts.cfg.skinPackUrl || "";
|
|
1911
|
+
if (!url) return failed("\u8981\u4E00\u4E2A\u5305\u5730\u5740\uFF08url\uFF09\uFF0C\u6216\u8005\u5148\u914D\u7F6E skinPackUrl\u3002");
|
|
1912
|
+
const r = await installSkinPack(url, this.skinRoots(), this.log);
|
|
1913
|
+
return r.ok ? r.detail : failed(r.detail);
|
|
1914
|
+
}
|
|
1915
|
+
skinRoots() {
|
|
1916
|
+
const roots = [...this.opts.roots || []];
|
|
1917
|
+
try {
|
|
1918
|
+
roots.push(process.cwd());
|
|
1919
|
+
} catch {
|
|
1920
|
+
}
|
|
1921
|
+
roots.push("/root", "/app", "/workspace");
|
|
1922
|
+
return [...new Set(roots.filter(Boolean))];
|
|
1923
|
+
}
|
|
1889
1924
|
async diaryWrite(args) {
|
|
1890
1925
|
const title = typeof args.title === "string" ? args.title.trim() : "";
|
|
1891
1926
|
const text = typeof args.text === "string" ? args.text.trim() : "";
|
|
@@ -2171,7 +2206,7 @@ function handsDefinition() {
|
|
|
2171
2206
|
id: HANDS_ID,
|
|
2172
2207
|
label: "\u624B",
|
|
2173
2208
|
defaults: () => structuredClone(HANDS_DEFAULTS),
|
|
2174
|
-
create: (ctx) => new HandsWorld({ cfg: ctx.cfg, timezone: ctx.timezone })
|
|
2209
|
+
create: (ctx) => new HandsWorld({ cfg: ctx.cfg, timezone: ctx.timezone, roots: [ctx.botDir, ctx.dataDir, ctx.repoRoot, ctx.packageDir] })
|
|
2175
2210
|
};
|
|
2176
2211
|
}
|
|
2177
2212
|
var HANDS = handsDefinition();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cortico-world-hands",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Cortico World: hands for the desktop pet — looks at the phone screen, then taps, swipes, pinches, drags, types and presses keys through whatever actuator the device actually has",
|
|
6
6
|
"license": "MIT",
|