allyhub 0.2.0-next.4 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/cloud-tools.js +9 -10
- package/dist/commands/mcp.js +1 -1
- package/dist/commands/orgs.js +2 -2
- package/dist/commands/voice.js +2 -2
- package/dist/main.js +4 -4
- package/editor-app/view.html +4 -4
- package/editor-web/assets/chevron-left-D1vfOP5S.js +1 -0
- package/editor-web/assets/{chevron-up-B2IfPYC4.js → chevron-up-BMNXDEBs.js} +1 -1
- package/editor-web/assets/{dist-VsUk3S-a.js → dist-B4VKfY-H.js} +1 -1
- package/editor-web/assets/{dist-CuyNR3bn.js → dist-BIEloJVS.js} +1 -1
- package/editor-web/assets/{dist-DCgVauDD.js → dist-BcInw4os.js} +1 -1
- package/editor-web/assets/{dist-ChU-0IAY.js → dist-Coblfc3T.js} +1 -1
- package/editor-web/assets/{floating-ui.react-dom-C6Aeuo3L.js → floating-ui.react-dom-DSyn5TRd.js} +1 -1
- package/editor-web/assets/index-BSFR4plz.css +2 -0
- package/editor-web/assets/{index-BoYpZLq7.js → index-Dc8FX_sp.js} +3 -3
- package/editor-web/assets/{react-CSPssXRH.js → react-Bo429Bov.js} +3 -3
- package/editor-web/assets/{undo-2-D6qCS-P0.js → undo-2-CWgOKQ3L.js} +1 -1
- package/editor-web/index.html +4 -4
- package/node_modules/@allyhub-next/audio/package.json +1 -1
- package/node_modules/@allyhub-next/browser/package.json +1 -1
- package/node_modules/@allyhub-next/build/package.json +1 -1
- package/node_modules/@allyhub-next/check/package.json +1 -1
- package/node_modules/@allyhub-next/cloud/dist/call.js +2 -2
- package/node_modules/@allyhub-next/cloud/dist/index.js +1 -1
- package/node_modules/@allyhub-next/cloud/dist/signin.js +2 -2
- package/node_modules/@allyhub-next/cloud/dist/voice.js +1 -1
- package/node_modules/@allyhub-next/cloud/package.json +1 -1
- package/node_modules/@allyhub-next/components/package.json +1 -1
- package/node_modules/@allyhub-next/components/r/callout.json +5 -1
- package/node_modules/@allyhub-next/components/r/caption-line.json +5 -1
- package/node_modules/@allyhub-next/components/r/caption-subtitle.json +5 -1
- package/node_modules/@allyhub-next/components/r/caption-word.json +5 -1
- package/node_modules/@allyhub-next/components/r/chart.json +5 -1
- package/node_modules/@allyhub-next/components/r/code-panel.json +5 -1
- package/node_modules/@allyhub-next/components/r/screen-demo.json +5 -1
- package/node_modules/@allyhub-next/dev-server/package.json +1 -1
- package/node_modules/@allyhub-next/doc/package.json +1 -1
- package/node_modules/@allyhub-next/export/package.json +1 -1
- package/node_modules/@allyhub-next/formats/package.json +1 -1
- package/node_modules/@allyhub-next/measure/package.json +1 -1
- package/node_modules/@allyhub-next/media/package.json +1 -1
- package/node_modules/@allyhub-next/model/package.json +1 -1
- package/node_modules/@allyhub-next/project/package.json +1 -1
- package/node_modules/@allyhub-next/protocol/dist/cloud.d.ts +23 -168
- package/node_modules/@allyhub-next/protocol/dist/cloud.js +1 -1
- package/node_modules/@allyhub-next/protocol/dist/index.d.ts +1 -0
- package/node_modules/@allyhub-next/protocol/dist/index.js +1 -1
- package/node_modules/@allyhub-next/protocol/dist/registry.d.ts +2 -0
- package/node_modules/@allyhub-next/protocol/dist/routes.d.ts +14 -0
- package/node_modules/@allyhub-next/protocol/dist/routes.js +2 -0
- package/node_modules/@allyhub-next/protocol/dist/teams.d.ts +1 -7
- package/node_modules/@allyhub-next/protocol/dist/teams.js +1 -1
- package/node_modules/@allyhub-next/protocol/package.json +1 -1
- package/node_modules/@allyhub-next/registry/package.json +1 -1
- package/node_modules/@allyhub-next/render/package.json +1 -1
- package/node_modules/@allyhub-next/runtime/package.json +1 -1
- package/node_modules/@allyhub-next/runtimes/package.json +1 -1
- package/node_modules/@allyhub-next/scaffold/package.json +1 -1
- package/node_modules/@allyhub-next/scenery/package.json +1 -1
- package/node_modules/@allyhub-next/scenery-host/package.json +1 -1
- package/node_modules/@allyhub-next/sheet/package.json +1 -1
- package/node_modules/@allyhub-next/site/package.json +1 -1
- package/node_modules/@allyhub-next/stage/package.json +1 -1
- package/node_modules/@allyhub-next/video-core/package.json +1 -1
- package/package.json +28 -28
- package/dist/charge.js +0 -2
- package/editor-web/assets/chevron-left-B1KTa28S.js +0 -1
- package/editor-web/assets/index-DRbemuuR.css +0 -2
- package/node_modules/@allyhub-next/cloud/dist/price.js +0 -2
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{readFile as
|
|
3
|
-
`)}}))}
|
|
4
|
-
`);if(
|
|
5
|
-
`);const
|
|
6
|
-
`),...
|
|
7
|
-
`)}const
|
|
8
|
-
`)}}const N=Q(n,m);if(N.length>0)throw k(`${e.name} needs ${N.join(", ")}.`,`allyhub help ${t} shows its options.`);const x=l.approve,T=await B(v,e.name,m,{...q,...x===void 0?{}:{approve:()=>{const c=F(e.price,e.input,[m]).calls[0];return c===void 0?Promise.resolve(!0):x(z(t,e.title,c))}},outDir:U(S,G,e.work,e.name),...u.file===void 0?{}:{file:R(l.cwd,u.file)},force:u.force,wait:u.wait});return{value:{...T},text:J(T,t)}})}}const re=e=>h(p(e)).catch(()=>{});export const CLOUD_SOURCE={entries:[{name:"<work>",summary:"List a work's cloud tools (AllyHub's catalog), a line each with its price; allyhub help lists the works"},{name:"<work> <tool>",summary:"Run a cloud tool with the account's credits, its input as options (allyhub help <work> <tool>); --quote prices it first"}],async nouns(e){return(await h(p(e))).works.map(n=>({name:n.id,summary:`${n.title}: ${n.description}`}))},resolve:(e,t)=>f(async()=>{const[n,r]=e;if(n===void 0||n.startsWith("-"))return;let s=await re(t),i=s?.works.find(l=>l.id===n);if(i||(s=await h(p(t),{refresh:!0}).catch(()=>s),i=s?.works.find(l=>l.id===n)),!s||!i)return;if(r===void 0||r.startsWith("-"))return{command:W(i),rest:e.slice(1),list:!0};const o=s.tools.find(l=>l.name===r);if(o?.work!==i.id)throw new b("unknown-tool",o?`${r} is not a ${i.id} tool: it is in allyhub ${o.work}.`:`No ${i.id} tool ${r}.`,{exit:$.notFound,hint:o?`allyhub ${o.work} ${r}`:`allyhub ${i.id} lists its tools.`});return{command:toolCommand(o),rest:e.slice(2),list:!1}})},upload=w({name:"upload",summary:"Upload files from this computer for a cloud tool whose input takes a URL (a presenter photo, speech audio, a reference clip), and print a signed URL for each, which works for a few hours",input:a.strictObject({files:a.array(a.string()).min(1).describe("The files: images (.jpg, .png, .webp, .gif), sound (.mp3, .wav, .m4a, .aac, .ogg, .flac) or video (.mp4, .mov, .webm), 50 MB at most")}),positional:["files"],output:a.looseObject({files:a.array(a.looseObject({file:a.string(),ok:a.boolean(),url:a.string().optional()}))}),examples:["allyhub upload assets/media/presenter.jpg"]},(e,t)=>f(async()=>{const n=await _(p(t),e.files,{base:t.cwd}),r=n.filter(o=>!o.ok),s=n.map(o=>o.ok?`${o.file}
|
|
2
|
+
import{readFile as I}from"node:fs/promises";import{join as D,resolve as x}from"node:path";import{z as n}from"zod";import{callTool as F,findTool as N,loadCatalog as p,resumeJob as L,uploadFiles as M}from"@allyhub-next/cloud";import{WORK_DIR as E}from"@allyhub-next/formats";import{EXIT as h}from"@allyhub-next/protocol";import{CommandError as w,defineCommand as m}from"../command.js";import{optionName as H}from"../args.js";import{commandHelp as U}from"../help.js";import{requiredMissing as B,toolInput as K,toolOptions as _}from"../tool-options.js";import{cloudOf as u,cloudWork as f,placeFrom as q,plural as g}from"./cloud.js";const G=8e3,c={input:n.string().optional().describe("The input as JSON, or a file of it: the whole of it, or the fields no option gives; an option given beside it wins"),file:n.string().optional().describe("The path of the file it makes (without an extension it takes the result's); the same call with the same input then keeps it, calling nothing, and while its call works waits for that call; default a folder under .allyhub/work/"),force:n.boolean().default(!1).describe("With --file: call even when the file was made from this input, and replace a file that has no record"),wait:n.boolean().default(!0).describe("Wait for a long tool (an audit, a video model); --no-wait returns its call at once"),resume:n.string().optional().describe("Wait for a call of this tool this computer made (from --no-wait, or a call that stopped waiting), and download its file")},$=(t,a)=>new w("usage",t,{exit:h.usage,...a===void 0?{}:{hint:a}}),R=t=>{const a=t.reduce((e,r)=>r.map((s,i)=>Math.max(e[i]??0,s.length)),[]);return t.map(e=>` ${e.map((r,s)=>s===e.length-1?r:r.padEnd(a[s]??0)).join(" ")}`.trimEnd())};function T(t){return m({name:t.id,summary:`${t.title}: ${t.description} Lists the tools, each a command`,input:n.strictObject({fresh:n.boolean().default(!1).describe("Read the catalog from AllyHub again, not the copy kept an hour")}),output:n.looseObject({work:n.string(),tools:n.array(n.looseObject({name:n.string()}))}),examples:[`allyhub ${t.id}`,`allyhub ${t.id} --json`]},(a,e)=>f(async()=>{const s=(await p(u(e),{refresh:a.fresh})).tools.filter(i=>i.work===t.id).sort((i,o)=>i.name.localeCompare(o.name));return{value:{work:t.id,title:t.title,tools:s.map(i=>({name:i.name,title:i.title,description:i.description,long:i.long}))},text:[`${t.title} (${g(s.length,"tool")}):`,...R(s.map(i=>[i.name,i.title])),"",`Each costs credits when it worked; a failed call is free. allyhub help ${t.id} <tool> shows a tool's options and how its credits are counted.`].join(`
|
|
3
|
+
`)}}))}function z(t,a=5,e=160){const r=i=>{const o=i===void 0?"undefined":JSON.stringify(i);return o.length>e?`${o.slice(0,e-1)}…`:o},s=(i,o)=>[`${i?`${i}: `:""}${g(o.length,"item")}${o.length>a?`, the first ${String(a)}:`:":"}`,...o.slice(0,a).map((l,b)=>` [${String(b)}] ${r(l)}`)];return Array.isArray(t)?s("",t):typeof t!="object"||t===null?[r(t)]:Object.entries(t).flatMap(([i,o])=>Array.isArray(o)?s(i,o):[`${i}: ${r(o)}`])}function W(t,a){if("jobId"in t)return[`${t.tool} is still working (call ${t.jobId}).`,`Wait for it: allyhub ${a} --resume ${t.jobId}${t.file===void 0?"":" (or the same command again: it waits for this call)"}`].join(`
|
|
4
|
+
`);if(t.kept)return[`Kept ${t.file??""}: ${t.tool} made it from this same input on ${t.kept.at} (${t.gen??""}).`,"Nothing was called or charged. --force makes it again."].join(`
|
|
5
|
+
`);const e=JSON.stringify(t.output,null,2);return[e.length<=G?e:[`Output: ${String(Math.round(Buffer.byteLength(e)/1024))} KB of JSON, in short (--json prints it whole):`,...z(t.output)].join(`
|
|
6
|
+
`),...t.file?[`File: ${t.file}${t.replaced?" (replaced: it was made from another input)":""}`]:[],...t.words?[`Words: ${t.words} (when each word is said: a part can say a stretch of the file)`]:[],...t.gen?[`Record: ${t.gen} (move it with the file)`]:[],`Credits used: ${t.credits===void 0?"not reported":String(t.credits)}`].join(`
|
|
7
|
+
`)}const P=t=>{const a=Math.max(0,Math.round(t));return`${String(Math.floor(a/60))}:${String(a%60).padStart(2,"0")}`},X=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);async function Q(t,a){const e=t.trim().startsWith("{"),r=e?t:await I(x(a.cwd,t),"utf8").catch(i=>{throw new w("not-found",`--input: cannot read ${t}: ${i.message}`,{exit:h.notFound,hint:"Give a JSON object, or a file of one."})});let s;try{s=JSON.parse(r)}catch{s=void 0}if(!X(s))throw $(`--input: ${e?"the text":t} is not a JSON object.`,`Give '{"field": …}', or a file of it.`);return s}export function toolCommand(t){const a=`${t.work} ${t.name}`,e=_(t.input,Object.keys(c)),r=n.strictObject({...e.shape,...c,input:c.input.describe(e.inputOnly.length?`${c.input.description??""}. Fields only it gives: ${e.inputOnly.join(", ")}`:c.input.description??"")}),s=[...e.fields].filter(([,i])=>e.required.includes(i)).map(([i,o])=>`--${H(i)} <${o}>`);return{spec:{name:a,summary:t.description,input:r,output:n.looseObject({tool:n.string(),output:n.record(n.string(),n.unknown()).optional(),credits:n.number().optional(),file:n.string().optional(),gen:n.string().optional(),words:n.string().optional(),jobId:n.string().optional()}),examples:[`allyhub ${[a,...s].join(" ")}`]},about:{lines:[t.title,"","A call is charged once, when it worked, as the description says; a failed call is free.",...t.long?["A long tool: the command waits for it (--no-wait returns its call, --resume waits again)."]:[]],value:{work:t.work,title:t.title,long:t.long,inputSchema:t.input,outputSchema:t.output}},run:(i,o)=>f(async()=>{const l=i,b=i,k=u(o),j=await q(o),y=K(e,b,l.input===void 0?{}:await Q(l.input,o));let O=0;const S={base:j,signal:o.signal,onRunning:d=>{Date.now()-O<3e4||(O=Date.now(),o.progress(`${t.name}: working · ${P((Date.now()-Date.parse(d.createdAt))/1e3)} (call ${d.id})`))},onRetry:(d,C,J)=>{o.progress(`${t.name}: ${C.message}; reading call ${d} again in ${String(J)} s`)}};if(l.resume!==void 0){if(Object.keys(y).length>0||l.file!==void 0)throw $("--resume waits for a call as it was made: give it no input or --file.");const d=await L(k,l.resume,{...S,tool:t.name});return{value:{...d},text:W(d,a)}}const v=B(e,y);if(v.length>0)throw $(`${t.name} needs ${v.join(", ")}.`,`allyhub help ${a} shows its options.`);const A=await F(k,t.name,y,{...S,outDir:D(j,E,t.work,t.name),...l.file===void 0?{}:{file:x(o.cwd,l.file)},force:l.force,wait:l.wait});return{value:{...A},text:W(A,a)}})}}const V=t=>p(u(t)).catch(()=>{});export const CLOUD_SOURCE={entries:[{name:"<work>",summary:"List a work's cloud tools (AllyHub's catalog), a line each; allyhub help lists the works"},{name:"<work> <tool>",summary:"Run a cloud tool with the account's credits, its input as options (allyhub help <work> <tool>, which says how its credits are counted)"}],async nouns(t){return(await p(u(t))).works.map(e=>({name:e.id,summary:`${e.title}: ${e.description}`}))},resolve:(t,a)=>f(async()=>{const[e,r]=t;if(e===void 0||e.startsWith("-"))return;let s=await V(a),i=s?.works.find(l=>l.id===e);if(i||(s=await p(u(a),{refresh:!0}).catch(()=>s),i=s?.works.find(l=>l.id===e)),!s||!i)return;if(r===void 0||r.startsWith("-"))return{command:T(i),rest:t.slice(1),list:!0};const o=s.tools.find(l=>l.name===r);if(o?.work!==i.id)throw new w("unknown-tool",o?`${r} is not a ${i.id} tool: it is in allyhub ${o.work}.`:`No ${i.id} tool ${r}.`,{exit:h.notFound,hint:o?`allyhub ${o.work} ${r}`:`allyhub ${i.id} lists its tools.`});return{command:toolCommand(o),rest:t.slice(2),list:!1}})},upload=m({name:"upload",summary:"Upload files from this computer for a cloud tool whose input takes a URL (a presenter photo, speech audio, a reference clip), and print a signed URL for each, which works for a few hours",input:n.strictObject({files:n.array(n.string()).min(1).describe("The files: images (.jpg, .png, .webp, .gif), sound (.mp3, .wav, .m4a, .aac, .ogg, .flac) or video (.mp4, .mov, .webm), 50 MB at most")}),positional:["files"],output:n.looseObject({files:n.array(n.looseObject({file:n.string(),ok:n.boolean(),url:n.string().optional()}))}),examples:["allyhub upload assets/media/presenter.jpg"]},(t,a)=>f(async()=>{const e=await M(u(a),t.files,{base:a.cwd}),r=e.filter(o=>!o.ok),s=e.map(o=>o.ok?`${o.file}
|
|
9
8
|
${o.url}${o.expiresAt===void 0?"":` (works until ${o.expiresAt})`}`:`${o.file}
|
|
10
|
-
failed: ${o.error.message}${o.error.hint?` ${o.error.hint}`:""}`);
|
|
11
|
-
`),...i?{exit:i.error.exit}:{}}})),cloudList=
|
|
12
|
-
`)};const r=
|
|
9
|
+
failed: ${o.error.message}${o.error.hint?` ${o.error.hint}`:""}`);e.length>1&&s.push(r.length===0?`${g(e.length,"file")} uploaded.`:`${String(e.length-r.length)} of ${g(e.length,"file")} uploaded; ${String(r.length)} failed.`);const i=r[0];return{value:{files:e.map(o=>o.ok?{...o}:{file:o.file,ok:!1,error:{code:o.error.code,message:o.error.message,...o.error.hint?{hint:o.error.hint}:{}}})},text:s.join(`
|
|
10
|
+
`),...i?{exit:i.error.exit}:{}}})),cloudList=m({name:"cloud list",summary:"List AllyHub's cloud works, or one work's tools, a line each",input:n.strictObject({work:n.string().optional().describe("The work whose tools to list; none lists the works")}),output:n.looseObject({})},(t,a)=>f(async()=>{const e=await p(u(a));if(t.work===void 0)return{value:{works:e.works},text:["AllyHub's cloud works:",...R(e.works.map(i=>[i.id,i.description]))].join(`
|
|
11
|
+
`)};const r=e.works.find(i=>i.id===t.work);if(!r)throw new w("unknown-work",`No work ${t.work}.`,{exit:h.notFound,hint:`The works are ${e.works.map(i=>i.id).join(", ")}.`});const s=await T(r).run({fresh:!1},a);return{value:s.value,text:s.text}})),cloudTool=m({name:"cloud tool",summary:"Show a cloud tool: what it does and how its credits are counted, and its input (as cloud call's input takes it)",input:n.strictObject({tool:n.string().describe("The tool's name, as cloud list lists it")}),output:n.looseObject({name:n.string()})},(t,a)=>f(async()=>{const e=toolCommand(await N(u(a),t.tool));return{value:{name:t.tool,summary:e.spec.summary,about:e.about?.lines??[],...e.about?.value},text:U(e.spec,e.about?.lines)}})),cloudCall=m({name:"cloud call",summary:"Run a cloud tool with the account's credits: its output, the credits used, and the file it makes with its record; waits for a long one",input:n.strictObject({tool:n.string().describe("The tool's name, as cloud list lists it"),input:n.record(n.string(),n.unknown()).default({}).describe("Its input, by its input schema (cloud tool)"),file:c.file,force:c.force,wait:c.wait,resume:c.resume}),output:n.looseObject({tool:n.string()})},(t,a)=>f(async()=>{const{tool:e,input:r,...s}=t,i=toolCommand(await N(u(a),e)),o=i.spec.input.safeParse({...s,...Object.keys(r).length?{input:JSON.stringify(r)}:{}});if(!o.success)throw $(o.error.message);const l=await i.run(o.data,a);return{...l,value:{tool:e,...l.value}}}));
|
package/dist/commands/mcp.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{McpServer as
|
|
2
|
+
import{McpServer as y}from"@modelcontextprotocol/sdk/server/mcp.js";import{StdioServerTransport as b}from"@modelcontextprotocol/sdk/server/stdio.js";import{CallToolRequestSchema as S,ListResourcesRequestSchema as g,ListToolsRequestSchema as k,ReadResourceRequestSchema as v}from"@modelcontextprotocol/sdk/types.js";import{z as f}from"zod";import{describeCommand as R,toolName as d}from"@allyhub-next/protocol";import{CommandError as m,defineCommand as C}from"../command.js";import{CardApp as j}from"./mcp-app.js";import{docResources as M,readDoc as O}from"./mcp-docs.js";const A="0.0.0";export const MCP_INSTRUCTIONS=["AllyHub makes videos, decks, docs, sheets and 3D sceneries as code in a project folder, checks, previews and renders them on this computer, and runs AI models and research tools in its cloud, which cost the person's credits.","Each tool here is one of its commands: `allyhub help` on the command line (`npx -y allyhub help`) is their reference and says where the SDK's docs are.",`\`allyhub skills\` (${d("skills")}) lists AllyHub's work skills, each how to make one kind of work; \`allyhub skills show <name>\` (${d("skills show")}) prints one, and \`allyhub add <name>\` puts it in the project.`].join(" ");async function N(i,t,u){const c=(e,o=!1)=>({content:[{type:"text",text:JSON.stringify(e,null,2)}],...o?{isError:o}:{}}),a=i.spec.input.safeParse(t??{});if(!a.success){const e=a.error.issues[0];return c({error:{code:"usage",message:`${e?.path.join(".")??i.spec.name}: ${e?.message??"not valid"}.`}},!0)}try{const e=await i.run(a.data,u);return c(e.value)}catch(e){const o=e instanceof m?e:new m("failed",e instanceof Error?e.message:String(e));return c({error:{code:o.code,message:o.message,...o.hint===void 0?{}:{hint:o.hint}}},!0)}}export const mcp=C({name:"mcp",summary:"The commands as MCP tools, over stdio",input:f.strictObject({}),output:f.looseObject({}),examples:["claude mcp add allyhub -- allyhub mcp"],mcp:!1},async(i,t)=>{const{COMMANDS:u,MCP_COMMANDS:c}=await import("./index.js"),a=new Map([...u,...c].filter(s=>s.spec.mcp!==!1).map(s=>[d(s.spec.name),s]));console.log=console.error,console.info=console.error;const e=new y({name:"allyhub",version:A},{capabilities:{tools:{},resources:{}},instructions:MCP_INSTRUCTIONS}),o=new j(t),l=e.server;l.setRequestHandler(k,()=>({tools:[...o.tools(),...[...a].map(([s,n])=>{const r=Object.fromEntries(Object.entries(R(n.spec).input).filter(([p])=>p!=="$schema"));return{name:s,description:n.spec.summary,inputSchema:{type:"object",...r}}})]})),l.setRequestHandler(g,async()=>({resources:[...o.resources(),...await M(t.cwd)]})),l.setRequestHandler(v,async s=>{const{uri:n}=s.params;if(n===o.resources()[0]?.uri)return{contents:[await o.resource()]};const r=await O(t.cwd,n);if(r===void 0)throw new m("not-found",`allyhub has no resource ${n}.`);return{contents:[r]}}),l.setRequestHandler(S,(s,n)=>{if(o.has(s.params.name))return o.call(s.params.arguments);const r=a.get(s.params.name);if(!r)throw new m("unknown-tool",`allyhub has no tool ${s.params.name}.`);const p=AbortSignal.any([t.signal,n.signal]);return N(r,s.params.arguments,{...t,signal:p})});const h=new b,w=new Promise(s=>{h.onclose=s});return await e.connect(h),process.stdin.once("end",()=>{e.close()}),t.signal.addEventListener("abort",()=>{e.close()}),await w,await o.close(),{value:{},text:""}});
|
package/dist/commands/orgs.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{z as
|
|
3
|
-
`)}})),orgsSwitch=
|
|
2
|
+
import{z as o}from"zod";import{chooseOrganization as f,organizations as l,readCredentials as p}from"@allyhub-next/cloud";import{API_KEY_ENV as h,EXIT as u}from"@allyhub-next/protocol";import{defineCommand as c}from"../command.js";import{cloudOf as g,cloudWork as d}from"./cloud.js";const y=o.looseObject({id:o.string(),name:o.string(),slug:o.string(),role:o.string(),current:o.boolean()});export const orgsList=c({name:"orgs list",summary:"The organizations you are in, with your role; the one this computer acts in and pays from is marked",input:o.strictObject({}),output:o.looseObject({organizations:o.array(y)})},(r,a)=>d(async()=>{const e=g(a),s=await l(e),i=(await p(e.config))?.account.organization?.id,n=s.filter(t=>t.dissolvedAt===null).map((t,m)=>({id:t.id,name:t.name,slug:t.slug,role:t.role,current:i===void 0?m===0:t.id===i}));return{value:{organizations:n},text:n.map(t=>`${t.current?"*":" "} ${t.slug} ${t.name} ${t.role}`).join(`
|
|
3
|
+
`)}})),orgsSwitch=c({name:"orgs switch",summary:"Act in and pay from another organization on this computer (Studio too), by its slug or id",input:o.strictObject({org:o.string().min(1).describe("The organization: its slug or id")}),positional:["org"],output:o.looseObject({id:o.string(),name:o.string()}),examples:["allyhub orgs switch apollo"]},(r,a)=>d(async()=>{const e=g(a);if(e.config.apiKey!==void 0)return{value:{id:"",name:""},text:`A key in ${h} acts in the organization it was made for; unset it to choose one here.`,exit:u.usage};const i=(await l(e)).filter(n=>n.dissolvedAt===null).find(n=>n.slug===r.org||n.id===r.org);return i===void 0?{value:{id:"",name:""},text:`You are in no organization ${r.org}. allyhub orgs list says which you are in.`,exit:u.usage}:(await f(e.config,{id:i.id,name:i.name}),{value:{id:i.id,name:i.name},text:`This computer acts in ${i.name} now.`})}));
|
package/dist/commands/voice.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{z as
|
|
3
|
-
`)}
|
|
2
|
+
import{z as t}from"zod";import{projectSays as f}from"@allyhub-next/project";import{makeSay as u}from"@allyhub-next/cloud";import{EXIT as y}from"@allyhub-next/protocol";import{CommandError as g,defineCommand as $}from"../command.js";import{projectRoot as v}from"../project.js";import{cloudOf as w,cloudWork as b,plural as n}from"./cloud.js";import{dir as j}from"../fields.js";const h=i=>Math.round(i*1e6)/1e6;export const voice=$({name:"voice",summary:"Make the voice files a project's say(text) parts need, with their cloud voice tool, one per say that has none (assets/media/gen/say/<hash>, its words and its record); --dry-run lists them first, with their tool and characters",input:t.strictObject({item:t.string().optional().describe("Only this item's says: its id, a path into it, or a folder of items"),dir:j,dryRun:t.boolean().default(!1).describe("List the says without a file, each with its tool and characters, making nothing")}),positional:["item"],output:t.looseObject({says:t.number(),missing:t.array(t.looseObject({part:t.string(),stem:t.string()})).optional(),made:t.array(t.looseObject({part:t.string(),file:t.string()})).optional(),credits:t.number().optional()}),examples:["allyhub voice --dry-run","allyhub voice launch/film"]},async(i,s)=>{const c=await v(s.cwd,i.dir),o=await f(c,i.item===void 0?{}:{piece:i.item});if(i.item!==void 0&&o.pieces.length===0)throw new g("no-item",`No video ${i.item} in the project.`,{exit:y.notFound});const a=o.says.filter(l=>l.file===void 0),d=`Every say has its file (${n(o.says.length,"say")}). Nothing to make.`;return await b(async()=>{const l=w(s);if(i.dryRun)return{value:{says:o.says.length,missing:a.map(e=>({piece:e.piece,part:e.part,tool:e.tool,...e.voice===void 0?{}:{voice:e.voice},...e.params===void 0?{}:{params:e.params},characters:e.text.length,stem:e.stem}))},text:a.length===0?d:[`${n(a.length,"say")} without a file:`,...a.map(e=>` ${e.piece} · ${e.part}: ${e.tool}, ${n(e.text.length,"character")}`),"Nothing was made; allyhub voice makes them, priced as each tool's description says."].join(`
|
|
3
|
+
`)};const r=[];for(const e of a){s.progress(`${e.piece} · ${e.part}: ${e.tool}…`);const m=await u(l,c,e,{base:c,signal:s.signal});r.push({piece:e.piece,part:e.part,...m})}const p=h(r.reduce((e,m)=>e+m.credits,0));return{value:{says:o.says.length,made:r,kept:o.says.length-a.length,credits:p},text:r.length===0?d:[`Made ${n(r.length,"file")}:`,...r.map(e=>` ${e.file} (${e.piece} · ${e.part}, ${String(h(e.seconds))} s)`),`Credits used: ${String(p)}.`].join(`
|
|
4
4
|
`)}})});
|
package/dist/main.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{readFileSync as
|
|
2
|
+
import{readFileSync as D}from"node:fs";import{EXIT as m,describeCommand as I}from"@allyhub-next/protocol";import{readArgs as R}from"./args.js";import{CommandError as h}from"./command.js";import{COMMAND_SOURCES as M,COMMANDS as x}from"./commands/index.js";import{commandHelp as j,listHelp as T,workHelp as H}from"./help.js";import{sdkDocs as J}from"./sdk-docs.js";import{WORKS as G,cloudNouns as U,workNamed as W,workTitle as E}from"./works.js";const N=JSON.parse(D(new URL("../package.json",import.meta.url),"utf8")).version,F={stdout:t=>process.stdout.write(t),stderr:t=>process.stderr.write(t),cwd:process.cwd(),env:process.env};export function findCommand(t,s=x){let i;for(const c of s){const l=c.spec.name.split(" ");l.every((o,a)=>t[a]===o)&&l.length>(i?.length??0)&&(i={command:c,length:l.length})}return i?{command:i.command,rest:t.slice(i.length)}:{rest:[...t]}}export async function resolveCommand(t,s,i=x,c=M){const l=findCommand(t,i);if(l.command)return l;for(const o of c){const a=await o.resolve(t,s);if(a)return a}return l}const A=t=>({...I(t.spec),...t.about?.value});export async function main(t,s=F,i=x,c=M){const l=t.includes("--json"),o=t.filter(n=>n!=="--json"),a=(n,e)=>{s.stdout(l?`${JSON.stringify(n,null,2)}
|
|
3
3
|
`:`${e}
|
|
4
|
-
`)},S=i.map(n=>n.spec),
|
|
5
|
-
`)},signal:
|
|
6
|
-
`):
|
|
4
|
+
`)},S=i.map(n=>n.spec),b=new AbortController,y={cwd:s.cwd,env:s.env,progress:n=>{s.stderr(`${n}
|
|
5
|
+
`)},signal:b.signal};if(o[0]==="--version"||o[0]==="-v")return a({version:N},N),m.ok;if(o.length===0||o[0]==="help"||o[0]==="--help"||o[0]==="-h"){const n=o.slice(1),e=await J(s.cwd).catch(()=>{}),k=async()=>{const r=await Promise.all(c.map(u=>u.nouns(y).catch(()=>{})));return r.some(u=>u===void 0)?void 0:r.flatMap(u=>u??[])};if(n.length===0){const r=await k();return a({version:N,docs:e?.dir,works:G.map(u=>({...u,title:E(u,r)})),commands:S.map(I),made:[...c.flatMap(u=>u.entries),...r??[]]},T(S,c,r,e?.dir)),m.ok}const d=n.length===1?W(n[0]??""):void 0;if(d){const r=d.cloud===void 0?[]:await k();return a({...d,title:E(d,r),...d.cloud===void 0?{}:{cloudWorks:r&&U(d,r)},docsDir:e?.dir},H(d,S,c,e?.dir,r)),m.ok}let p;try{p=await resolveCommand(n,y,i,c)}catch(r){return g(r)}const{command:f,rest:O}=p;return f&&p.list===!0?await C(f,O):!f||O.length>0?g(new h("unknown-command",`allyhub has no command "${n.join(" ")}".`,{exit:m.usage,hint:"allyhub help lists them and the works."})):(a(A(f),j(f.spec,f.about?.lines)),m.ok)}let $;try{$=await resolveCommand(o,y,i,c)}catch(n){return g(n)}const{command:w,rest:v}=$;if(!w)return g(new h("unknown-command",`allyhub has no command "${o[0]??""}".`,{exit:m.usage,hint:"allyhub help lists them."}));if(v.includes("--help")||v.includes("-h"))return a(A(w),j(w.spec,w.about?.lines)),m.ok;return await C(w,v);async function C(n,e){const k=()=>{b.abort(new h("interrupted","Stopped.",{exit:m.interrupted}))};process.once("SIGINT",k);try{const d=R(n.spec,e),p=await n.run(d,y);return a(p.value,p.text),p.exit??m.ok}catch(d){return g(d)}finally{process.off("SIGINT",k)}}function g(n){const e=n instanceof h?n:b.signal.aborted?new h("interrupted","Stopped.",{exit:m.interrupted}):new h("failed",n instanceof Error?n.message:String(n));return l?s.stdout(`${JSON.stringify({error:{code:e.code,message:e.message,...e.hint?{hint:e.hint}:{}}},null,2)}
|
|
6
|
+
`):s.stderr(`${e.message}${e.hint?`
|
|
7
7
|
${e.hint}`:""}
|
|
8
8
|
`),e.exit}}
|