friend-assistant 0.1.95 → 0.1.96
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/BUILD.json +2 -2
- package/dist/friend.mjs +46 -6
- package/dist/web/assets/{OrgParts-DtYhfju9.js → OrgParts-M4k6YgtY.js} +1 -1
- package/dist/web/assets/{index-DRRCYTxW.js → index--BXChc_f.js} +4 -4
- package/dist/web/assets/index-sMhjXvp0.css +1 -0
- package/dist/web/assets/{jarvis-ui-ChlNDG8W.js → jarvis-ui-s9IxC22B.js} +1 -1
- package/dist/web/assets/{jarvisTree-CUR60kDk.js → jarvisTree-BnMgB9kt.js} +1 -1
- package/dist/web/assets/{ort.bundle.min-BzdZM8HK.js → ort.bundle.min-mqHQ71jw.js} +1 -1
- package/dist/web/index.html +2 -2
- package/package.json +1 -1
- package/dist/web/assets/index-CPN-1vDA.css +0 -1
package/dist/BUILD.json
CHANGED
package/dist/friend.mjs
CHANGED
|
@@ -1528,7 +1528,7 @@ var TOOL_DEFS = [
|
|
|
1528
1528
|
},
|
|
1529
1529
|
{
|
|
1530
1530
|
name: "deck.create",
|
|
1531
|
-
description: "Write a presentation and save it. Give a title and the slides. Each slide: title, layout (title | bullets | visual | two-column | quote | end), optional notes for the owner, and items that appear one by one. Each item: kind (text with content {text, style?: heading|bullet|quote}, or any stage object type such as chart, table, stat, graph, timeline, code, or a Jarvis component, with its props as content), say (what you say aloud while it appears: short spoken sentences that explain, not read the text out), animation (fade | slide-left | slide-up | grow | type | draw | none), optional hold seconds. One idea per slide. A bullets slide fits at most 5 items, a visual slide 1, a two-column slide 8: split bigger slides. At most 40 slides. Make the deck complete, then offer to present it (deck.present).",
|
|
1531
|
+
description: "Write a presentation and save it. Give a title and the slides. Each slide: title, layout (title | bullets | visual | two-column | quote | end), optional notes for the owner, and items that appear one by one. Each item: kind (text with content {text, style?: heading|bullet|quote}, or any stage object type such as chart, table, stat, graph, timeline, code, or a Jarvis component, with its props as content), say (what you say aloud while it appears: short spoken sentences that explain, not read the text out), animation (fade | slide-left | slide-up | grow | type | draw | none), optional hold seconds. One idea per slide. A bullets slide fits at most 5 items, a visual slide 1, a two-column slide 8: split bigger slides. At most 40 slides. Make it rich, not basic: 10 to 15 slides, different layouts, a chart, table, graph, timeline, code or Jarvis component on most content slides instead of only bullets, real facts and examples, and 2 to 4 explaining sentences in every say line (call stage.guide with topic presentations for the full advice). Make the deck complete, then offer to present it (deck.present).",
|
|
1532
1532
|
input: z6.object({ title: z6.string().min(1).max(DECK_LIMITS.title), topic: z6.string().max(200).optional(), slides: z6.array(DeckSlideInput).min(1).max(DECK_LIMITS.slides) }),
|
|
1533
1533
|
baseTier: "T1",
|
|
1534
1534
|
target: "gateway"
|
|
@@ -4985,6 +4985,7 @@ var PRESENTATIONS = `PRESENTATIONS (deck.create, deck.present, deck.control; the
|
|
|
4985
4985
|
1. Write the whole deck first with deck.create, then offer to present it (or present it at once if the owner asked to). Say what you made in a sentence: the title and how many slides.
|
|
4986
4986
|
2. One idea per slide. A slide has a title, a layout (title, bullets, visual, two-column, quote, end) and items that appear one by one. A bullets slide fits at most 5 items, a visual slide 1, a two-column slide 8: split anything bigger into two slides. At most 40 slides; around 8 to 12 is a good talk. Start with a title slide and end with an end slide.
|
|
4987
4987
|
3. Each item has "say": what you say aloud while it appears. Speak like a teacher: short sentences that explain and give an example, never read the bullet word for word, no symbols or markup. Up to 400 characters. The slide text is short; the explanation is in "say".
|
|
4988
|
+
3b. MAKE IT RICH, NOT BASIC. A talk of 10 to 15 slides, not a list of bullets: open with a title slide that states the promise; then for each idea use a different shape. Most content slides must have a real picture or structure next to or instead of the bullets: a process as a timeline or a graph (nodes and edges), numbers as a chart or a stat, a comparison as a table, an example as a code item or a card, a key figure as a JStatCard. Never more than two slides in a row that are only bullets. Use a quote slide for a key rule, a "common mistakes" slide, a worked example slide, a summary slide and an end slide with the next step. Give real facts, names and numbers, not generalities. Each item's "say" is 2 to 4 sentences: explain the why, give an example, link to the previous slide ("so after recon, the next step is...").
|
|
4988
4989
|
4. Items: kind "text" with content {text, style: heading | bullet | quote}, or a real picture: chart, table, stat, graph, timeline, code, a Jarvis component (JTable columns can be plain names and rows plain lists), or sandbox for an animation of your own. Prefer a picture to a long list when it shows the idea better.
|
|
4989
4990
|
5. animation per item: fade, slide-left, slide-up, grow, type (text typed out), draw (a chart draws in), none. Vary them a little; headings slide or type, charts draw, numbers grow.
|
|
4990
4991
|
6. While it runs the owner may talk. It pauses, you get a note "A presentation ... is paused at slide N, item M". Answer the question (keep it short), then call deck.control {action:"resume"} to go on (it repeats the item that was interrupted), or ask "shall I continue?". If the owner stays silent it goes on by itself. Do not present a slide's content again in your answer.
|
|
@@ -24753,7 +24754,7 @@ function currentSelf() {
|
|
|
24753
24754
|
// ../server/src/system/npm.ts
|
|
24754
24755
|
import { spawn as spawn10 } from "node:child_process";
|
|
24755
24756
|
var PACKAGE = "friend-assistant";
|
|
24756
|
-
var runningVersion = () => true ? "0.1.
|
|
24757
|
+
var runningVersion = () => true ? "0.1.96" : "development";
|
|
24757
24758
|
async function npmLatest(fetchFn = fetch, timeoutMs = 1e4) {
|
|
24758
24759
|
try {
|
|
24759
24760
|
const res = await fetchFn(`https://registry.npmjs.org/${PACKAGE}/latest`, { headers: { accept: "application/json" }, signal: AbortSignal.timeout(timeoutMs) });
|
|
@@ -25377,6 +25378,24 @@ function chunkBase64(buf, maxChars = MAX_CHUNK_CHARS) {
|
|
|
25377
25378
|
for (let i = 0; i < buf.length; i += bytes2) out.push(buf.subarray(i, i + bytes2).toString("base64"));
|
|
25378
25379
|
return out;
|
|
25379
25380
|
}
|
|
25381
|
+
function wavMs(wav) {
|
|
25382
|
+
if (wav.length < 44 || wav.toString("ascii", 0, 4) !== "RIFF" || wav.toString("ascii", 8, 12) !== "WAVE") return null;
|
|
25383
|
+
let off = 12;
|
|
25384
|
+
let bytesPerSecond = 0;
|
|
25385
|
+
while (off + 8 <= wav.length) {
|
|
25386
|
+
const id2 = wav.toString("ascii", off, off + 4);
|
|
25387
|
+
const size = wav.readUInt32LE(off + 4);
|
|
25388
|
+
if (id2 === "fmt " && off + 20 <= wav.length) bytesPerSecond = wav.readUInt32LE(off + 16);
|
|
25389
|
+
if (id2 === "data") {
|
|
25390
|
+
const length = Math.min(size, wav.length - off - 8);
|
|
25391
|
+
return bytesPerSecond > 0 ? length / bytesPerSecond * 1e3 : null;
|
|
25392
|
+
}
|
|
25393
|
+
off += 8 + size + size % 2;
|
|
25394
|
+
}
|
|
25395
|
+
return null;
|
|
25396
|
+
}
|
|
25397
|
+
var guessMs = (text5) => Math.max(600, text5.trim().split(/\s+/).length * 380);
|
|
25398
|
+
var GAP_MS = 350;
|
|
25380
25399
|
var fenceCount = (text5) => (text5.match(/```/g) ?? []).length;
|
|
25381
25400
|
function lastBoundary(text5) {
|
|
25382
25401
|
for (let i = text5.length - 2; i >= 0; i--) {
|
|
@@ -25401,12 +25420,19 @@ var Speaker = class {
|
|
|
25401
25420
|
languages;
|
|
25402
25421
|
job = 0;
|
|
25403
25422
|
active = false;
|
|
25404
|
-
/** Says a whole text, sentence by sentence. */
|
|
25423
|
+
/** Says a whole text, sentence by sentence. Resolves when the last clip has been sent (it may still be playing). */
|
|
25405
25424
|
async speak(text5, emit) {
|
|
25406
25425
|
const s = this.stream(emit);
|
|
25407
25426
|
s.push(text5);
|
|
25408
25427
|
await s.end();
|
|
25409
25428
|
}
|
|
25429
|
+
/** Says a text and resolves when it has been heard, not only sent: for a presentation, which goes on to the next item only then. */
|
|
25430
|
+
async say(text5, emit) {
|
|
25431
|
+
const s = this.stream(emit);
|
|
25432
|
+
s.push(text5);
|
|
25433
|
+
await s.end();
|
|
25434
|
+
await s.playedOut(text5);
|
|
25435
|
+
}
|
|
25410
25436
|
/**
|
|
25411
25437
|
* Speaks a reply while it is still being written: every sentence is synthesized and sent as soon as it is
|
|
25412
25438
|
* finished, in order, so the voice keeps up with the captions instead of starting after them.
|
|
@@ -25421,6 +25447,9 @@ var Speaker = class {
|
|
|
25421
25447
|
let ended = false;
|
|
25422
25448
|
let wake = null;
|
|
25423
25449
|
let clip12 = 0;
|
|
25450
|
+
let firstAt = 0;
|
|
25451
|
+
let soundMs = 0;
|
|
25452
|
+
const begun = Date.now();
|
|
25424
25453
|
const poke = () => {
|
|
25425
25454
|
const w = wake;
|
|
25426
25455
|
wake = null;
|
|
@@ -25454,6 +25483,8 @@ var Speaker = class {
|
|
|
25454
25483
|
const chunks = chunkBase64(wav);
|
|
25455
25484
|
const id2 = `${job}-${clip12++}`;
|
|
25456
25485
|
chunks.forEach((data2, seq) => emit({ type: "audio.chunk", id: id2, seq, last: seq === chunks.length - 1, mime: "audio/wav", data: data2 }));
|
|
25486
|
+
if (firstAt === 0) firstAt = Date.now();
|
|
25487
|
+
soundMs += wavMs(wav) ?? guessMs(part.text);
|
|
25457
25488
|
}
|
|
25458
25489
|
}
|
|
25459
25490
|
})().finally(() => {
|
|
@@ -25480,6 +25511,14 @@ var Speaker = class {
|
|
|
25480
25511
|
if (alive()) take(true);
|
|
25481
25512
|
poke();
|
|
25482
25513
|
return worker;
|
|
25514
|
+
},
|
|
25515
|
+
playedOut: async (fallbackText) => {
|
|
25516
|
+
while (alive()) {
|
|
25517
|
+
const until = firstAt > 0 ? firstAt + soundMs + GAP_MS : begun + (fallbackText ? guessMs(speechText(fallbackText)) : 0);
|
|
25518
|
+
const left = until - Date.now();
|
|
25519
|
+
if (left <= 0) return;
|
|
25520
|
+
await new Promise((r) => setTimeout(r, Math.min(left, 200)));
|
|
25521
|
+
}
|
|
25483
25522
|
}
|
|
25484
25523
|
};
|
|
25485
25524
|
}
|
|
@@ -26229,7 +26268,8 @@ First check the work: read the whole report (office.report) and, when it changed
|
|
|
26229
26268
|
tidyAtStart.unref();
|
|
26230
26269
|
const deckStore = new DeckStore(db);
|
|
26231
26270
|
const presenter = new Presenter({
|
|
26232
|
-
speak: (text5) => speaker ? speaker.
|
|
26271
|
+
speak: (text5) => speaker ? speaker.say(text5, (m) => broadcast(m)) : Promise.resolve(),
|
|
26272
|
+
// ends when it has been heard, so the next item comes at the right time
|
|
26233
26273
|
interrupt: () => speaker?.interrupt((m) => broadcast(m)),
|
|
26234
26274
|
emit: (m) => broadcast(m),
|
|
26235
26275
|
setTimer: (fn, ms2) => {
|
|
@@ -30476,7 +30516,7 @@ import { appendFileSync } from "node:fs";
|
|
|
30476
30516
|
import { join as join42 } from "node:path";
|
|
30477
30517
|
var PACKAGE2 = "friend-assistant";
|
|
30478
30518
|
var real2 = {
|
|
30479
|
-
current: () => true ? "0.1.
|
|
30519
|
+
current: () => true ? "0.1.96" : "development",
|
|
30480
30520
|
latest: () => new Promise((resolve13) => {
|
|
30481
30521
|
const child = crossSpawn5("npm", ["view", PACKAGE2, "version", "--prefer-online"], { stdio: ["ignore", "pipe", "ignore"] });
|
|
30482
30522
|
let out = "";
|
|
@@ -30794,7 +30834,7 @@ async function run(argv, io2) {
|
|
|
30794
30834
|
case "version":
|
|
30795
30835
|
case "--version":
|
|
30796
30836
|
case "-v":
|
|
30797
|
-
io2.out(true ? "0.1.
|
|
30837
|
+
io2.out(true ? "0.1.96" : "development");
|
|
30798
30838
|
return 0;
|
|
30799
30839
|
case "lan":
|
|
30800
30840
|
return await lanCommand(rest, io2);
|
|
@@ -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--BXChc_f.js";import{a as i,n as a,r as o,t as s}from"./jarvis-ui-s9IxC22B.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};
|