cortico-world-agent-speed 0.2.0 → 0.2.2
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/CHANGELOG.md +64 -0
- package/LICENSE +0 -14
- package/README.md +29 -11
- package/THIRD_PARTY_NOTICES.md +69 -0
- package/activity.d.ts +15 -0
- package/activity.js +88 -3
- package/describe.json +806 -0
- package/dist/webui.css +2 -0
- package/dist/webui.css.map +7 -0
- package/dist/webui.js +2 -0
- package/dist/webui.js.map +7 -0
- package/host/app-store.cjs +68 -0
- package/host/cursor.cjs +67 -0
- package/host/electron-main.cjs +666 -0
- package/host/input-shape.cjs +63 -0
- package/host/mouse-lease.cjs +77 -0
- package/host/overlay.cjs +139 -0
- package/host/portrait.cjs +52 -0
- package/host/preload.cjs +60 -14
- package/host/renderer-gone.cjs +24 -0
- package/host/windows.cjs +251 -0
- package/package.json +27 -7
- package/scripts/build-webui.mjs +40 -0
- package/scripts/speech-bank/build.py +166 -0
- package/scripts/speech-bank/dicts.py +76 -0
- package/src/ENV_PROMPT.en.md +51 -0
- package/src/ENV_PROMPT.md +51 -0
- package/src/asr/address.ts +25 -0
- package/src/asr/hotkey.ts +335 -0
- package/src/asr/result.ts +51 -0
- package/src/asr/segmenter.ts +269 -0
- package/src/asr/sherpa.ts +280 -0
- package/src/asr/simplify.ts +38 -0
- package/src/asr/system-recognizer.ts +292 -0
- package/src/asr/system-sapi.ps1 +173 -0
- package/src/asr/transcription-api.ts +176 -0
- package/src/chat.ts +212 -0
- package/src/config.ts +481 -0
- package/src/cua/ENV_PROMPT.en.md +29 -0
- package/src/cua/ENV_PROMPT.md +29 -0
- package/src/cua/config.ts +88 -0
- package/src/cua/cua.ts +712 -0
- package/src/cua/engine/darwin.ts +410 -0
- package/src/cua/engine/display.ts +55 -0
- package/src/cua/engine/fail.ts +15 -0
- package/src/cua/engine/foreground.ts +8 -0
- package/src/cua/engine/image.ts +57 -0
- package/src/cua/engine/keys.ts +70 -0
- package/src/cua/engine/linux-keys.ts +29 -0
- package/src/cua/engine/linux.ts +343 -0
- package/src/cua/engine/mac-keys.ts +57 -0
- package/src/cua/engine/user-activity.ts +54 -0
- package/src/cua/engine/wait-idle.ts +31 -0
- package/src/cua/engine/win32.ts +299 -0
- package/src/cua/engine-child.ts +274 -0
- package/src/cua/engine-ipc.ts +140 -0
- package/src/cua/i18n/de.ts +53 -0
- package/src/cua/i18n/en.ts +63 -0
- package/src/cua/i18n/es-419.ts +53 -0
- package/src/cua/i18n/fr.ts +53 -0
- package/src/cua/i18n/index.ts +26 -0
- package/src/cua/i18n/it.ts +53 -0
- package/src/cua/i18n/ja.ts +53 -0
- package/src/cua/i18n/ko.ts +53 -0
- package/src/cua/i18n/pt-BR.ts +53 -0
- package/src/cua/i18n/ru.ts +59 -0
- package/src/cua/i18n/zh-Hant.ts +53 -0
- package/src/cua/i18n/zh.ts +59 -0
- package/src/cua/model-text.ts +252 -0
- package/src/cua/terminal.ts +31 -0
- package/src/cua/tools.ts +153 -0
- package/src/definition.ts +146 -0
- package/src/host-reason.ts +32 -0
- package/src/i18n/de.ts +409 -0
- package/src/i18n/en.ts +443 -0
- package/src/i18n/es-419.ts +409 -0
- package/src/i18n/fr.ts +409 -0
- package/src/i18n/index.ts +56 -0
- package/src/i18n/it.ts +409 -0
- package/src/i18n/ja.ts +409 -0
- package/src/i18n/ko.ts +409 -0
- package/src/i18n/pt-BR.ts +409 -0
- package/src/i18n/ru.ts +415 -0
- package/src/i18n/zh-Hant.ts +409 -0
- package/src/i18n/zh.ts +440 -0
- package/src/index.ts +15 -0
- package/src/model-text.ts +344 -0
- package/src/moves.ts +101 -0
- package/src/pack-import.ts +361 -0
- package/src/packs.ts +449 -0
- package/src/runtime/download.ts +29 -0
- package/src/runtime/store.ts +293 -0
- package/src/script.ts +202 -0
- package/src/self.ts +247 -0
- package/src/server.ts +479 -0
- package/src/speech/data/CMUDICT-LICENSE +33 -0
- package/src/speech/data/IPADIC-COPYING +71 -0
- package/src/speech/data/UNICODE-LICENSE +39 -0
- package/src/speech/data/en.tsv.gz +0 -0
- package/src/speech/data/ja-ipadic.tsv.gz +0 -0
- package/src/speech/data/ja-unihan.tsv.gz +0 -0
- package/src/speech/data/zh.json +1 -0
- package/src/speech/index.ts +204 -0
- package/src/speech/ipa.ts +83 -0
- package/src/speech/japanese.ts +105 -0
- package/src/speech/jukujikun.ts +22 -0
- package/src/speech/korean.ts +35 -0
- package/src/speech/lang.ts +151 -0
- package/src/speech/rules.ts +72 -0
- package/src/speech/syllable.ts +76 -0
- package/src/status.ts +164 -0
- package/src/tools.ts +110 -0
- package/src/webui/api-rows.css +2 -0
- package/src/webui/api-rows.ts +44 -0
- package/src/webui/client.ts +451 -0
- package/src/webui/dress-dialog.css +14 -0
- package/src/webui/dress-dialog.ts +117 -0
- package/src/webui/dress-panel.ts +160 -0
- package/src/webui/key-capture.ts +60 -0
- package/src/webui/shared/modal.css +13 -0
- package/src/webui/shared/modal.ts +77 -0
- package/src/webui/shared/problem.css +15 -0
- package/src/webui/shared/problem.ts +217 -0
- package/src/webui/shared/strings.ts +5 -0
- package/src/webui/style.css +50 -0
- package/src/window-host.ts +116 -0
- package/src/world.ts +2926 -0
- package/web/activity-motion.js +117 -0
- package/web/appearance.js +60 -0
- package/web/body-host.js +257 -0
- package/web/coo/coo.js +384 -0
- package/web/coo/figure.js +15 -0
- package/web/coo/figure.json +1224 -0
- package/web/dist/dress-dialog.css +1 -0
- package/web/dist/dress-dialog.js +1 -0
- package/web/drag-row.js +49 -0
- package/web/drag.js +149 -0
- package/web/dress.css +170 -0
- package/web/dress.html +37 -0
- package/web/dress.js +786 -0
- package/web/figure-frame.html +16 -0
- package/web/figure-frame.js +128 -0
- package/web/frame-loop.js +55 -0
- package/web/hints.js +77 -0
- package/web/i18n/de.js +170 -0
- package/web/i18n/en.js +177 -0
- package/web/i18n/es-419.js +170 -0
- package/web/i18n/fr.js +170 -0
- package/web/i18n/it.js +170 -0
- package/web/i18n/ja.js +170 -0
- package/web/i18n/ko.js +170 -0
- package/web/i18n/pt-BR.js +170 -0
- package/web/i18n/ru.js +170 -0
- package/web/i18n/zh-Hant.js +170 -0
- package/web/i18n/zh.js +175 -0
- package/web/i18n.js +54 -0
- package/{renderer/vendor → web}/kit/body.js +31 -58
- package/web/looks.js +70 -0
- package/web/mic-worklet.js +36 -0
- package/web/mic.js +117 -0
- package/web/motion-frames.js +80 -0
- package/web/motion-level.js +40 -0
- package/web/new-year-2027.svg +238 -0
- package/web/overlay.html +16 -0
- package/web/overlay.js +100 -0
- package/web/pet-app.js +3000 -0
- package/web/pet.css +642 -0
- package/web/pet.html +21 -0
- package/web/scale-slider.js +259 -0
- package/web/show-hide.js +49 -0
- package/web/sound.js +245 -0
- package/web/speech/zh.json +1 -0
- package/web/speech/zh.ogg +0 -0
- package/web/speech.js +197 -0
- package/web/stage.js +160 -0
- package/web/swap-motion.js +119 -0
- package/web/ui.js +195 -0
- package/host/launch.js +0 -187
- package/host/library.cjs +0 -638
- package/host/main.cjs +0 -389
- package/index.js +0 -93
- package/renderer/index.html +0 -22
- package/renderer/pet-sandbox.html +0 -11
- package/renderer/pet.css +0 -38
- package/renderer/pet.js +0 -251
- package/renderer/vendor/activity-motion.js +0 -101
- package/renderer/vendor/figure-frame.js +0 -115
- package/renderer/vendor/pack.css +0 -2
- /package/{renderer/vendor → web}/kit/rig.js +0 -0
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* macOS: while App Store is the active application the pet window sits at normal level, behind every
|
|
3
|
+
* other window, and floats again once another application is active. App Store's payment sheet refuses
|
|
4
|
+
* Touch ID while another process's window lies over it, a transparent click-through window included.
|
|
5
|
+
* The active application comes from NSWorkspace and needs no permission.
|
|
6
|
+
*/
|
|
7
|
+
const APP_STORE = 'com.apple.AppStore';
|
|
8
|
+
|
|
9
|
+
/** The active application's bundle identifier, and sending a window to the back of its level. */
|
|
10
|
+
function openAppKit(koffi) {
|
|
11
|
+
koffi.load('/System/Library/Frameworks/AppKit.framework/AppKit');
|
|
12
|
+
const objc = koffi.load('/usr/lib/libobjc.A.dylib');
|
|
13
|
+
const getClass = objc.func('void *objc_getClass(const char *name)');
|
|
14
|
+
const selector = objc.func('void *sel_registerName(const char *name)');
|
|
15
|
+
const send = objc.func('objc_msgSend', 'void *', ['void *', 'void *']);
|
|
16
|
+
const sendVoid = objc.func('objc_msgSend', 'void', ['void *', 'void *']);
|
|
17
|
+
const sendArg = objc.func('objc_msgSend', 'void', ['void *', 'void *', 'void *']);
|
|
18
|
+
const text = objc.func('objc_msgSend', 'const char *', ['void *', 'void *']);
|
|
19
|
+
const sel = Object.fromEntries(['sharedWorkspace', 'frontmostApplication', 'bundleIdentifier', 'UTF8String',
|
|
20
|
+
'window', 'orderBack:', 'new', 'drain'].map((name) => [name, selector(name)]));
|
|
21
|
+
const workspace = send(getClass('NSWorkspace'), sel.sharedWorkspace), pools = getClass('NSAutoreleasePool');
|
|
22
|
+
return {
|
|
23
|
+
frontmost() {
|
|
24
|
+
const pool = send(pools, sel.new);
|
|
25
|
+
try {
|
|
26
|
+
const app = send(workspace, sel.frontmostApplication);
|
|
27
|
+
const id = app && send(app, sel.bundleIdentifier);
|
|
28
|
+
return id ? text(id, sel.UTF8String) : null;
|
|
29
|
+
} finally { sendVoid(pool, sel.drain); }
|
|
30
|
+
},
|
|
31
|
+
/** `handle` is Electron's native window handle: the NSView of the window's content. */
|
|
32
|
+
orderBack(handle) {
|
|
33
|
+
sendArg(send(koffi.decode(handle, 'void *'), sel.window), sel['orderBack:'], null);
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** Null off macOS or when AppKit does not load; the window then keeps floating. `level` is the window's floating level. */
|
|
39
|
+
function createAppStoreRule({ window, level, platform = process.platform,
|
|
40
|
+
workspace = platform === 'darwin' ? require('electron').systemPreferences : null,
|
|
41
|
+
loadAppKit = () => openAppKit(require('koffi')),
|
|
42
|
+
onError = (error) => console.warn('[pet:app-store]', error.message),
|
|
43
|
+
}) {
|
|
44
|
+
if (platform !== 'darwin') return null;
|
|
45
|
+
let appKit;
|
|
46
|
+
try { appKit = loadAppKit(); } catch (error) { onError(error); return null; }
|
|
47
|
+
let lowered = false;
|
|
48
|
+
const apply = () => {
|
|
49
|
+
const store = appKit.frontmost() === APP_STORE;
|
|
50
|
+
if (store !== lowered) {
|
|
51
|
+
lowered = store;
|
|
52
|
+
window.setAlwaysOnTop(!store, level);
|
|
53
|
+
}
|
|
54
|
+
// Showing a window puts it at the front of its level; ordering a hidden window back would show it.
|
|
55
|
+
if (lowered && window.isVisible()) appKit.orderBack(window.getNativeWindowHandle());
|
|
56
|
+
};
|
|
57
|
+
const subscription = workspace.subscribeWorkspaceNotification('NSWorkspaceDidActivateApplicationNotification', apply);
|
|
58
|
+
window.on('show', apply);
|
|
59
|
+
apply();
|
|
60
|
+
return {
|
|
61
|
+
stop() {
|
|
62
|
+
workspace.unsubscribeWorkspaceNotification(subscription);
|
|
63
|
+
window.off('show', apply);
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
module.exports = { APP_STORE, createAppStoreRule };
|
package/host/cursor.cjs
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Chromium's X11 cursor cache only advances with pointer events. A click-through pet receives
|
|
3
|
+
* none, so asking Electron for that cache cannot tell it when to take the mouse again.
|
|
4
|
+
* Keep a separate X connection and query the server; the rest of the host still uses screen DIPs.
|
|
5
|
+
*/
|
|
6
|
+
function createCursorSource({ screen, platform = process.platform, loadKoffi = () => require('koffi') }) {
|
|
7
|
+
let dpy = null, root, queryPointer, closeDisplay;
|
|
8
|
+
if (platform === 'linux') {
|
|
9
|
+
try {
|
|
10
|
+
const x11 = loadKoffi().load('libX11.so.6');
|
|
11
|
+
const openDisplay = x11.func('void *XOpenDisplay(const char *name)');
|
|
12
|
+
const defaultRoot = x11.func('unsigned long XDefaultRootWindow(void *dpy)');
|
|
13
|
+
queryPointer = x11.func('int XQueryPointer(void *dpy, unsigned long win, _Out_ unsigned long *root, _Out_ unsigned long *child, _Out_ int *root_x, _Out_ int *root_y, _Out_ int *win_x, _Out_ int *win_y, _Out_ unsigned int *mask)');
|
|
14
|
+
closeDisplay = x11.func('int XCloseDisplay(void *dpy)');
|
|
15
|
+
dpy = openDisplay(null);
|
|
16
|
+
if (dpy) root = defaultRoot(dpy);
|
|
17
|
+
} catch {
|
|
18
|
+
close();
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function close() {
|
|
23
|
+
if (!dpy) return;
|
|
24
|
+
const connection = dpy;
|
|
25
|
+
dpy = null;
|
|
26
|
+
closeDisplay(connection);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return {
|
|
30
|
+
read() {
|
|
31
|
+
if (dpy) {
|
|
32
|
+
try {
|
|
33
|
+
const r = [0], c = [0], rx = [0], ry = [0], wx = [0], wy = [0], mask = [0];
|
|
34
|
+
if (queryPointer(dpy, root, r, c, rx, ry, wx, wy, mask)) {
|
|
35
|
+
return toDip({ x: rx[0], y: ry[0] }, screen.getAllDisplays());
|
|
36
|
+
}
|
|
37
|
+
} catch { /* If the query fails, keep the host's usual Electron fallback. */ }
|
|
38
|
+
}
|
|
39
|
+
return screen.getCursorScreenPoint();
|
|
40
|
+
},
|
|
41
|
+
close,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Choose the display in physical pixels before converting: getDisplayNearestPoint takes DIPs,
|
|
47
|
+
* so feeding it X11 pixels can select the next monitor at 200%. Offsets are relative to the
|
|
48
|
+
* display's native origin, not the desktop origin (which need not be on the primary display).
|
|
49
|
+
*/
|
|
50
|
+
function toDip(point, displays) {
|
|
51
|
+
let nearest, distance = Infinity;
|
|
52
|
+
for (const display of displays) {
|
|
53
|
+
const { nativeOrigin: o, bounds: b, scaleFactor: s } = display;
|
|
54
|
+
const dx = Math.max(o.x - point.x, 0, point.x - (o.x + b.width * s));
|
|
55
|
+
const dy = Math.max(o.y - point.y, 0, point.y - (o.y + b.height * s));
|
|
56
|
+
const d = dx * dx + dy * dy;
|
|
57
|
+
if (d < distance) { nearest = display; distance = d; }
|
|
58
|
+
if (point.x >= o.x && point.x < o.x + b.width * s && point.y >= o.y && point.y < o.y + b.height * s) {
|
|
59
|
+
nearest = display;
|
|
60
|
+
break;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
const { nativeOrigin: o, bounds: b, scaleFactor: s } = nearest;
|
|
64
|
+
return { x: Math.floor(b.x + (point.x - o.x) / s), y: Math.floor(b.y + (point.y - o.y) / s) };
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
module.exports = { createCursorSource, toDip };
|