friend-assistant 0.1.97 → 0.1.98
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 +1 -1
- package/dist/BUILD.json +2 -2
- package/dist/friend.mjs +64 -11
- package/dist/pc-agent/agent.js +1 -1
- package/dist/pc-agent/agent.js.sha256 +1 -1
- package/dist/web/assets/{OrgParts-njiGJYUH.js → OrgParts-cpxPQOUM.js} +1 -1
- package/dist/web/assets/{index-WRsUpXK7.js → index-BWBKqeo4.js} +22 -22
- package/dist/web/assets/{jarvis-ui-B58dux8c.js → jarvis-ui-BIfOaoqG.js} +1 -1
- package/dist/web/assets/{jarvisTree-wFLpsMvP.js → jarvisTree-DYpxvcj2.js} +1 -1
- package/dist/web/assets/{ort.bundle.min-DT_V4JXv.js → ort.bundle.min-DoGBmaIC.js} +1 -1
- package/dist/web/index.html +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -432,7 +432,7 @@ Besides the simple widgets, Every component of the Jarvis HUD library that is sa
|
|
|
432
432
|
|
|
433
433
|
## Windows PCs: the assistant uses a PC like a person
|
|
434
434
|
|
|
435
|
-
Add as many Windows PCs as you want (Plugins,
|
|
435
|
+
Add as many Windows PCs as you want: install the **Windows PCs** plugin (Plugins, Available, Install, then Turn on), press **Configure** and **Add a PC**. The assistant can then look at the screen, click, type, open apps, wait for things, run commands, work with files, and drive a terminal such as Claude Code (open a project, resume an earlier session, answer its menus, give it instructions, check its status). Each PC runs a small agent that connects out to your Friend; **nothing of Friend is installed on it**.
|
|
436
436
|
|
|
437
437
|
- **Add a PC:** one PowerShell line (or a small `.cmd` file) installs the official Node.js (its signature is checked) and the agent (its checksum is checked) into your own user folder, starts it at every logon, and opens a page to approve the PC with your PIN (device authorization with PKCE). No administrator rights, no unsigned program.
|
|
438
438
|
- **Permissions per PC**, all off to start: control the screen, screenshots, commands and terminals, programs, registry, files (off, read, read and write, only inside listed folders).
|
package/dist/BUILD.json
CHANGED
package/dist/friend.mjs
CHANGED
|
@@ -3374,6 +3374,10 @@ function sanitizeChrome(raw) {
|
|
|
3374
3374
|
const r = raw && typeof raw === "object" ? raw : {};
|
|
3375
3375
|
return { installed: r.installed === true || r.installed === void 0 && r.enabled === true, enabled: r.enabled === true, remote: r.remote === true };
|
|
3376
3376
|
}
|
|
3377
|
+
function sanitizePcs(raw) {
|
|
3378
|
+
const r = raw && typeof raw === "object" ? raw : {};
|
|
3379
|
+
return { installed: r.installed === true || r.installed === void 0 && r.enabled === true, enabled: r.enabled === true };
|
|
3380
|
+
}
|
|
3377
3381
|
function sanitizeAudius(raw) {
|
|
3378
3382
|
const r = raw && typeof raw === "object" ? raw : {};
|
|
3379
3383
|
return { installed: r.installed === true || r.installed === void 0 && r.enabled === true, enabled: r.enabled === true };
|
|
@@ -3848,6 +3852,7 @@ var defaults = (dataDir) => ({
|
|
|
3848
3852
|
alexa: sanitizeAlexa({}),
|
|
3849
3853
|
music: sanitizeMusic({}),
|
|
3850
3854
|
chrome: sanitizeChrome({}),
|
|
3855
|
+
pcs: sanitizePcs({}),
|
|
3851
3856
|
video: sanitizeVideo({}),
|
|
3852
3857
|
browser: sanitizeBrowser({}),
|
|
3853
3858
|
hud: sanitizeHud({}),
|
|
@@ -3932,6 +3937,7 @@ function loadConfig(dataDir = defaultDataDir()) {
|
|
|
3932
3937
|
alexa: sanitizeAlexa(stored.alexa),
|
|
3933
3938
|
music: sanitizeMusic(stored.music),
|
|
3934
3939
|
chrome: sanitizeChrome(stored.chrome),
|
|
3940
|
+
pcs: sanitizePcs(stored.pcs),
|
|
3935
3941
|
video: sanitizeVideo(stored.video),
|
|
3936
3942
|
browser: sanitizeBrowser(stored.browser),
|
|
3937
3943
|
hud: sanitizeHud(stored.hud),
|
|
@@ -7398,7 +7404,7 @@ function authorPlugin(plugins, scratchRoot, spec) {
|
|
|
7398
7404
|
}
|
|
7399
7405
|
|
|
7400
7406
|
// ../server/src/integrations.ts
|
|
7401
|
-
var INTEGRATION_IDS = ["telegram", "twilio", "zerodha", "alexa", "spotify", "soundcloud", "audius", "browser", "tavily", "chrome", "video"];
|
|
7407
|
+
var INTEGRATION_IDS = ["telegram", "twilio", "zerodha", "alexa", "spotify", "soundcloud", "audius", "browser", "tavily", "chrome", "windows-pcs", "video"];
|
|
7402
7408
|
var isIntegrationId = (id2) => typeof id2 === "string" && INTEGRATION_IDS.includes(id2);
|
|
7403
7409
|
var META = {
|
|
7404
7410
|
telegram: { name: "Telegram", description: "Talk to Friend from your phone through Telegram, and let it message people for you. Needs a free bot token from @BotFather." },
|
|
@@ -7408,6 +7414,7 @@ var META = {
|
|
|
7408
7414
|
soundcloud: { name: "SoundCloud", description: "Play and search your own SoundCloud account from Friend: ask for a track or an artist. Sign-in is through SoundCloud's own page. Needs a free app of your own at soundcloud.com/you/apps (SoundCloud decides who gets one), and some tracks only play with the right SoundCloud plan." },
|
|
7409
7415
|
audius: { name: "Audius", description: "Free music from Audius, an open music service: ask for a track or an artist. No account, no key and no payment: install it and switch it on. Mostly independent artists." },
|
|
7410
7416
|
chrome: { name: "Chrome control", description: "Lets Friend open pages, read them, click and type in your own Chrome, through an extension. It comes with Friend: nothing else to install. Every action still asks for your approval, and while it is on, Friend can act as you on the sites it allows." },
|
|
7417
|
+
"windows-pcs": { name: "Windows PCs", description: "Lets Friend use your Windows PCs like a person: see the screen, click, type, open apps, run commands and work in a terminal such as Claude Code. Add as many PCs as you want. Each one runs a small agent that you install with one line (nothing of Friend is installed on it), and you choose what it may do. Anything that cannot be undone asks you first." },
|
|
7411
7418
|
video: { name: "Web video", description: "Play videos from YouTube and almost any video site, on your Friend screen or in a window on this PC: ask for a video by name or give a link. Uses the free programs yt-dlp and ffmpeg (and mpv for a PC window), which you install once; nothing is downloaded to your disk." },
|
|
7412
7419
|
tavily: { name: "Tavily search", description: 'Better web search for Friend: news and finance searches, "this week" filters and site filters, built for assistants. Needs your own Tavily API key (tavily.com has a free monthly allowance; check their current limits). The key stays on this PC and is never shown to the AI. Without it, or when switched off, Friend keeps its free search.' },
|
|
7413
7420
|
browser: { name: "Safe browser", description: "Lets Friend open a public web page in a private Chrome of its own, to read pages that need scripts and to see how a page looks. It starts fresh each time with no cookies or logins, cannot open addresses on this PC or your network, and is deleted afterwards. It does not try to get past logins, paywalls or bot checks. Uses the Chrome or Edge already on this PC; nothing to download." },
|
|
@@ -7423,10 +7430,11 @@ var PUBLIC_SETTINGS = {
|
|
|
7423
7430
|
audius: [],
|
|
7424
7431
|
chrome: [],
|
|
7425
7432
|
video: [],
|
|
7433
|
+
"windows-pcs": [],
|
|
7426
7434
|
tavily: [],
|
|
7427
7435
|
browser: []
|
|
7428
7436
|
};
|
|
7429
|
-
function integrationViews(config, hub, brokers, alexa, spotify, soundcloud, audius, chrome, video, browser) {
|
|
7437
|
+
function integrationViews(config, hub, brokers, alexa, spotify, soundcloud, audius, chrome, video, browser, pcs) {
|
|
7430
7438
|
const status2 = hub.status();
|
|
7431
7439
|
const t = config.channels.telegram;
|
|
7432
7440
|
const w = config.channels.twilio;
|
|
@@ -7474,6 +7482,20 @@ function integrationViews(config, hub, brokers, alexa, spotify, soundcloud, audi
|
|
|
7474
7482
|
if (chs.extension === "connected") return { state: "online", detail: "Connected to your Chrome. Every action still asks for your approval." };
|
|
7475
7483
|
return { state: "online", detail: "Running. Check that the extension is switched on in Chrome (click its icon)." };
|
|
7476
7484
|
};
|
|
7485
|
+
const pc2 = config.pcs ?? { installed: false, enabled: false };
|
|
7486
|
+
const pcn = pcs?.counts() ?? { total: 0, online: 0 };
|
|
7487
|
+
const pcSteps = [
|
|
7488
|
+
{ text: "Switch the plugin on.", done: pc2.enabled },
|
|
7489
|
+
{ text: "Press Configure, then Add a PC: copy the one line it shows into PowerShell on that PC.", done: pcn.total > 0 },
|
|
7490
|
+
{ text: "Approve the PC on the page that opens there, and choose what it may do. It then stays connected by itself.", done: pcn.online > 0 }
|
|
7491
|
+
];
|
|
7492
|
+
const pcState = () => {
|
|
7493
|
+
if (!pc2.installed) return { state: "not-installed", detail: "" };
|
|
7494
|
+
if (!pc2.enabled) return { state: "off", detail: "Switched off: the assistant cannot use your PCs." };
|
|
7495
|
+
if (pcn.total === 0) return { state: "needs-setup", detail: "No PC yet. Press Configure, then Add a PC." };
|
|
7496
|
+
if (pcn.online === 0) return { state: "connecting", detail: `${pcn.total} PC${pcn.total === 1 ? "" : "s"}, none online right now.` };
|
|
7497
|
+
return { state: "online", detail: `${pcn.online} of ${pcn.total} PC${pcn.total === 1 ? "" : "s"} online. Use a PC by asking Friend; a control session starts only with your approval.` };
|
|
7498
|
+
};
|
|
7477
7499
|
const vd = config.video;
|
|
7478
7500
|
const vs = video?.status();
|
|
7479
7501
|
const vdMpvWindow = vd.output === "host" && !!vs?.mpv.found;
|
|
@@ -7629,6 +7651,7 @@ function integrationViews(config, hub, brokers, alexa, spotify, soundcloud, audi
|
|
|
7629
7651
|
{ id: "browser", ...META.browser, kind: "integration", installed: bw.installed, enabled: bw.enabled, ...bwState(), steps: bwSteps, settings: { chrome: bwFound ?? "", chromePath: bw.chromePath, timeoutSec: String(bw.timeoutSec), maxChars: String(bw.maxChars) }, secrets: {} },
|
|
7630
7652
|
{ id: "tavily", ...META.tavily, kind: "integration", installed: tv.installed, enabled: tv.enabled, ...tvState(), steps: tvSteps, settings: { depth: tv.depth, maxResults: String(tv.maxResults) }, secrets: { apiKey: tvKey } },
|
|
7631
7653
|
{ id: "chrome", ...META.chrome, kind: "integration", installed: ch.installed, enabled: ch.enabled, ...chState(), steps: chSteps, settings: chs?.extensionFolder ? { extensionFolder: chs.extensionFolder } : {}, secrets: {} },
|
|
7654
|
+
{ id: "windows-pcs", ...META["windows-pcs"], kind: "integration", installed: pc2.installed, enabled: pc2.enabled, ...pcState(), steps: pcSteps, settings: {}, secrets: {} },
|
|
7632
7655
|
{ id: "video", ...META.video, kind: "integration", installed: vd.installed, enabled: vd.enabled, ...vdState(), steps: vdSteps, settings: {}, secrets: {} }
|
|
7633
7656
|
];
|
|
7634
7657
|
}
|
|
@@ -7762,6 +7785,19 @@ function changeVideo(video, change) {
|
|
|
7762
7785
|
video.enabled = change.enabled;
|
|
7763
7786
|
return null;
|
|
7764
7787
|
}
|
|
7788
|
+
function changePcs(pcs, change) {
|
|
7789
|
+
if ("install" in change) {
|
|
7790
|
+
pcs.installed = true;
|
|
7791
|
+
return null;
|
|
7792
|
+
}
|
|
7793
|
+
if ("remove" in change) {
|
|
7794
|
+
Object.assign(pcs, { installed: false, enabled: false });
|
|
7795
|
+
return null;
|
|
7796
|
+
}
|
|
7797
|
+
if (!pcs.installed) return `${META["windows-pcs"].name} is not installed yet.`;
|
|
7798
|
+
pcs.enabled = change.enabled;
|
|
7799
|
+
return null;
|
|
7800
|
+
}
|
|
7765
7801
|
function changeChrome(chrome, change, helper) {
|
|
7766
7802
|
if ("install" in change) {
|
|
7767
7803
|
chrome.installed = true;
|
|
@@ -21796,6 +21832,7 @@ function createGateway(deps) {
|
|
|
21796
21832
|
const session = token2 ? auth.resolveSession(token2) : null;
|
|
21797
21833
|
if (!session) return reply.code(401).send({ error: "Unauthorized" });
|
|
21798
21834
|
if (!pcWindow.allow(String(session.id))) return reply.code(429).header("retry-after", 10).send({ error: "Too many requests" });
|
|
21835
|
+
if (!config.pcs.installed) return reply.code(409).send({ error: "Windows PCs is not installed. Install it in Plugins first." });
|
|
21799
21836
|
reply.header("cache-control", "no-store");
|
|
21800
21837
|
}
|
|
21801
21838
|
});
|
|
@@ -25328,6 +25365,7 @@ var PcTools = class {
|
|
|
25328
25365
|
prepare(name, args) {
|
|
25329
25366
|
const { hub, store: store2 } = this.deps;
|
|
25330
25367
|
const a = args ?? {};
|
|
25368
|
+
if (this.deps.enabled && !this.deps.enabled()) return { error: "The Windows PCs plugin is not switched on. Ask the owner to install it and switch it on in Plugins (Windows PCs)." };
|
|
25331
25369
|
if (name === "pc.list") return { pcName: "", tier: "T1", run: async () => ({ text: this.list(), isError: false }) };
|
|
25332
25370
|
const which = hub.resolve(typeof a.pc === "string" ? a.pc : void 0);
|
|
25333
25371
|
if ("ask" in which) return { error: which.ask };
|
|
@@ -26083,7 +26121,7 @@ function currentSelf() {
|
|
|
26083
26121
|
// ../server/src/system/npm.ts
|
|
26084
26122
|
import { spawn as spawn10 } from "node:child_process";
|
|
26085
26123
|
var PACKAGE = "friend-assistant";
|
|
26086
|
-
var runningVersion = () => true ? "0.1.
|
|
26124
|
+
var runningVersion = () => true ? "0.1.98" : "development";
|
|
26087
26125
|
async function npmLatest(fetchFn = fetch, timeoutMs = 1e4) {
|
|
26088
26126
|
try {
|
|
26089
26127
|
const res = await fetchFn(`https://registry.npmjs.org/${PACKAGE}/latest`, { headers: { accept: "application/json" }, signal: AbortSignal.timeout(timeoutMs) });
|
|
@@ -27230,6 +27268,20 @@ async function createApp(opts) {
|
|
|
27230
27268
|
saveConfig(saved);
|
|
27231
27269
|
return null;
|
|
27232
27270
|
};
|
|
27271
|
+
const pcCounts = {
|
|
27272
|
+
counts: () => {
|
|
27273
|
+
const all = pcService.store.list().filter((p) => !p.revoked);
|
|
27274
|
+
return { total: all.length, online: all.filter((p) => pcHub.isOnline(p.id)).length };
|
|
27275
|
+
}
|
|
27276
|
+
};
|
|
27277
|
+
const changePcsConfig = (fn) => {
|
|
27278
|
+
const saved = loadConfig(opts.dataDir);
|
|
27279
|
+
const err = fn(saved.pcs);
|
|
27280
|
+
if (err) return err;
|
|
27281
|
+
fn(config.pcs);
|
|
27282
|
+
saveConfig(saved);
|
|
27283
|
+
return null;
|
|
27284
|
+
};
|
|
27233
27285
|
const changeChromeConfig = (fn) => {
|
|
27234
27286
|
const saved = loadConfig(opts.dataDir);
|
|
27235
27287
|
const err = fn(saved.chrome);
|
|
@@ -27259,6 +27311,7 @@ async function createApp(opts) {
|
|
|
27259
27311
|
if (!err2 && "remove" in change) plugins.remove(TAVILY_SKILL);
|
|
27260
27312
|
return err2;
|
|
27261
27313
|
}
|
|
27314
|
+
if (id2 === "windows-pcs") return changePcsConfig((p) => changePcs(p, change));
|
|
27262
27315
|
if (id2 === "video") {
|
|
27263
27316
|
const err2 = changeVideoConfig((v) => changeVideo(v, change));
|
|
27264
27317
|
if (!err2 && ("install" in change || "enabled" in change && change.enabled)) void videoHub.prepare().catch(() => {
|
|
@@ -27315,12 +27368,12 @@ async function createApp(opts) {
|
|
|
27315
27368
|
}
|
|
27316
27369
|
},
|
|
27317
27370
|
integrations: {
|
|
27318
|
-
views: () => integrationViews(config, channelHub, brokerHub, alexaHub, spotifyHub, scView, audiusHub, chromePlugin, videoHub, browserHub),
|
|
27371
|
+
views: () => integrationViews(config, channelHub, brokerHub, alexaHub, spotifyHub, scView, audiusHub, chromePlugin, videoHub, browserHub, pcCounts),
|
|
27319
27372
|
install: (id2) => changeAny(id2, { install: true }),
|
|
27320
27373
|
remove: (id2) => changeAny(id2, { remove: true }),
|
|
27321
27374
|
configure: (id2, { enabled, settings }) => {
|
|
27322
|
-
if (!(id2 === "zerodha" ? config.brokers.zerodha : id2 === "alexa" ? config.alexa : id2 === "spotify" ? config.music.spotify : id2 === "soundcloud" ? config.music.soundcloud : id2 === "audius" ? config.music.audius : id2 === "chrome" ? config.chrome : id2 === "video" ? config.video : id2 === "tavily" ? config.web.tavily : id2 === "browser" ? config.browser : config.channels[id2]).installed) return `${id2} is not installed yet. Install it first with plugins.install.`;
|
|
27323
|
-
if (id2 !== "zerodha" && id2 !== "alexa" && id2 !== "spotify" && id2 !== "soundcloud" && id2 !== "audius" && id2 !== "chrome" && id2 !== "video" && id2 !== "tavily" && id2 !== "browser" && Object.keys(settings).length) {
|
|
27375
|
+
if (!(id2 === "zerodha" ? config.brokers.zerodha : id2 === "alexa" ? config.alexa : id2 === "spotify" ? config.music.spotify : id2 === "soundcloud" ? config.music.soundcloud : id2 === "audius" ? config.music.audius : id2 === "chrome" ? config.chrome : id2 === "windows-pcs" ? config.pcs : id2 === "video" ? config.video : id2 === "tavily" ? config.web.tavily : id2 === "browser" ? config.browser : config.channels[id2]).installed) return `${id2} is not installed yet. Install it first with plugins.install.`;
|
|
27376
|
+
if (id2 !== "zerodha" && id2 !== "alexa" && id2 !== "spotify" && id2 !== "soundcloud" && id2 !== "audius" && id2 !== "chrome" && id2 !== "windows-pcs" && id2 !== "video" && id2 !== "tavily" && id2 !== "browser" && Object.keys(settings).length) {
|
|
27324
27377
|
try {
|
|
27325
27378
|
commitSettings({ channels: { [id2]: settings } }, { actor: "agent" });
|
|
27326
27379
|
} catch (e) {
|
|
@@ -27606,7 +27659,7 @@ First check the work: read the whole report (office.report) and, when it changed
|
|
|
27606
27659
|
if (b && hello.agentSha256 && hello.agentSha256 !== b.sha256) pcHub.send(pcId, { type: "update", url: "/api/pc/agent.js", sha256: b.sha256 });
|
|
27607
27660
|
}
|
|
27608
27661
|
});
|
|
27609
|
-
const pcTools = new PcTools({ hub: pcHub, store: pcService.store, audit, extraPatterns: () => [] });
|
|
27662
|
+
const pcTools = new PcTools({ hub: pcHub, store: pcService.store, audit, extraPatterns: () => [], enabled: () => config.pcs.installed && config.pcs.enabled });
|
|
27610
27663
|
const deckStore = new DeckStore(db);
|
|
27611
27664
|
const presenter = new Presenter({
|
|
27612
27665
|
speak: (text5) => speaker ? speaker.say(text5, (m) => broadcast(m)) : Promise.resolve(),
|
|
@@ -27717,7 +27770,7 @@ First check the work: read the whole report (office.report) and, when it changed
|
|
|
27717
27770
|
video: videoHub,
|
|
27718
27771
|
office,
|
|
27719
27772
|
attachments: { read: (id2, part) => readAttachment(attachments, id2, part) },
|
|
27720
|
-
integrations: { summary: () => integrationSummary(integrationViews(config, channelHub, brokerHub, alexaHub, spotifyHub, scView, audiusHub, chromePlugin, videoHub, browserHub)) }
|
|
27773
|
+
integrations: { summary: () => integrationSummary(integrationViews(config, channelHub, brokerHub, alexaHub, spotifyHub, scView, audiusHub, chromePlugin, videoHub, browserHub, pcCounts)) }
|
|
27721
27774
|
});
|
|
27722
27775
|
const clients = /* @__PURE__ */ new Set();
|
|
27723
27776
|
const broadcast = (m) => {
|
|
@@ -27968,7 +28021,7 @@ ${task.title}`) !== null,
|
|
|
27968
28021
|
void chromePlugin.refresh();
|
|
27969
28022
|
const installed = plugins.list();
|
|
27970
28023
|
const have = new Set(installed.map((p) => p.id));
|
|
27971
|
-
return { installed, catalog: listCatalog(catalogDir).map((c) => ({ ...c, installed: have.has(c.id) })), integrations: integrationViews(config, channelHub, brokerHub, alexaHub, spotifyHub, scView, audiusHub, chromePlugin, videoHub, browserHub) };
|
|
28024
|
+
return { installed, catalog: listCatalog(catalogDir).map((c) => ({ ...c, installed: have.has(c.id) })), integrations: integrationViews(config, channelHub, brokerHub, alexaHub, spotifyHub, scView, audiusHub, chromePlugin, videoHub, browserHub, pcCounts) };
|
|
27972
28025
|
},
|
|
27973
28026
|
install: async (id2, pin, ip) => {
|
|
27974
28027
|
if (isIntegrationId(id2)) {
|
|
@@ -31865,7 +31918,7 @@ import { appendFileSync } from "node:fs";
|
|
|
31865
31918
|
import { join as join42 } from "node:path";
|
|
31866
31919
|
var PACKAGE2 = "friend-assistant";
|
|
31867
31920
|
var real2 = {
|
|
31868
|
-
current: () => true ? "0.1.
|
|
31921
|
+
current: () => true ? "0.1.98" : "development",
|
|
31869
31922
|
latest: () => new Promise((resolve13) => {
|
|
31870
31923
|
const child = crossSpawn5("npm", ["view", PACKAGE2, "version", "--prefer-online"], { stdio: ["ignore", "pipe", "ignore"] });
|
|
31871
31924
|
let out = "";
|
|
@@ -32183,7 +32236,7 @@ async function run(argv, io2) {
|
|
|
32183
32236
|
case "version":
|
|
32184
32237
|
case "--version":
|
|
32185
32238
|
case "-v":
|
|
32186
|
-
io2.out(true ? "0.1.
|
|
32239
|
+
io2.out(true ? "0.1.98" : "development");
|
|
32187
32240
|
return 0;
|
|
32188
32241
|
case "lan":
|
|
32189
32242
|
return await lanCommand(rest, io2);
|
package/dist/pc-agent/agent.js
CHANGED
|
@@ -30830,7 +30830,7 @@ function toTask(r) {
|
|
|
30830
30830
|
}
|
|
30831
30831
|
|
|
30832
30832
|
// ../pc-agent/src/main.ts
|
|
30833
|
-
var VERSION = "0.1.
|
|
30833
|
+
var VERSION = "0.1.98";
|
|
30834
30834
|
var TASK = "Friend PC Agent";
|
|
30835
30835
|
function parse3(argv) {
|
|
30836
30836
|
const out = {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
5d776a596678966bb40e66664212f7825751b26fe6d921f254e450e7b617cda5
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,s as t,t as n,u as r}from"./index-
|
|
1
|
+
import{a as e,s as t,t as n,u as r}from"./index-BWBKqeo4.js";import{a as i,n as a,r as o,t as s}from"./jarvis-ui-BIfOaoqG.js";var c=r(t(),1),l=350,u=174,d=.25,f=2.5,p=96;function m(e){let t=n(e),r=e=>Math.round(e.y/134),i=e=>({x:r(e)===0?0:260+(r(e)-1)*l,y:Math.round(e.x/216*u)}),a=t.nodes.map(e=>({id:e.id,worker:e.worker,w:e.worker?240:150,...i(e)})),o=new Map(a.map(e=>[e.id,e])),s=t.edges.map(e=>{let t=o.get(e.from),n=o.get(e.to);return{from:e.from,to:e.to,x1:t.x+t.w,y1:t.y+70,x2:n.x,y2:n.y+70}}),c=Math.min(...a.map(e=>e.y));for(let e of a)e.y-=c;for(let e of s)e.y1-=c,e.y2-=c;return{nodes:a,edges:s,width:Math.max(...a.map(e=>e.x+e.w)),height:Math.max(...a.map(e=>e.y))+140}}var h=e=>Math.min(f,Math.max(d,e));function g(e,t){let n=h(Math.min((t.width-56)/e.width,(t.height-56)/e.height,1.25));return{k:n,x:(t.width-e.width*n)/2,y:(t.height-e.height*n)/2}}function _(e,t,n){let r=h(e.k*n),i=r/e.k;return{k:r,x:t.x-(t.x-e.x)*i,y:t.y-(t.y-e.y)*i}}function v(e,t,n){let r=t.width*e.k,i=t.height*e.k,a=Math.min(p,r),o=Math.min(p,i);return{k:e.k,x:Math.min(n.width-a,Math.max(a-r,e.x)),y:Math.min(n.height-o,Math.max(o-i,e.y))}}var y=e(),b={starting:`green`,running:`green`,waiting:`amber`,idle:`cyan`,paused:`ghost`,stopped:`ghost`,failed:`red`},x={starting:`active`,running:`active`,waiting:`warning`,idle:`success`,paused:`warning`,stopped:`warning`,failed:`error`},S={starting:`running`,running:`running`,waiting:`waiting`,idle:`idle`,paused:`idle`,stopped:`idle`,failed:`failed`},C=e=>e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e),w=1.25;function T({workers:e,name:t,onWorker:n}){let r=(0,c.useRef)(null),l=(0,c.useMemo)(()=>m(e),[e]),u=(0,c.useMemo)(()=>({width:l.width,height:l.height}),[l.width,l.height]),[d,f]=(0,c.useState)({width:640,height:420}),[p,h]=(0,c.useState)(()=>g(u,d)),T=(0,c.useRef)(!1),E=(0,c.useRef)(!1),D=(0,c.useRef)(null),O=new Map(e.map(e=>[e.id,e.status])),k=(0,c.useCallback)(e=>h(v(e,u,d)),[u,d]),A=(0,c.useCallback)(()=>{T.current=!1,h(g(u,d))},[u,d]);(0,c.useEffect)(()=>{let e=r.current;if(!e)return;let t=()=>{let t=e.getBoundingClientRect();t.width>40&&t.height>40&&f({width:Math.floor(t.width),height:Math.floor(t.height)})};if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]),(0,c.useEffect)(()=>{T.current||h(g(u,d))},[u,d]),(0,c.useEffect)(()=>{let e=r.current;if(!e)return;let t=t=>{t.preventDefault();let n=e.getBoundingClientRect();T.current=!0,h(e=>v(_(e,{x:t.clientX-n.left,y:t.clientY-n.top},Math.exp(-t.deltaY*.0015)),u,d))};return e.addEventListener(`wheel`,t,{passive:!1}),()=>e.removeEventListener(`wheel`,t)},[u,d]);let j={x:d.width/2,y:d.height/2},M=e=>{T.current=!0,k(_(p,j,e))};return(0,y.jsxs)(`div`,{className:`ob-canvas-room`,ref:r,children:[(0,y.jsx)(`div`,{className:`ob-canvas-pan`,onPointerDown:e=>{e.button===0&&(E.current=!1,D.current={x:e.clientX,y:e.clientY,vx:p.x,vy:p.y,id:e.pointerId,far:!1})},onPointerMove:e=>{let t=D.current;if(!t)return;let n=e.clientX-t.x,r=e.clientY-t.y;!t.far&&Math.hypot(n,r)<5||(t.far||e.currentTarget.setPointerCapture?.(t.id),t.far=!0,E.current=!0,T.current=!0,k({k:p.k,x:t.vx+n,y:t.vy+r}))},onPointerUp:e=>{D.current=null,e.currentTarget.releasePointerCapture?.(e.pointerId)},onPointerCancel:()=>D.current=null,children:(0,y.jsxs)(`div`,{className:`ob-canvas-world`,style:{width:l.width,height:l.height,transform:`translate(${p.x}px, ${p.y}px) scale(${p.k})`},children:[(0,y.jsxs)(`svg`,{className:`ob-canvas-edges`,width:l.width,height:l.height,"aria-hidden":`true`,children:[(0,y.jsx)(`defs`,{children:(0,y.jsx)(`marker`,{id:`ob-arrow`,viewBox:`0 0 10 10`,refX:`9`,refY:`5`,markerWidth:`7`,markerHeight:`7`,orient:`auto-start-reverse`,children:(0,y.jsx)(`path`,{d:`M0 0L10 5L0 10z`,className:`ob-arrow`})})}),l.edges.map(e=>{let t=O.get(e.to),n=(e.x1+e.x2)/2;return(0,y.jsx)(`path`,{d:`M${e.x1} ${e.y1}C${n} ${e.y1} ${n} ${e.y2} ${e.x2} ${e.y2}`,markerEnd:`url(#ob-arrow)`,"data-flow":t===`running`||t===`starting`?`on`:t===`waiting`?`wait`:`off`},`${e.from}>${e.to}`)})]}),l.nodes.map(e=>{let r=e.worker;if(!r)return(0,y.jsxs)(`div`,{className:`ob-cnode ob-cnode-root`,"data-node":`friend`,style:{left:e.x,top:e.y,width:e.w,height:140},children:[(0,y.jsx)(a,{size:92,color:`cyan`,label:t.toUpperCase(),animated:!0}),(0,y.jsx)(`small`,{children:`the assistant`})]},e.id);let c=r.budget&&r.budget>0?Math.min(100,100*r.tokens/r.budget):void 0;return(0,y.jsx)(`div`,{className:`ob-cnode`,role:`button`,tabIndex:0,"data-node":e.id,"data-status":S[r.status],"aria-label":`${r.name}, ${r.title}, ${r.detail||r.status}`,style:{left:e.x,top:e.y,width:240,height:140},onClick:()=>{E.current?E.current=!1:n(e.id)},onKeyDown:t=>(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),n(e.id)),children:(0,y.jsxs)(s,{cardStyle:`SideRail`,color:b[r.status],padding:`8px 12px`,header:(0,y.jsxs)(`div`,{className:`ob-cnode-head`,children:[(0,y.jsx)(`b`,{children:r.name}),(0,y.jsx)(i,{state:x[r.status],children:r.status.toUpperCase()})]}),children:[(0,y.jsx)(o,{label:`JOB`,value:r.title}),(0,y.jsx)(o,{label:`DOING`,value:r.detail||r.status}),(0,y.jsx)(o,{label:`TOKENS`,value:C(r.tokens),...c===void 0?{}:{barPercent:c}})]})},e.id)})]})}),(0,y.jsxs)(`div`,{className:`ob-canvas-tools`,role:`toolbar`,"aria-label":`View of the team`,children:[(0,y.jsx)(`button`,{type:`button`,"aria-label":`Zoom in`,onClick:()=>M(w),children:`+`}),(0,y.jsx)(`button`,{type:`button`,"aria-label":`Zoom out`,onClick:()=>M(1/w),children:`−`}),(0,y.jsx)(`button`,{type:`button`,"aria-label":`Fit the team`,onClick:A,children:`⤢`}),(0,y.jsxs)(`span`,{"aria-hidden":`true`,children:[Math.round(p.k*100),`%`]})]})]})}export{T as OrgCanvas};
|