visionclaw 0.1.220-beta.2 → 0.1.220-beta.21
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/README.md +2 -2
- package/dist/agent/activity-tracker.d.ts +8 -17
- package/dist/agent/activity-tracker.d.ts.map +1 -1
- package/dist/agent/activity-tracker.js +11 -25
- package/dist/agent/activity-tracker.js.map +1 -1
- package/dist/agent/command-handlers.js +1 -1
- package/dist/agent/command-handlers.js.map +1 -1
- package/dist/agent/context.d.ts +0 -22
- package/dist/agent/context.d.ts.map +1 -1
- package/dist/agent/context.js +0 -79
- package/dist/agent/context.js.map +1 -1
- package/dist/agent/engine-switch-handler.d.ts +2 -2
- package/dist/agent/engine-switch-handler.js +3 -3
- package/dist/agent/engine-switch-handler.js.map +1 -1
- package/dist/agent/engine-switch-target.d.ts.map +1 -1
- package/dist/agent/engine-switch-target.js +5 -1
- package/dist/agent/engine-switch-target.js.map +1 -1
- package/dist/agent/engine-switch.d.ts +4 -4
- package/dist/agent/engine-switch.d.ts.map +1 -1
- package/dist/agent/engine-switch.js +9 -3
- package/dist/agent/engine-switch.js.map +1 -1
- package/dist/agent/engines/claude/session.d.ts +2 -1
- package/dist/agent/engines/claude/session.d.ts.map +1 -1
- package/dist/agent/engines/claude/session.js +5 -4
- package/dist/agent/engines/claude/session.js.map +1 -1
- package/dist/agent/engines/pi/tools.d.ts.map +1 -1
- package/dist/agent/engines/pi/tools.js +3 -1
- package/dist/agent/engines/pi/tools.js.map +1 -1
- package/dist/agent/engines/pi-coding/mcp-config.d.ts +10 -1
- package/dist/agent/engines/pi-coding/mcp-config.d.ts.map +1 -1
- package/dist/agent/engines/pi-coding/mcp-config.js +4 -7
- package/dist/agent/engines/pi-coding/mcp-config.js.map +1 -1
- package/dist/agent/engines/pi-coding/session.d.ts +1 -1
- package/dist/agent/engines/pi-coding/session.d.ts.map +1 -1
- package/dist/agent/engines/pi-coding/session.js +17 -22
- package/dist/agent/engines/pi-coding/session.js.map +1 -1
- package/dist/agent/engines/session-types.d.ts +2 -0
- package/dist/agent/engines/session-types.d.ts.map +1 -1
- package/dist/agent/fast-response-eligibility.d.ts +2 -2
- package/dist/agent/fast-response-eligibility.d.ts.map +1 -1
- package/dist/agent/fast-response-eligibility.js +10 -2
- package/dist/agent/fast-response-eligibility.js.map +1 -1
- package/dist/agent/interrupt-handler.d.ts +2 -2
- package/dist/agent/interrupt-handler.js +4 -4
- package/dist/agent/interrupt-handler.js.map +1 -1
- package/dist/agent/llm-engine-capabilities.d.ts.map +1 -1
- package/dist/agent/llm-engine-capabilities.js +4 -1
- package/dist/agent/llm-engine-capabilities.js.map +1 -1
- package/dist/agent/loop.d.ts +0 -2
- package/dist/agent/loop.d.ts.map +1 -1
- package/dist/agent/loop.js +12 -4
- package/dist/agent/loop.js.map +1 -1
- package/dist/agent/model-provider.d.ts +1 -7
- package/dist/agent/model-provider.d.ts.map +1 -1
- package/dist/agent/model-provider.js +2 -10
- package/dist/agent/model-provider.js.map +1 -1
- package/dist/agent/owner-initiated-eligibility.d.ts +2 -0
- package/dist/agent/owner-initiated-eligibility.d.ts.map +1 -1
- package/dist/agent/owner-initiated-eligibility.js +5 -15
- package/dist/agent/owner-initiated-eligibility.js.map +1 -1
- package/dist/agent/reply-watchdog.d.ts +1 -1
- package/dist/agent/reply-watchdog.js +2 -2
- package/dist/agent/reply-watchdog.js.map +1 -1
- package/dist/agent/runtime-surface.d.ts +2 -0
- package/dist/agent/runtime-surface.d.ts.map +1 -1
- package/dist/agent/runtime-surface.js +12 -2
- package/dist/agent/runtime-surface.js.map +1 -1
- package/dist/agent/status.js +1 -1
- package/dist/agent/status.js.map +1 -1
- package/dist/agent/stream-handler.d.ts.map +1 -1
- package/dist/agent/stream-handler.js +48 -22
- package/dist/agent/stream-handler.js.map +1 -1
- package/dist/agent/system-prompt.d.ts.map +1 -1
- package/dist/agent/system-prompt.js +10 -4
- package/dist/agent/system-prompt.js.map +1 -1
- package/dist/agent/wake-cycle-runner.d.ts +1 -1
- package/dist/agent/wake-cycle-runner.d.ts.map +1 -1
- package/dist/agent/wake-cycle-runner.js +2 -3
- package/dist/agent/wake-cycle-runner.js.map +1 -1
- package/dist/builtin-skills/rethinka-fund/SKILL.md +287 -28
- package/dist/builtin-skills/rethinka-fund/core-contract.md +30 -14
- package/dist/channels/interface.d.ts +0 -34
- package/dist/channels/interface.d.ts.map +1 -1
- package/dist/channels/manager.d.ts.map +1 -1
- package/dist/channels/manager.js +4 -0
- package/dist/channels/manager.js.map +1 -1
- package/dist/channels/qq.js +1 -1
- package/dist/channels/qq.js.map +1 -1
- package/dist/channels/rethinka-fund.d.ts +16 -3
- package/dist/channels/rethinka-fund.d.ts.map +1 -1
- package/dist/channels/rethinka-fund.js +180 -16
- package/dist/channels/rethinka-fund.js.map +1 -1
- package/dist/channels/telegram.js +1 -1
- package/dist/channels/telegram.js.map +1 -1
- package/dist/channels/tui-commands.js +1 -1
- package/dist/channels/tui-commands.js.map +1 -1
- package/dist/config/types.d.ts +4 -2
- package/dist/config/types.d.ts.map +1 -1
- package/dist/config/types.js +1 -1
- package/dist/config/types.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/obs/mini-app/status.d.ts.map +1 -1
- package/dist/obs/mini-app/status.js +63 -0
- package/dist/obs/mini-app/status.js.map +1 -1
- package/dist/obs/mini-app/telegram-auth.d.ts +23 -0
- package/dist/obs/mini-app/telegram-auth.d.ts.map +1 -0
- package/dist/obs/mini-app/telegram-auth.js +55 -0
- package/dist/obs/mini-app/telegram-auth.js.map +1 -0
- package/dist/obs/rdp/linux-x11-backend.d.ts +9 -0
- package/dist/obs/rdp/linux-x11-backend.d.ts.map +1 -1
- package/dist/obs/rdp/linux-x11-backend.js +69 -33
- package/dist/obs/rdp/linux-x11-backend.js.map +1 -1
- package/dist/obs/server.d.ts.map +1 -1
- package/dist/obs/server.js +29 -0
- package/dist/obs/server.js.map +1 -1
- package/dist/reconfigure.d.ts.map +1 -1
- package/dist/reconfigure.js +7 -1
- package/dist/reconfigure.js.map +1 -1
- package/dist/rethinka-fund/hyperliquid-signing.d.ts +56 -0
- package/dist/rethinka-fund/hyperliquid-signing.d.ts.map +1 -0
- package/dist/rethinka-fund/hyperliquid-signing.js +159 -0
- package/dist/rethinka-fund/hyperliquid-signing.js.map +1 -0
- package/dist/rethinka-fund/hyperliquid-trading.d.ts +154 -0
- package/dist/rethinka-fund/hyperliquid-trading.d.ts.map +1 -0
- package/dist/rethinka-fund/hyperliquid-trading.js +673 -0
- package/dist/rethinka-fund/hyperliquid-trading.js.map +1 -0
- package/dist/rethinka-fund/ibkr-flex.d.ts +49 -0
- package/dist/rethinka-fund/ibkr-flex.d.ts.map +1 -0
- package/dist/rethinka-fund/ibkr-flex.js +182 -0
- package/dist/rethinka-fund/ibkr-flex.js.map +1 -0
- package/dist/rethinka-fund/ibkr-mcp.d.ts +119 -0
- package/dist/rethinka-fund/ibkr-mcp.d.ts.map +1 -0
- package/dist/rethinka-fund/ibkr-mcp.js +418 -0
- package/dist/rethinka-fund/ibkr-mcp.js.map +1 -0
- package/dist/rethinka-fund/ibkr-sync.d.ts +30 -17
- package/dist/rethinka-fund/ibkr-sync.d.ts.map +1 -1
- package/dist/rethinka-fund/ibkr-sync.js +66 -31
- package/dist/rethinka-fund/ibkr-sync.js.map +1 -1
- package/dist/rethinka-fund/ibkr-trading.d.ts +102 -0
- package/dist/rethinka-fund/ibkr-trading.d.ts.map +1 -0
- package/dist/rethinka-fund/ibkr-trading.js +594 -0
- package/dist/rethinka-fund/ibkr-trading.js.map +1 -0
- package/dist/rethinka-fund/order-refresh.d.ts +66 -0
- package/dist/rethinka-fund/order-refresh.d.ts.map +1 -0
- package/dist/rethinka-fund/order-refresh.js +195 -0
- package/dist/rethinka-fund/order-refresh.js.map +1 -0
- package/dist/rethinka-fund/polymarket-redeem.d.ts +82 -0
- package/dist/rethinka-fund/polymarket-redeem.d.ts.map +1 -0
- package/dist/rethinka-fund/polymarket-redeem.js +353 -0
- package/dist/rethinka-fund/polymarket-redeem.js.map +1 -0
- package/dist/rethinka-fund/polymarket-trading.d.ts +61 -30
- package/dist/rethinka-fund/polymarket-trading.d.ts.map +1 -1
- package/dist/rethinka-fund/polymarket-trading.js +183 -71
- package/dist/rethinka-fund/polymarket-trading.js.map +1 -1
- package/dist/rethinka-fund/trading-common.d.ts +157 -0
- package/dist/rethinka-fund/trading-common.d.ts.map +1 -0
- package/dist/rethinka-fund/trading-common.js +237 -0
- package/dist/rethinka-fund/trading-common.js.map +1 -0
- package/dist/rethinka-fund-credentials.d.ts +2 -0
- package/dist/rethinka-fund-credentials.d.ts.map +1 -1
- package/dist/rethinka-fund-credentials.js +2 -0
- package/dist/rethinka-fund-credentials.js.map +1 -1
- package/dist/sites/manager.d.ts +50 -0
- package/dist/sites/manager.d.ts.map +1 -0
- package/dist/sites/manager.js +353 -0
- package/dist/sites/manager.js.map +1 -0
- package/dist/sites/pm2-injected-env.d.ts +49 -0
- package/dist/sites/pm2-injected-env.d.ts.map +1 -0
- package/dist/sites/pm2-injected-env.js +160 -0
- package/dist/sites/pm2-injected-env.js.map +1 -0
- package/dist/sites/process.d.ts +20 -0
- package/dist/sites/process.d.ts.map +1 -0
- package/dist/sites/process.js +122 -0
- package/dist/sites/process.js.map +1 -0
- package/dist/sites/registry.d.ts +79 -0
- package/dist/sites/registry.d.ts.map +1 -0
- package/dist/sites/registry.js +147 -0
- package/dist/sites/registry.js.map +1 -0
- package/dist/threads/execution-snapshot.d.ts +1 -0
- package/dist/threads/execution-snapshot.d.ts.map +1 -1
- package/dist/threads/foreground-task.d.ts +16 -3
- package/dist/threads/foreground-task.d.ts.map +1 -1
- package/dist/threads/foreground-task.js +57 -7
- package/dist/threads/foreground-task.js.map +1 -1
- package/dist/threads/foreman-execution.d.ts +14 -2
- package/dist/threads/foreman-execution.d.ts.map +1 -1
- package/dist/threads/foreman-execution.js +15 -3
- package/dist/threads/foreman-execution.js.map +1 -1
- package/dist/threads/foreman-host.d.ts +1 -0
- package/dist/threads/foreman-host.d.ts.map +1 -1
- package/dist/threads/foreman-host.js +27 -5
- package/dist/threads/foreman-host.js.map +1 -1
- package/dist/threads/foreman-protocol.d.ts +1 -0
- package/dist/threads/foreman-protocol.d.ts.map +1 -1
- package/dist/threads/foreman-protocol.js +2 -2
- package/dist/threads/foreman-protocol.js.map +1 -1
- package/dist/threads/foreman-write-contract.d.ts +1 -1
- package/dist/threads/foreman-write-contract.d.ts.map +1 -1
- package/dist/threads/foreman-write-contract.js +1 -1
- package/dist/threads/foreman-write-contract.js.map +1 -1
- package/dist/threads/supervisor.d.ts +2 -1
- package/dist/threads/supervisor.d.ts.map +1 -1
- package/dist/threads/supervisor.js +4 -1
- package/dist/threads/supervisor.js.map +1 -1
- package/dist/threads/thread-meta.d.ts +1 -0
- package/dist/threads/thread-meta.d.ts.map +1 -1
- package/dist/tools/delegation.d.ts.map +1 -1
- package/dist/tools/delegation.js +4 -1
- package/dist/tools/delegation.js.map +1 -1
- package/dist/tools/email.d.ts +1 -1
- package/dist/tools/event-trigger.d.ts +2 -2
- package/dist/tools/finish.d.ts.map +1 -1
- package/dist/tools/finish.js +5 -1
- package/dist/tools/finish.js.map +1 -1
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +4 -0
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/rethinka-fund-trading.d.ts +137 -1
- package/dist/tools/rethinka-fund-trading.d.ts.map +1 -1
- package/dist/tools/rethinka-fund-trading.js +102 -5
- package/dist/tools/rethinka-fund-trading.js.map +1 -1
- package/dist/tools/sites.d.ts +24 -0
- package/dist/tools/sites.d.ts.map +1 -0
- package/dist/tools/sites.js +61 -0
- package/dist/tools/sites.js.map +1 -0
- package/dist/tui/index.js +1 -1
- package/dist-agent/bundle.cjs +2 -2
- package/dist-agent/image-resize-worker.js +1 -0
- package/dist-agent/image-resize-worker.mjs +375 -0
- package/dist-agent/mcp-script-worker.mjs +6 -2
- package/package.json +8 -8
- package/dist/agent/fast-responder.d.ts +0 -52
- package/dist/agent/fast-responder.d.ts.map +0 -1
- package/dist/agent/fast-responder.js +0 -213
- package/dist/agent/fast-responder.js.map +0 -1
- package/dist/rethinka-fund/ibkr-collect.d.ts +0 -70
- package/dist/rethinka-fund/ibkr-collect.d.ts.map +0 -1
- package/dist/rethinka-fund/ibkr-collect.js +0 -180
- package/dist/rethinka-fund/ibkr-collect.js.map +0 -1
|
@@ -0,0 +1,375 @@
|
|
|
1
|
+
// node_modules/.pnpm/@earendil-works+pi-coding-agent@1.6.0_@aws-sdk+credential-provider-node@3.972.84_@model_31046c9408b19bee2ad34b7d4b97ac47/node_modules/@earendil-works/pi-coding-agent/dist/utils/image-resize-worker.js
|
|
2
|
+
import { parentPort } from "node:worker_threads";
|
|
3
|
+
|
|
4
|
+
// node_modules/.pnpm/@earendil-works+pi-coding-agent@1.6.0_@aws-sdk+credential-provider-node@3.972.84_@model_31046c9408b19bee2ad34b7d4b97ac47/node_modules/@earendil-works/pi-coding-agent/dist/utils/exif-orientation.js
|
|
5
|
+
function readOrientationFromTiff(bytes, tiffStart) {
|
|
6
|
+
if (tiffStart + 8 > bytes.length)
|
|
7
|
+
return 1;
|
|
8
|
+
const byteOrder = bytes[tiffStart] << 8 | bytes[tiffStart + 1];
|
|
9
|
+
const le = byteOrder === 18761;
|
|
10
|
+
const read16 = (pos) => {
|
|
11
|
+
if (le)
|
|
12
|
+
return bytes[pos] | bytes[pos + 1] << 8;
|
|
13
|
+
return bytes[pos] << 8 | bytes[pos + 1];
|
|
14
|
+
};
|
|
15
|
+
const read32 = (pos) => {
|
|
16
|
+
if (le)
|
|
17
|
+
return bytes[pos] | bytes[pos + 1] << 8 | bytes[pos + 2] << 16 | bytes[pos + 3] << 24;
|
|
18
|
+
return (bytes[pos] << 24 | bytes[pos + 1] << 16 | bytes[pos + 2] << 8 | bytes[pos + 3]) >>> 0;
|
|
19
|
+
};
|
|
20
|
+
const ifdOffset = read32(tiffStart + 4);
|
|
21
|
+
const ifdStart = tiffStart + ifdOffset;
|
|
22
|
+
if (ifdStart + 2 > bytes.length)
|
|
23
|
+
return 1;
|
|
24
|
+
const entryCount = read16(ifdStart);
|
|
25
|
+
for (let i = 0; i < entryCount; i++) {
|
|
26
|
+
const entryPos = ifdStart + 2 + i * 12;
|
|
27
|
+
if (entryPos + 12 > bytes.length)
|
|
28
|
+
return 1;
|
|
29
|
+
if (read16(entryPos) === 274) {
|
|
30
|
+
const value = read16(entryPos + 8);
|
|
31
|
+
return value >= 1 && value <= 8 ? value : 1;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return 1;
|
|
35
|
+
}
|
|
36
|
+
function findJpegTiffOffset(bytes) {
|
|
37
|
+
let offset = 2;
|
|
38
|
+
while (offset < bytes.length - 1) {
|
|
39
|
+
if (bytes[offset] !== 255)
|
|
40
|
+
return -1;
|
|
41
|
+
const marker = bytes[offset + 1];
|
|
42
|
+
if (marker === 255) {
|
|
43
|
+
offset++;
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
if (marker === 225) {
|
|
47
|
+
if (offset + 4 >= bytes.length)
|
|
48
|
+
return -1;
|
|
49
|
+
const segmentStart = offset + 4;
|
|
50
|
+
if (segmentStart + 6 > bytes.length)
|
|
51
|
+
return -1;
|
|
52
|
+
if (hasExifHeader(bytes, segmentStart))
|
|
53
|
+
return segmentStart + 6;
|
|
54
|
+
}
|
|
55
|
+
if (offset + 4 > bytes.length)
|
|
56
|
+
return -1;
|
|
57
|
+
const length = bytes[offset + 2] << 8 | bytes[offset + 3];
|
|
58
|
+
offset += 2 + length;
|
|
59
|
+
}
|
|
60
|
+
return -1;
|
|
61
|
+
}
|
|
62
|
+
function findWebpTiffOffset(bytes) {
|
|
63
|
+
let offset = 12;
|
|
64
|
+
while (offset + 8 <= bytes.length) {
|
|
65
|
+
const chunkId = String.fromCharCode(bytes[offset], bytes[offset + 1], bytes[offset + 2], bytes[offset + 3]);
|
|
66
|
+
const chunkSize = bytes[offset + 4] | bytes[offset + 5] << 8 | bytes[offset + 6] << 16 | bytes[offset + 7] << 24;
|
|
67
|
+
const dataStart = offset + 8;
|
|
68
|
+
if (chunkId === "EXIF") {
|
|
69
|
+
if (dataStart + chunkSize > bytes.length)
|
|
70
|
+
return -1;
|
|
71
|
+
const tiffStart = chunkSize >= 6 && hasExifHeader(bytes, dataStart) ? dataStart + 6 : dataStart;
|
|
72
|
+
return tiffStart;
|
|
73
|
+
}
|
|
74
|
+
offset = dataStart + chunkSize + chunkSize % 2;
|
|
75
|
+
}
|
|
76
|
+
return -1;
|
|
77
|
+
}
|
|
78
|
+
function hasExifHeader(bytes, offset) {
|
|
79
|
+
return bytes[offset] === 69 && bytes[offset + 1] === 120 && bytes[offset + 2] === 105 && bytes[offset + 3] === 102 && bytes[offset + 4] === 0 && bytes[offset + 5] === 0;
|
|
80
|
+
}
|
|
81
|
+
function getExifOrientation(bytes) {
|
|
82
|
+
let tiffOffset = -1;
|
|
83
|
+
if (bytes.length >= 2 && bytes[0] === 255 && bytes[1] === 216) {
|
|
84
|
+
tiffOffset = findJpegTiffOffset(bytes);
|
|
85
|
+
} else if (bytes.length >= 12 && bytes[0] === 82 && bytes[1] === 73 && bytes[2] === 70 && bytes[3] === 70 && bytes[8] === 87 && bytes[9] === 69 && bytes[10] === 66 && bytes[11] === 80) {
|
|
86
|
+
tiffOffset = findWebpTiffOffset(bytes);
|
|
87
|
+
}
|
|
88
|
+
if (tiffOffset === -1)
|
|
89
|
+
return 1;
|
|
90
|
+
return readOrientationFromTiff(bytes, tiffOffset);
|
|
91
|
+
}
|
|
92
|
+
function rotate90(photon, image, dstIndex) {
|
|
93
|
+
const w = image.get_width();
|
|
94
|
+
const h = image.get_height();
|
|
95
|
+
const src = image.get_raw_pixels();
|
|
96
|
+
const dst = new Uint8Array(src.length);
|
|
97
|
+
for (let y = 0; y < h; y++) {
|
|
98
|
+
for (let x = 0; x < w; x++) {
|
|
99
|
+
const srcIdx = (y * w + x) * 4;
|
|
100
|
+
const dstIdx = dstIndex(x, y, w, h) * 4;
|
|
101
|
+
dst[dstIdx] = src[srcIdx];
|
|
102
|
+
dst[dstIdx + 1] = src[srcIdx + 1];
|
|
103
|
+
dst[dstIdx + 2] = src[srcIdx + 2];
|
|
104
|
+
dst[dstIdx + 3] = src[srcIdx + 3];
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
return new photon.PhotonImage(dst, h, w);
|
|
108
|
+
}
|
|
109
|
+
function applyExifOrientation(photon, image, originalBytes) {
|
|
110
|
+
const orientation = getExifOrientation(originalBytes);
|
|
111
|
+
if (orientation === 1)
|
|
112
|
+
return image;
|
|
113
|
+
switch (orientation) {
|
|
114
|
+
case 2:
|
|
115
|
+
photon.fliph(image);
|
|
116
|
+
return image;
|
|
117
|
+
case 3:
|
|
118
|
+
photon.fliph(image);
|
|
119
|
+
photon.flipv(image);
|
|
120
|
+
return image;
|
|
121
|
+
case 4:
|
|
122
|
+
photon.flipv(image);
|
|
123
|
+
return image;
|
|
124
|
+
case 5: {
|
|
125
|
+
const rotated = rotate90(photon, image, (x, y, _w, h) => x * h + (h - 1 - y));
|
|
126
|
+
photon.fliph(rotated);
|
|
127
|
+
return rotated;
|
|
128
|
+
}
|
|
129
|
+
case 6:
|
|
130
|
+
return rotate90(photon, image, (x, y, _w, h) => x * h + (h - 1 - y));
|
|
131
|
+
case 7: {
|
|
132
|
+
const rotated = rotate90(photon, image, (x, y, w, h) => (w - 1 - x) * h + y);
|
|
133
|
+
photon.fliph(rotated);
|
|
134
|
+
return rotated;
|
|
135
|
+
}
|
|
136
|
+
case 8:
|
|
137
|
+
return rotate90(photon, image, (x, y, w, h) => (w - 1 - x) * h + y);
|
|
138
|
+
default:
|
|
139
|
+
return image;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// node_modules/.pnpm/@earendil-works+pi-coding-agent@1.6.0_@aws-sdk+credential-provider-node@3.972.84_@model_31046c9408b19bee2ad34b7d4b97ac47/node_modules/@earendil-works/pi-coding-agent/dist/utils/photon.js
|
|
144
|
+
import { createRequire } from "module";
|
|
145
|
+
import * as path from "path";
|
|
146
|
+
import { fileURLToPath } from "url";
|
|
147
|
+
var require2 = createRequire(import.meta.url);
|
|
148
|
+
var fs = require2("fs");
|
|
149
|
+
var WASM_FILENAME = "photon_rs_bg.wasm";
|
|
150
|
+
var photonModule = null;
|
|
151
|
+
var loadPromise = null;
|
|
152
|
+
function pathOrNull(file) {
|
|
153
|
+
if (typeof file === "string") {
|
|
154
|
+
return file;
|
|
155
|
+
}
|
|
156
|
+
if (file instanceof URL) {
|
|
157
|
+
return fileURLToPath(file);
|
|
158
|
+
}
|
|
159
|
+
return null;
|
|
160
|
+
}
|
|
161
|
+
function getFallbackWasmPaths() {
|
|
162
|
+
const execDir = path.dirname(process.execPath);
|
|
163
|
+
return [
|
|
164
|
+
path.join(execDir, WASM_FILENAME),
|
|
165
|
+
path.join(execDir, "photon", WASM_FILENAME),
|
|
166
|
+
path.join(process.cwd(), WASM_FILENAME)
|
|
167
|
+
];
|
|
168
|
+
}
|
|
169
|
+
function patchPhotonWasmRead() {
|
|
170
|
+
const originalReadFileSync = fs.readFileSync.bind(fs);
|
|
171
|
+
const fallbackPaths = getFallbackWasmPaths();
|
|
172
|
+
const mutableFs = fs;
|
|
173
|
+
const patchedReadFileSync = ((...args) => {
|
|
174
|
+
const [file, options] = args;
|
|
175
|
+
const resolvedPath = pathOrNull(file);
|
|
176
|
+
if (resolvedPath?.endsWith(WASM_FILENAME)) {
|
|
177
|
+
try {
|
|
178
|
+
return originalReadFileSync(...args);
|
|
179
|
+
} catch (error) {
|
|
180
|
+
const err = error;
|
|
181
|
+
if (err?.code && err.code !== "ENOENT") {
|
|
182
|
+
throw error;
|
|
183
|
+
}
|
|
184
|
+
for (const fallbackPath of fallbackPaths) {
|
|
185
|
+
if (!fs.existsSync(fallbackPath)) {
|
|
186
|
+
continue;
|
|
187
|
+
}
|
|
188
|
+
if (options === void 0) {
|
|
189
|
+
return originalReadFileSync(fallbackPath);
|
|
190
|
+
}
|
|
191
|
+
return originalReadFileSync(fallbackPath, options);
|
|
192
|
+
}
|
|
193
|
+
throw error;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
return originalReadFileSync(...args);
|
|
197
|
+
});
|
|
198
|
+
try {
|
|
199
|
+
mutableFs.readFileSync = patchedReadFileSync;
|
|
200
|
+
} catch {
|
|
201
|
+
Object.defineProperty(fs, "readFileSync", {
|
|
202
|
+
value: patchedReadFileSync,
|
|
203
|
+
writable: true,
|
|
204
|
+
configurable: true
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
return () => {
|
|
208
|
+
try {
|
|
209
|
+
mutableFs.readFileSync = originalReadFileSync;
|
|
210
|
+
} catch {
|
|
211
|
+
Object.defineProperty(fs, "readFileSync", {
|
|
212
|
+
value: originalReadFileSync,
|
|
213
|
+
writable: true,
|
|
214
|
+
configurable: true
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
async function loadPhoton() {
|
|
220
|
+
if (photonModule) {
|
|
221
|
+
return photonModule;
|
|
222
|
+
}
|
|
223
|
+
if (loadPromise) {
|
|
224
|
+
return loadPromise;
|
|
225
|
+
}
|
|
226
|
+
loadPromise = (async () => {
|
|
227
|
+
const restoreReadFileSync = patchPhotonWasmRead();
|
|
228
|
+
try {
|
|
229
|
+
photonModule = await import("@silvia-odwyer/photon-node");
|
|
230
|
+
return photonModule;
|
|
231
|
+
} catch {
|
|
232
|
+
photonModule = null;
|
|
233
|
+
return photonModule;
|
|
234
|
+
} finally {
|
|
235
|
+
restoreReadFileSync();
|
|
236
|
+
}
|
|
237
|
+
})();
|
|
238
|
+
return loadPromise;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
// node_modules/.pnpm/@earendil-works+pi-coding-agent@1.6.0_@aws-sdk+credential-provider-node@3.972.84_@model_31046c9408b19bee2ad34b7d4b97ac47/node_modules/@earendil-works/pi-coding-agent/dist/utils/image-resize-core.js
|
|
242
|
+
var IMAGE_RESIZE_WORKER_RESPONSE_TYPE = "pi:image-resize-response";
|
|
243
|
+
var DEFAULT_MAX_BYTES = 4.5 * 1024 * 1024;
|
|
244
|
+
var DEFAULT_OPTIONS = {
|
|
245
|
+
maxWidth: 2e3,
|
|
246
|
+
maxHeight: 2e3,
|
|
247
|
+
maxBytes: DEFAULT_MAX_BYTES,
|
|
248
|
+
jpegQuality: 80
|
|
249
|
+
};
|
|
250
|
+
function encodeCandidate(buffer, mimeType) {
|
|
251
|
+
const data = Buffer.from(buffer).toString("base64");
|
|
252
|
+
return {
|
|
253
|
+
data,
|
|
254
|
+
encodedSize: Buffer.byteLength(data, "utf-8"),
|
|
255
|
+
mimeType
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
async function resizeImageInProcess(inputBytes, mimeType, options) {
|
|
259
|
+
const opts = { ...DEFAULT_OPTIONS, ...options };
|
|
260
|
+
const inputBase64Size = Math.ceil(inputBytes.byteLength / 3) * 4;
|
|
261
|
+
const photon = await loadPhoton();
|
|
262
|
+
if (!photon) {
|
|
263
|
+
return null;
|
|
264
|
+
}
|
|
265
|
+
let image;
|
|
266
|
+
try {
|
|
267
|
+
let tryEncodings = function(width, height, jpegQualities) {
|
|
268
|
+
const resized = photon.resize(image, width, height, photon.SamplingFilter.Lanczos3);
|
|
269
|
+
try {
|
|
270
|
+
const candidates = [encodeCandidate(resized.get_bytes(), "image/png")];
|
|
271
|
+
for (const quality of jpegQualities) {
|
|
272
|
+
candidates.push(encodeCandidate(resized.get_bytes_jpeg(quality), "image/jpeg"));
|
|
273
|
+
}
|
|
274
|
+
return candidates;
|
|
275
|
+
} finally {
|
|
276
|
+
resized.free();
|
|
277
|
+
}
|
|
278
|
+
};
|
|
279
|
+
const rawImage = photon.PhotonImage.new_from_byteslice(inputBytes);
|
|
280
|
+
image = applyExifOrientation(photon, rawImage, inputBytes);
|
|
281
|
+
if (image !== rawImage)
|
|
282
|
+
rawImage.free();
|
|
283
|
+
const originalWidth = image.get_width();
|
|
284
|
+
const originalHeight = image.get_height();
|
|
285
|
+
const format = mimeType.split("/")[1] ?? "png";
|
|
286
|
+
if (originalWidth <= opts.maxWidth && originalHeight <= opts.maxHeight && inputBase64Size < opts.maxBytes) {
|
|
287
|
+
return {
|
|
288
|
+
data: Buffer.from(inputBytes).toString("base64"),
|
|
289
|
+
mimeType: mimeType || `image/${format}`,
|
|
290
|
+
originalWidth,
|
|
291
|
+
originalHeight,
|
|
292
|
+
width: originalWidth,
|
|
293
|
+
height: originalHeight,
|
|
294
|
+
wasResized: false
|
|
295
|
+
};
|
|
296
|
+
}
|
|
297
|
+
let targetWidth = originalWidth;
|
|
298
|
+
let targetHeight = originalHeight;
|
|
299
|
+
if (targetWidth > opts.maxWidth) {
|
|
300
|
+
targetHeight = Math.round(targetHeight * opts.maxWidth / targetWidth);
|
|
301
|
+
targetWidth = opts.maxWidth;
|
|
302
|
+
}
|
|
303
|
+
if (targetHeight > opts.maxHeight) {
|
|
304
|
+
targetWidth = Math.round(targetWidth * opts.maxHeight / targetHeight);
|
|
305
|
+
targetHeight = opts.maxHeight;
|
|
306
|
+
}
|
|
307
|
+
const qualitySteps = Array.from(/* @__PURE__ */ new Set([opts.jpegQuality, 85, 70, 55, 40]));
|
|
308
|
+
let currentWidth = targetWidth;
|
|
309
|
+
let currentHeight = targetHeight;
|
|
310
|
+
while (true) {
|
|
311
|
+
const [png, jpeg, ...lowerQualityJpegs] = tryEncodings(currentWidth, currentHeight, qualitySteps);
|
|
312
|
+
const preferred = jpeg && jpeg.encodedSize < png.encodedSize ? [jpeg, png] : [png, jpeg];
|
|
313
|
+
for (const candidate of [...preferred, ...lowerQualityJpegs]) {
|
|
314
|
+
if (candidate && candidate.encodedSize < opts.maxBytes) {
|
|
315
|
+
return {
|
|
316
|
+
data: candidate.data,
|
|
317
|
+
mimeType: candidate.mimeType,
|
|
318
|
+
originalWidth,
|
|
319
|
+
originalHeight,
|
|
320
|
+
width: currentWidth,
|
|
321
|
+
height: currentHeight,
|
|
322
|
+
wasResized: true
|
|
323
|
+
};
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
if (currentWidth === 1 && currentHeight === 1) {
|
|
327
|
+
break;
|
|
328
|
+
}
|
|
329
|
+
const nextWidth = currentWidth === 1 ? 1 : Math.max(1, Math.floor(currentWidth * 0.75));
|
|
330
|
+
const nextHeight = currentHeight === 1 ? 1 : Math.max(1, Math.floor(currentHeight * 0.75));
|
|
331
|
+
if (nextWidth === currentWidth && nextHeight === currentHeight) {
|
|
332
|
+
break;
|
|
333
|
+
}
|
|
334
|
+
currentWidth = nextWidth;
|
|
335
|
+
currentHeight = nextHeight;
|
|
336
|
+
}
|
|
337
|
+
return null;
|
|
338
|
+
} catch {
|
|
339
|
+
return null;
|
|
340
|
+
} finally {
|
|
341
|
+
if (image) {
|
|
342
|
+
image.free();
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
// node_modules/.pnpm/@earendil-works+pi-coding-agent@1.6.0_@aws-sdk+credential-provider-node@3.972.84_@model_31046c9408b19bee2ad34b7d4b97ac47/node_modules/@earendil-works/pi-coding-agent/dist/utils/image-resize-worker.js
|
|
348
|
+
function isResizeImageWorkerRequest(value) {
|
|
349
|
+
if (!value || typeof value !== "object")
|
|
350
|
+
return false;
|
|
351
|
+
const record = value;
|
|
352
|
+
return record.inputBytes instanceof Uint8Array && typeof record.mimeType === "string";
|
|
353
|
+
}
|
|
354
|
+
var port = parentPort;
|
|
355
|
+
if (!port) {
|
|
356
|
+
throw new Error("image resize worker requires parentPort");
|
|
357
|
+
}
|
|
358
|
+
port.once("message", (message) => {
|
|
359
|
+
void (async () => {
|
|
360
|
+
try {
|
|
361
|
+
if (!isResizeImageWorkerRequest(message)) {
|
|
362
|
+
throw new Error("Invalid image resize worker request");
|
|
363
|
+
}
|
|
364
|
+
const result = await resizeImageInProcess(message.inputBytes, message.mimeType, message.options);
|
|
365
|
+
const response = { type: IMAGE_RESIZE_WORKER_RESPONSE_TYPE, result };
|
|
366
|
+
port.postMessage(response);
|
|
367
|
+
} catch (error) {
|
|
368
|
+
const response = {
|
|
369
|
+
type: IMAGE_RESIZE_WORKER_RESPONSE_TYPE,
|
|
370
|
+
error: error instanceof Error ? error.message : String(error)
|
|
371
|
+
};
|
|
372
|
+
port.postMessage(response);
|
|
373
|
+
}
|
|
374
|
+
})();
|
|
375
|
+
});
|
|
@@ -129,11 +129,15 @@ const PRELUDE_SOURCE = `(function (bridge) {
|
|
|
129
129
|
get(_target, property) {
|
|
130
130
|
if (property === "search") return (input) => request("search", { input });
|
|
131
131
|
if (property === "describe") return (input) => request("describe", { input });
|
|
132
|
-
if (property === "call") return (path, args) => {
|
|
132
|
+
if (property === "call") return (path, args, options) => {
|
|
133
133
|
if (typeof path !== "string" || path.trim() === "") {
|
|
134
134
|
return Promise.resolve({ ok: false, error: { code: "invalid_tool_path", message: "tools.call(path, args) requires a non-empty tool path." } });
|
|
135
135
|
}
|
|
136
|
-
|
|
136
|
+
const server = options?.server;
|
|
137
|
+
if (server !== undefined && (typeof server !== "string" || server.trim() === "")) {
|
|
138
|
+
return Promise.resolve({ ok: false, error: { code: "invalid_tool_server", message: "tools.call(path, args, { server }) requires a non-empty server name." } });
|
|
139
|
+
}
|
|
140
|
+
return request("call", server === undefined ? { path, args } : { path, args, server });
|
|
137
141
|
};
|
|
138
142
|
if (typeof property !== "string" || reserved.has(property)) return undefined;
|
|
139
143
|
return (args) => request("call", { path: property, args });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "visionclaw",
|
|
3
|
-
"version": "0.1.220-beta.
|
|
3
|
+
"version": "0.1.220-beta.21",
|
|
4
4
|
"description": "A personal assistant agent that runs on your desktop, receives commands from messaging channels, and executes tasks autonomously.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -18,16 +18,16 @@
|
|
|
18
18
|
"CHANGELOG.md"
|
|
19
19
|
],
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@anthropic-ai/claude-agent-sdk": "0.3.
|
|
22
|
-
"@anthropic-ai/sdk": "0.
|
|
23
|
-
"@earendil-works/pi-agent-core": "
|
|
24
|
-
"@earendil-works/pi-ai": "
|
|
25
|
-
"@earendil-works/pi-coding-agent": "
|
|
21
|
+
"@anthropic-ai/claude-agent-sdk": "0.3.331",
|
|
22
|
+
"@anthropic-ai/sdk": "0.137.0",
|
|
23
|
+
"@earendil-works/pi-agent-core": "1.6.0",
|
|
24
|
+
"@earendil-works/pi-ai": "1.6.0",
|
|
25
|
+
"@earendil-works/pi-coding-agent": "1.6.0",
|
|
26
26
|
"@google/genai": "1.50.1",
|
|
27
27
|
"@modelcontextprotocol/sdk": "1.29.0",
|
|
28
28
|
"@playwright/mcp": "0.0.83",
|
|
29
29
|
"@polymarket/client": "0.20.0",
|
|
30
|
-
"@
|
|
30
|
+
"@silvia-odwyer/photon-node": "0.3.4",
|
|
31
31
|
"@types/qrcode": "1.5.6",
|
|
32
32
|
"cron-parser": "4.9.0",
|
|
33
33
|
"discord.js": "14.26.3",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"openai": "6.34.0",
|
|
40
40
|
"otplib": "13.4.0",
|
|
41
41
|
"ox": "0.14.68",
|
|
42
|
-
"pi-mcp-adapter": "
|
|
42
|
+
"pi-mcp-adapter": "5.4.0",
|
|
43
43
|
"playwright": "1.59.1",
|
|
44
44
|
"prompts": "2.4.2",
|
|
45
45
|
"qrcode": "1.5.4",
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { type CommandMessage } from "../channels/interface.js";
|
|
3
|
-
import type { VisionClawConfig } from "../config/types.js";
|
|
4
|
-
declare const FastResponseSchema: z.ZodObject<{
|
|
5
|
-
replies: z.ZodArray<z.ZodObject<{
|
|
6
|
-
channel: z.ZodString;
|
|
7
|
-
sender: z.ZodString;
|
|
8
|
-
reply: z.ZodString;
|
|
9
|
-
}, z.core.$strip>>;
|
|
10
|
-
needsPrimaryAction: z.ZodBoolean;
|
|
11
|
-
briefForPrimary: z.ZodString;
|
|
12
|
-
}, z.core.$strip>;
|
|
13
|
-
export type FastResponse = z.infer<typeof FastResponseSchema>;
|
|
14
|
-
export type FastResponseMode = "interrupt" | "watchdog";
|
|
15
|
-
/** A receipt acknowledgment cannot claim that background work was admitted. */
|
|
16
|
-
export declare function buildInterruptPreamble(): string[];
|
|
17
|
-
/** Exported for golden renders and unit tests. */
|
|
18
|
-
export declare function buildFastResponderRecipientList(recipients: {
|
|
19
|
-
channel: string;
|
|
20
|
-
sender: string;
|
|
21
|
-
}[]): string;
|
|
22
|
-
/** Shared by the runtime and golden renders so branch precedence stays visible. */
|
|
23
|
-
export declare function resolveFastResponderPreamble(mode: FastResponseMode, compacting: boolean, learning: boolean): string[];
|
|
24
|
-
/**
|
|
25
|
-
* Make a single lightweight API call to acknowledge one or more user messages
|
|
26
|
-
* that arrived while the primary agent is busy. Handles the batch case where
|
|
27
|
-
* multiple messages arrive in quick succession — the model sees all of them
|
|
28
|
-
* and produces per-sender personalized replies + a unified briefing.
|
|
29
|
-
*
|
|
30
|
-
* Uses {@link runSideCall} so the request is routed through the same engine
|
|
31
|
-
* (Claude SDK or Pi one-shot `complete()`) as the main agent.
|
|
32
|
-
*
|
|
33
|
-
* Returns null if the call fails so the caller can fall back to the original
|
|
34
|
-
* interrupt-injection path.
|
|
35
|
-
*/
|
|
36
|
-
export declare function fastRespond(options: {
|
|
37
|
-
systemPrompt: string;
|
|
38
|
-
messages: CommandMessage[];
|
|
39
|
-
activitySummary: string;
|
|
40
|
-
config: VisionClawConfig;
|
|
41
|
-
mode?: FastResponseMode;
|
|
42
|
-
compacting?: boolean;
|
|
43
|
-
learning?: boolean;
|
|
44
|
-
}): Promise<FastResponse | null>;
|
|
45
|
-
export declare function buildFastResponderAppendPrompt(preamble: string[], recipientList: string, options?: {
|
|
46
|
-
includeFinAppGuidance?: boolean;
|
|
47
|
-
}): string;
|
|
48
|
-
export declare function buildFastResponderSystemPrompt(systemPrompt: string, preamble: string[], recipientList: string, appendOptions?: Parameters<typeof buildFastResponderAppendPrompt>[2]): string;
|
|
49
|
-
export declare function buildFastResponderMessageSummary(messages: CommandMessage[]): string;
|
|
50
|
-
export declare function buildFastResponderUserPrompt(activitySummary: string, eligibleMessageCount: number, messageSummary: string): string;
|
|
51
|
-
export {};
|
|
52
|
-
//# sourceMappingURL=fast-responder.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fast-responder.d.ts","sourceRoot":"","sources":["../../src/agent/fast-responder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAkB,KAAK,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAG/E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAiB3D,QAAA,MAAM,kBAAkB;;;;;;;;iBAkBtB,CAAC;AAEH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE9D,MAAM,MAAM,gBAAgB,GAAG,WAAW,GAAG,UAAU,CAAC;AAqCxD,+EAA+E;AAC/E,wBAAgB,sBAAsB,IAAI,MAAM,EAAE,CAWjD;AAMD,kDAAkD;AAClD,wBAAgB,+BAA+B,CAC7C,UAAU,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,EAAE,GAChD,MAAM,CAmBR;AAED,mFAAmF;AACnF,wBAAgB,4BAA4B,CAC1C,IAAI,EAAE,gBAAgB,EACtB,UAAU,EAAE,OAAO,EACnB,QAAQ,EAAE,OAAO,GAChB,MAAM,EAAE,CAKV;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,WAAW,CAAC,OAAO,EAAE;IACzC,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,cAAc,EAAE,CAAC;IAC3B,eAAe,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,gBAAgB,CAAC;IACzB,IAAI,CAAC,EAAE,gBAAgB,CAAC;IACxB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAgE/B;AAED,wBAAgB,8BAA8B,CAC5C,QAAQ,EAAE,MAAM,EAAE,EAClB,aAAa,EAAE,MAAM,EACrB,OAAO,GAAE;IACP,qBAAqB,CAAC,EAAE,OAAO,CAAC;CAC5B,GACL,MAAM,CA4BR;AAED,wBAAgB,8BAA8B,CAC5C,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,MAAM,EAAE,EAClB,aAAa,EAAE,MAAM,EACrB,aAAa,CAAC,EAAE,UAAU,CAAC,OAAO,8BAA8B,CAAC,CAAC,CAAC,CAAC,GACnE,MAAM,CAGR;AAED,wBAAgB,gCAAgC,CAAC,QAAQ,EAAE,cAAc,EAAE,GAAG,MAAM,CAanF;AAGD,wBAAgB,4BAA4B,CAC1C,eAAe,EAAE,MAAM,EACvB,oBAAoB,EAAE,MAAM,EAC5B,cAAc,EAAE,MAAM,GACrB,MAAM,CAQR"}
|