allyhub 0.2.0 → 0.3.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/cli-version.js +2 -0
- package/dist/commands/add.js +5 -5
- package/dist/commands/dev.js +2 -2
- package/dist/commands/mcp.js +1 -1
- package/dist/commands/model.js +1 -1
- package/dist/commands/render.js +1 -1
- package/dist/commands/skills.js +3 -3
- package/dist/main.js +7 -7
- package/dist/works.js +1 -1
- package/editor-app/view.html +3 -3
- package/editor-web/assets/chevron-left-W6sP7nB1.js +1 -0
- package/editor-web/assets/{chevron-up-BMNXDEBs.js → chevron-up-566GQpAm.js} +1 -1
- package/editor-web/assets/{dist-B4VKfY-H.js → dist-BKDr73BR.js} +4 -4
- package/editor-web/assets/dist-CPCNTYVu.js +8 -0
- package/editor-web/assets/{dist-Coblfc3T.js → dist-C_NajYp0.js} +1 -1
- package/editor-web/assets/{dist-BcInw4os.js → dist-mA6NrAKh.js} +34 -34
- package/editor-web/assets/{floating-ui.react-dom-DSyn5TRd.js → floating-ui.react-dom-BUxFRF6t.js} +1 -1
- package/editor-web/assets/index-CFZhjTQW.js +56 -0
- package/editor-web/assets/index-DgU-lyX6.css +2 -0
- package/editor-web/assets/{react-Bo429Bov.js → react-Ff_buMj8.js} +1 -1
- package/editor-web/assets/{undo-2-CWgOKQ3L.js → undo-2-BKFItM3X.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/dist/scan.js +1 -1
- package/node_modules/@allyhub-next/build/package.json +1 -1
- package/node_modules/@allyhub-next/check/dist/check.js +3 -3
- package/node_modules/@allyhub-next/check/package.json +1 -1
- package/node_modules/@allyhub-next/cloud/dist/index.js +1 -1
- package/node_modules/@allyhub-next/cloud/dist/token.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/dev-server/dist/live.js +1 -1
- package/node_modules/@allyhub-next/dev-server/dist/tools.js +1 -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/dist/export.d.ts +5 -2
- package/node_modules/@allyhub-next/export/dist/export.js +2 -2
- package/node_modules/@allyhub-next/export/package.json +1 -1
- package/node_modules/@allyhub-next/formats/dist/items.d.ts +5 -0
- package/node_modules/@allyhub-next/formats/dist/items.js +1 -1
- package/node_modules/@allyhub-next/formats/dist/layout.d.ts +2 -0
- package/node_modules/@allyhub-next/formats/dist/layout.js +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/dist/report.d.ts +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/app.d.ts +3 -0
- package/node_modules/@allyhub-next/protocol/dist/auth.d.ts +17 -0
- package/node_modules/@allyhub-next/protocol/dist/auth.js +1 -1
- package/node_modules/@allyhub-next/protocol/dist/cli.d.ts +1 -1
- package/node_modules/@allyhub-next/protocol/dist/cli.js +1 -1
- package/node_modules/@allyhub-next/protocol/dist/editor.d.ts +4 -0
- package/node_modules/@allyhub-next/protocol/dist/registry.d.ts +3 -1
- package/node_modules/@allyhub-next/protocol/dist/registry.js +1 -1
- package/node_modules/@allyhub-next/protocol/dist/routes.js +1 -1
- package/node_modules/@allyhub-next/protocol/dist/tools.d.ts +1 -0
- 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/dist/page.js +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/dist/index.js +5 -5
- 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/dist/bundle.d.ts +1 -0
- package/node_modules/@allyhub-next/scenery-host/dist/bundle.js +3 -3
- package/node_modules/@allyhub-next/scenery-host/dist/model-stage.d.ts +32 -0
- package/node_modules/@allyhub-next/scenery-host/dist/model-stage.js +3 -0
- 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/dist/problem.d.ts +4 -0
- package/node_modules/@allyhub-next/video-core/dist/problem.js +1 -1
- package/node_modules/@allyhub-next/video-core/package.json +1 -1
- package/package.json +28 -28
- package/editor-web/assets/chevron-left-D1vfOP5S.js +0 -1
- package/editor-web/assets/dist-BIEloJVS.js +0 -8
- package/editor-web/assets/index-BSFR4plz.css +0 -2
- package/editor-web/assets/index-Dc8FX_sp.js +0 -56
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
export{cloudConfig,hostsText}from"./config.js";export{CloudError,notSignedIn,SIGN_IN}from"./errors.js";export{Cloud,scrub}from"./client.js";export{SignedOut,accessOf,accountOf,authServer,chooseOrganization,forgetCredentials,readCredentials,signInWithCode,signInWithDevice,signOut,writeCredentials}from"./credentials.js";export{SIGN_IN_WAIT_MS,openBrowser,signIn,signInByEmail,signInDevice,signInInBackground,signedInAs}from"./signin.js";export{LoopbackError,startLoopback}from"./loopback.js";export{pkcePair,randomState}from"./pkce.js";export{accessToken,billingSummary,organizations}from"./token.js";export{CATALOG_CACHE_SECONDS,findTool,loadCatalog}from"./catalog.js";export{POLL_SECONDS,READ_SECONDS,RETRY_SECONDS,WAIT_SECONDS,callTool,resumeJob}from"./call.js";export{REUSE_LEFT_MS,UPLOAD_CONCURRENCY,UPLOAD_TYPES,uploadFiles,urlExpiry,withKnownUploads}from"./uploads.js";export{BASE64_FROM,LARGE_FROM,canonical,genRecord,inputHash,isSecretName,namedFile,readGen,recordInput,recordOutput,toolWords,withoutSignature,writeGen,writeWords}from"./records.js";export{makeSay,sayInput}from"./voice.js";
|
|
2
|
+
export{cloudConfig,hostsText}from"./config.js";export{CloudError,notSignedIn,SIGN_IN}from"./errors.js";export{Cloud,scrub}from"./client.js";export{SignedOut,accessOf,accountOf,authServer,chooseOrganization,forgetCredentials,readCredentials,signInWithCode,signInWithDevice,signOut,writeCredentials}from"./credentials.js";export{SIGN_IN_WAIT_MS,openBrowser,signIn,signInByEmail,signInDevice,signInInBackground,signedInAs}from"./signin.js";export{LoopbackError,startLoopback}from"./loopback.js";export{pkcePair,randomState}from"./pkce.js";export{accessToken,billingSummary,browserLink,organizations}from"./token.js";export{CATALOG_CACHE_SECONDS,findTool,loadCatalog}from"./catalog.js";export{POLL_SECONDS,READ_SECONDS,RETRY_SECONDS,WAIT_SECONDS,callTool,resumeJob}from"./call.js";export{REUSE_LEFT_MS,UPLOAD_CONCURRENCY,UPLOAD_TYPES,uploadFiles,urlExpiry,withKnownUploads}from"./uploads.js";export{BASE64_FROM,LARGE_FROM,canonical,genRecord,inputHash,isSecretName,namedFile,readGen,recordInput,recordOutput,toolWords,withoutSignature,writeGen,writeWords}from"./records.js";export{makeSay,sayInput}from"./voice.js";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{BILLING_SUMMARY_PATH as a,BillingSummarySchema as t,ORGANIZATIONS_PATH as
|
|
2
|
+
import{BILLING_SUMMARY_PATH as r,BROWSER_LINK_PATH as a,BillingSummarySchema as t,BrowserLinkSchema as i,ORGANIZATIONS_PATH as c,OrganizationsSchema as s}from"@allyhub-next/protocol";import{accessOf as u}from"./credentials.js";import{notSignedIn as m}from"./errors.js";export async function accessToken(n){const e=n.config.apiKey;if(e)return{accessToken:e,source:"env"};const o=await u(n.config).catch(()=>{});if(!o)throw m();return{accessToken:o.token,expiresAt:o.expiresAt,account:o.credentials.account,source:"oauth"}}export async function billingSummary(n){return t.parse(await n.json(r))}export async function organizations(n){return s.parse(await n.json(c)).organizations}export async function browserLink(n,e){return i.parse(await n.json(a,{method:"POST",body:{to:e}})).url}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{readFile as b,rm as m}from"node:fs/promises";import{join as h}from"node:path";import{fileLoudness as v}from"@allyhub-next/audio/node";import{startBrowser as g}from"@allyhub-next/browser";import{allyhubPlugin as y,listFiles as S,loadUserVite as $,prepare as D,readMedia as k,sourceOf as j}from"@allyhub-next/build";import{CACHE_DIR as B}from"@allyhub-next/formats";import{CheckSession as
|
|
2
|
+
import{readFile as b,rm as m}from"node:fs/promises";import{join as h}from"node:path";import{fileLoudness as v}from"@allyhub-next/audio/node";import{startBrowser as g}from"@allyhub-next/browser";import{allyhubPlugin as y,listFiles as S,loadUserVite as $,prepare as D,readMedia as k,sourceOf as j}from"@allyhub-next/build";import{CACHE_DIR as B,entryKind as O}from"@allyhub-next/formats";import{CheckSession as R,ProjectError as C,pickTarget as U,parseCombo as E}from"@allyhub-next/project";import{RPC_ERROR as p,RpcError as f}from"@allyhub-next/protocol";import{bundleScenery as P,writeModelStage as F}from"@allyhub-next/scenery-host/bundle";import{sceneryHost as w,serveDecoders as M}from"@allyhub-next/stage";export const stageMedia=(r,e)=>`${r}media/${e.split("/").map(encodeURIComponent).join("/")}`;export function rpcErrorOf(r){return r instanceof C?new f(r.kind==="not-found"?p.notFound:p.invalid,r.hint?`${r.message} ${r.hint}`:r.message):r}export class Live{root;stageBase;buildDir;revision=0;prep;last;lease;old=new Set;browserStarted;gpu;sceneries=new Map;closed=!1;constructor(e,t,s={}){this.root=e,this.stageBase=t,this.buildDir=h(e,B,"build",`dev-${String(process.pid)}`),this.gpu=s.gpu}moved(e){this.revision=e,this.lease&&this.lease.revision!==e&&this.retire(this.lease)}prepared(){const e=this.revision;if(this.prep?.revision===e)return this.prep.promise;const t=(async()=>{const s=await D(this.root,{buildDir:h(this.buildDir,"stage"),mediaUrl:i=>stageMedia(this.stageBase,i),host:w(this.root)});return s.bundle&&await M(s.bundle.dir),this.last=s,s})();return this.prep={revision:e,promise:t},t.catch(()=>{this.prep?.promise===t&&(this.prep=void 0)}),t}latest(){return this.last}async target(e,t){const s=await this.prepared();try{const{piece:i,target:d}=U(s,e,t===void 0?void 0:[E(t)]);return{prepared:s,piece:i,combo:d.combo}}catch(i){throw rpcErrorOf(i)}}async source(e,t){const s=await this.prepared(),i=s.pieces.find(o=>o.id===e);if(!i)throw new f(p.notFound,`No piece ${e}.`);const d=j(s,i,`${t}${this.stageBase}build/`,o=>`${t}${stageMedia(this.stageBase,o)}`),c={...d.media},u=(o,n)=>`${t}${this.stageBase}${o}/${n.split("/").map(encodeURIComponent).join("/")}`;return await Promise.all(Object.entries(c).map(async([o,n])=>{let a=n;if(n.kind==="video"&&n.matte===!0&&(a={...a,matteUrl:u("matte",o)}),n.kind==="audio"||n.kind==="video"&&n.audio===!0){a={...a,denoisedUrl:u("sound",o)};const l=await v(h(this.root,o)).catch(()=>{});l!==void 0&&(a={...a,loudness:l.lufs,...l.by==="level"?{loudnessBy:"level"}:{}})}c[o]=a})),{...d,media:c}}browser(){return this.browserStarted??=g(this.gpu===void 0?{}:{gpu:this.gpu}),this.browserStarted}async withSession(e){if(this.closed)throw new f(p.unavailable,"allyhub dev is stopping.");let t=this.lease;if(t?.revision!==this.revision){t&&this.retire(t);const s=h(this.buildDir,`session-${String(this.revision)}`),i=await this.browser();t={revision:this.revision,session:R.open({root:this.root,browser:i,buildDir:s}),users:0,retired:!1,dir:s},this.lease=t,t.session.catch(()=>{this.lease===t&&(this.lease=void 0)})}t.users++;try{return await e(await t.session)}finally{t.users--,t.retired&&t.users===0&&this.end(t)}}retire(e){e.retired=!0,this.lease===e&&(this.lease=void 0),this.old.add(e),e.users===0&&this.end(e)}async end(e){this.old.delete(e),await e.session.then(t=>t.close()).catch(()=>{}),await m(e.dir,{recursive:!0,force:!0})}scenery(e){const t=this.sceneries.get(e);if(t?.revision===this.revision)return t.promise;const s=this.bundleScenery(e);return this.sceneries.set(e,{revision:this.revision,promise:s}),s.catch(()=>{this.sceneries.get(e)?.promise===s&&this.sceneries.delete(e)}),s}async bundleScenery(e){const t=await S(this.root),s=await k(this.root,t),i=await x(this.root),d=w(this.root),c=await $(this.root),u=h(this.buildDir,"scenery"),o=O(e)==="model"?await F({root:this.root,model:e,outDir:u}):e;return{...await P({root:this.root,file:o,outDir:u,dependencies:i,plugins:[y({root:this.root,media:s,dependencies:i,lent:d.lent,mediaUrl:a=>stageMedia(this.stageBase,a)})],...c?{user:c}:{}}),media:Object.keys(s)}}async close(){this.closed=!0,this.lease&&this.retire(this.lease),await Promise.all([...this.old].map(e=>this.end(e))),await this.browserStarted?.then(e=>e.close()).catch(()=>{}),await m(this.buildDir,{recursive:!0,force:!0})}}async function x(r){try{const e=JSON.parse(await b(h(r,"package.json"),"utf8")),t=new Set;for(const s of["dependencies","devDependencies","peerDependencies","optionalDependencies"]){const i=e[s];if(i&&typeof i=="object")for(const d of Object.keys(i))t.add(d)}return t}catch{return new Set}}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{readFile as y}from"node:fs/promises";import{basename as
|
|
2
|
+
import{readFile as y}from"node:fs/promises";import{basename as S,join as b}from"node:path";import{listFiles as f}from"@allyhub-next/build";import{splitTitle as R,parseDoc as T,titleText as E}from"@allyhub-next/doc";import{ITEM_KINDS as v,scanItems as u}from"@allyhub-next/formats";import{OpenedVersion as O,parseCombo as F}from"@allyhub-next/project";import{RPC_ERROR as l,RpcError as d}from"@allyhub-next/protocol";import{readSpec as $}from"@allyhub-next/sheet";import{comboKey as w,formatInfo as g}from"@allyhub-next/video-core";import{rpcErrorOf as j}from"./live.js";import{loose as I}from"./paths.js";const k=s=>{const r=s.addresses?.();if(!r)throw new d(l.unavailable,"This server serves no pages: only allyhub dev's does.");return r},D=s=>({mime:"image/webp",data:s.toString("base64")});async function N(s,r,m){try{if(r.kind==="doc"){const e=await y(b(s,r.entry),"utf8");return E(R(T(e).blocks).title)||void 0}if(r.kind==="sheet"){const e=await y(b(s,r.dir,"sheet.yaml"),"utf8");return $(e).spec.title}}catch{return}return m.get(r.dir)}export function toolHandlers(s){const{live:r}=s,m=async(e,t,a,o)=>{try{return await r.withSession(async n=>{const i=await O.open({root:r.root,item:e,...t===void 0?{}:{combos:[F(t)]},purpose:a,session:n});try{return await o(i)}finally{await i.close()}})}catch(n){throw j(n)}};return{"project/items":async()=>{const e=await f(r.root),t=u(e),o=t.items.some(i=>i.kind==="video"||i.kind==="slides")?await r.prepared().catch(()=>r.latest()):void 0,n=new Map;for(const i of o?.pieces??[]){const c=typeof i.title=="string"?i.title:void 0;c&&n.set(i.dir,c)}return{items:await Promise.all(t.items.map(async i=>{const c=await N(r.root,i,n);return{...i,...c?{title:c}:{}}})),folder:r.root,name:S(r.root),revision:r.revision}},"video/versions":async({item:e})=>{const{piece:t}=await r.target(e),a=[...new Set(t.combos.map(o=>o.lang))];return{piece:t.id,kind:t.kind,...typeof t.title=="string"?{title:t.title}:{},width:g(t.formatEntry)?.width??0,height:g(t.formatEntry)?.height??0,versions:a.map(o=>o===void 0?{key:w({})}:{key:w({lang:o}),lang:o})}},"video/stage":async({item:e,version:t,start:a,play:o,chrome:n})=>{const{piece:i,combo:c}=await r.target(e,t),p=new URLSearchParams({piece:i.id,combo:w(c)});for(const[x,P]of Object.entries(a??{}))p.set(x,String(P));o&&p.set("play","1"),n===!1&&p.set("chrome","0");const h=k(s);return{url:h.stage(p),probe:h.probe}},"video/timeline":async({item:e,version:t})=>m(e,t,"play",a=>Promise.resolve({timeline:I(a.timeline),text:a.version.summary?.text??[]})),"video/still":async({item:e,version:t,t:a})=>m(e,t,"render",async o=>{const n=a??o.timeline.parts[0]?.still??0;return{t:n,image:D(await o.still(n,{format:"webp"})),width:o.timeline.width,height:o.timeline.height,duration:o.timeline.duration}}),"check/results":()=>Promise.resolve(s.checker?.state??{status:"off",revision:r.revision,problems:[],facts:[]}),"check/run":()=>{if(!s.checker)throw new d(l.unavailable,"This server runs no check.");return s.checker.schedule(!0),Promise.resolve({})},"export/start":async({item:e,versions:t,types:a})=>{const o=await f(r.root);if(!u(o).items.some(n=>n.dir===e))throw new d(l.notFound,`There is no item ${e}.`);return{job:s.exports.start(e,t??[],a??[])}},"export/cancel":({job:e})=>{if(!s.exports.cancel(e))throw new d(l.notFound,`No export ${e} is under way.`);return Promise.resolve({})},"export/list":()=>Promise.resolve({jobs:s.exports.list()}),"scenery/viewer":async({item:e,camera:t})=>{const a=await f(r.root),o=u(a).items.find(c=>c.dir===e&&(c.kind==="scenery"||c.kind==="model"));if(!o)throw new d(l.notFound,`There is no scenery or 3D model ${e}: a scenery is a folder with a ${v.scenery.entries[0]??"scenery.ts"}, a model one with a ${v.model.entries[0]??"model.ts"}.`);const n=new URLSearchParams({file:o.entry});t&&n.set("camera",JSON.stringify(t));const i=k(s);return{url:i.viewer(n),probe:i.probe}}}}
|
|
@@ -45,7 +45,7 @@ export interface ExportedFile extends VersionFile {
|
|
|
45
45
|
name: string;
|
|
46
46
|
path: string;
|
|
47
47
|
piece: string;
|
|
48
|
-
type: FileType | DocType | SheetType;
|
|
48
|
+
type: FileType | DocType | SheetType | ModelType;
|
|
49
49
|
combo?: Combo;
|
|
50
50
|
key?: string;
|
|
51
51
|
format?: string;
|
|
@@ -56,7 +56,7 @@ export interface ExportedFile extends VersionFile {
|
|
|
56
56
|
export interface NotExported {
|
|
57
57
|
name: string;
|
|
58
58
|
piece: string;
|
|
59
|
-
type: FileType | DocType | SheetType;
|
|
59
|
+
type: FileType | DocType | SheetType | ModelType;
|
|
60
60
|
code: string;
|
|
61
61
|
message: string;
|
|
62
62
|
hint?: string;
|
|
@@ -66,6 +66,9 @@ export declare const DOC_TYPES: readonly ["pdf", "png", "md"];
|
|
|
66
66
|
export declare const SHEET_TYPES: readonly ["xlsx", "csv", "md", "json"];
|
|
67
67
|
export type DocType = (typeof DOC_TYPES)[number];
|
|
68
68
|
export type SheetType = (typeof SHEET_TYPES)[number];
|
|
69
|
+
/** What a 3D model renders to: its GLB, as `allyhub 3d-model` builds it. */
|
|
70
|
+
export declare const MODEL_TYPES: readonly ["glb"];
|
|
71
|
+
export type ModelType = (typeof MODEL_TYPES)[number];
|
|
69
72
|
export interface ProjectExportOptions extends VersionExportOptions {
|
|
70
73
|
root: string;
|
|
71
74
|
/** Only these items (a piece, a doc or a sheet by id or place, a path into it, a folder of items); default every one. */
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{mkdir as L,readFile as V,stat as X,writeFile as M}from"node:fs/promises";import{cpus as me}from"node:os";import{dirname as Z,isAbsolute as ue,join as $,relative as ee,sep as he}from"node:path";import{parseDoc as ge,markdownOf as we}from"@allyhub-next/doc";import{codeOf as be,fontsDigest as ye}from"@allyhub-next/build";import{RenderError as ke,VIDEO_TYPES as xe,renderCaptions as $e,renderCover as Pe,renderPdf as Se,renderPng as Ee,renderPptx as je,renderVideo as Ce,mixSound as Me,requireEncoder as Oe,requireFfmpeg as Te}from"@allyhub-next/render";import{renderDoc as Ne}from"@allyhub-next/render/doc";import{jsonOf as ve,markdownOf as Le,readSheet as Fe,readSpec as _e}from"@allyhub-next/sheet";import{SHEET_SPEC as Ae}from"@allyhub-next/formats";import{graphicsPage as De,stageIdentity as Ie}from"@allyhub-next/stage";import{DEFAULT_TYPES as Re,FILE_TYPES as te,comboKey as Y,exportProblem as Ve,pieceIs as z,pieceNamed as ne}from"@allyhub-next/video-core";import{runCheck as Ye}from"@allyhub-next/check";import{batchCsv as ze,batchRows as We}from"./batch.js";import{batchName as qe,checkName as He,exportName as se,exportNames as Je}from"./names.js";import{ConsolePool as Ke,mergeConsole as Ue,dedupe as oe,indexNeeds as Be,makeIndex as Ge,CheckSession as Qe,OpenedVersion as Xe,ProjectError as N,versionLabel as ie}from"@allyhub-next/project";const re=e=>xe.includes(e);export async function exportVersion(e,i,c,r={}){await L(Z(c),{recursive:!0});const p={page:e.graphics(),target:e.target,look:e.look,media:e.media,out:c};if(i==="wav"){const f=await Me({timeline:e.timeline,sound:await e.sound(),out:c});return r.onProgress?.(1),{files:[c],duration:Math.round(e.timeline.duration*e.timeline.fps)/e.timeline.fps,...f.loudness?{loudness:f.loudness}:{},master:{...f}}}if(re(i)&&(i!=="png"||e.piece.kind==="video")){const f=e.prepared,a=await ye(f.root,f.files,f.fonts),o=await Ce({target:e.target,look:e.look,media:e.media,pages:[e.graphics()],openPage:async()=>{const u=await e.session.open(e.piece,e.target,"render");return De(u.stage,{gpu:e.session.gpu})},...i==="gif"?{}:{sound:await e.sound()},out:c,type:i,...r.encode?{encode:r.encode}:{},...r.workers===void 0?{}:{workers:r.workers},...r.onProgress?{onProgress:r.onProgress}:{},code:await be(f,e.piece,Ie(a)),...r.partCache===!1?{partCache:!1}:{}});return{files:o.files??[o.out],duration:o.duration,parts:o.parts,...o.junctions?{junctions:o.junctions}:{},...o.loudness?{loudness:o.loudness}:{},...o.master?{master:{...o.master}}:{},timings:o.timings}}const m=i==="srt"||i==="vtt"?await $e({...p,type:i,...r.captions?{captions:r.captions}:{}}):i==="pdf"?await Se(p):i==="pptx"?await je(p):i==="png"?await Ee(p):await Pe(p);return r.onProgress?.(1),{files:m.files??[m.out]}}export const exportsAtOnce=e=>Math.max(1,Math.min(e,Math.floor(me().length/4))),DOC_TYPES=["pdf","png","md"],SHEET_TYPES=["xlsx","csv","md","json"];const W=(e,i)=>`${String(e)} ${i}${e===1?"":"s"}`;function Ze(e){if(e===void 0)return;const i=new Set([...Object.keys(te),...DOC_TYPES,...SHEET_TYPES]);for(const c of e)if(!i.has(c))throw new N("bad-type",`Cannot render ${c}.`,"usage",`Types: ${[...i].join(", ")}.`);return[...e]}export async function exportProject(e){const i=Ze(e.types);e.name!==void 0&&He(e.name);const c=e.items??[],r=c.length>0,p=d=>c.some(g=>z({id:d,path:d},g)),m=[],f=[],a=[],o=()=>Qe.open({root:e.root,...e.gpu===void 0?{}:{gpu:e.gpu},...e.consoleLimit===void 0?{}:{consoleLimit:e.consoleLimit}});let u=await o();try{const d=u.prepared,g=d.docs.filter(s=>!r||p(s.place)),C=d.sheets.filter(s=>!r||p(s.place)),k=c.filter(s=>!d.docs.some(t=>z({id:t.place,path:t.place},s))&&!d.sheets.some(t=>z({id:t.place,path:t.place},s)));for(const s of k)if(!d.pieces.some(t=>ne({id:t.id,path:t.place},s)))throw new N("no-item",`No item ${s}.`,"not-found",`Items: ${[...d.pieces.map(t=>t.id),...d.docs.map(t=>t.place),...d.sheets.map(t=>t.place)].join(", ")||"none"}.`);const O=r&&k.length===0,E=i?.filter(s=>s in te),_=O?[]:d.pieces.filter(s=>k.length===0||k.some(t=>ne({id:s.id,path:s.place},t))),T=i?.includes("csv")===!0?_.filter(s=>s.matrix!==void 0):[];if(i?.includes("csv")===!0&&k.length>0&&T.length===0)throw new N("bad-type",`${k.join(", ")} has no slots (matrix.slots), so there is no table of ads to write as csv.`,"usage","csv is a batch's table of ads, or a sheet's rows.");let v=[...d.problems];const A=new Ke(u.consoleLimit),ce=new Set([...d.docs.map(s=>s.file),...d.sheets.flatMap(s=>s.files)]),le=s=>s.where?.file!==void 0&&ce.has(s.where.file),q=s=>s.filter(t=>t.level==="error"&&!le(t)).length;if(!O&&(E?.length!==0||T.length>0)&&(d.pieces.length>0||q(d.problems)>0)){e.log?.("Checking…");const s=()=>tt(u,e.root,k,e.combos);let t=await s();const K=e.index===!1?[]:Be(t.results);if(K.length>0){const n=await Ge(d.root,K,nt(e.log),e.signal);a.push(...n.failed.map(l=>({file:l.need.file,error:l.error}))),n.done.length>0&&(await u.close(),u=await o(),t=await s())}v=t.problems,A.addReport(t.console);const U=q(t.problems);if(U>0)throw new N("check-failed",`The check found ${W(U,"must-fix problem")}, so nothing is rendered.`,"failed","allyhub check lists them; fix them, then render.");for(const n of T){const l=performance.now(),y=qe(n.id),P=We(n,t.plans,u.prepared.media,et(e.root,e.out),e.name);await L(Z($(e.out,y)),{recursive:!0}),await M($(e.out,y),ze(P));const S=t.targets.filter(w=>w.piece===n.id).length;P.length<S&&e.log?.(`${y}: ${W(S-P.length,"ad")} not listed, which did not load (allyhub check says why).`),m.push(await F(e.out,y,n.id,"csv",l))}const x=[],D=new Set;for(const n of t.targets){const l=u.prepared.pieces.find(h=>h.id===n.piece);if(!l)continue;if(!r&&l.options.deliverable===!1){D.add(n.piece);continue}const y=l.kind==="video"?"video":"paged",P=t.results.find(h=>h.piece===n.piece&&Y(h.combo)===n.key&&h.format===n.format),S=t.plans.find(h=>h.piece===n.piece&&Y(h.combo)===n.key&&h.format===n.format),w=P?.timeline?(P.timeline.audio.speech?.length??0)>0:S?.parts.some(h=>h.speech!==void 0)??!1,j={piece:n.piece,output:n.output,combo:n.combo,format:n.format,...n.id===void 0?{}:{id:n.id}};for(const h of E??Re[y]){const b=Ve({kind:y,speech:w},h);if(!(b?.code==="bad_type"&&!r)){if(b&&b.code!=="no_speech")throw new N("bad-type",`${ie(j)}: ${b.message}`,"usage",b.hint);x.push({target:j,type:h,...b?{refused:{name:se(j,h),piece:j.piece,type:h,code:"no-speech",message:`${ie(j)}: ${b.message}`,...b.hint?{hint:b.hint}:{}}}:{}})}}}if(D.size>0&&e.log?.(`Not rendered, shown only inside another video (deliverable: false): ${[...D].join(", ")}. Name one to render it.`),x.some(n=>re(n.type)||n.type==="wav")){await Te();for(const n of new Set(x.map(l=>l.type)))await Oe(n,e.encode?.codec)}const B=Je(x,e.name);x.forEach((n,l)=>{n.refused&&(n.refused.name=B[l]??n.refused.name)});const G=[],I=new Array(x.length).fill(0),R=(n,l)=>{I[n]=Math.max(I[n]??0,l),e.onProgress?.(I.reduce((y,P)=>y+P,0)/x.length)};let Q=0,de=0;const fe=async()=>{for(let n=Q++;n<x.length;n=Q++){const l=x[n];if(!l)continue;const y=B[n]??se(l.target,l.type);if(l.refused){f.push(l.refused),R(n,1);continue}const P=performance.now(),S=await Xe.open({root:e.root,session:u,item:l.target.piece,combos:[l.target.combo],purpose:"render"});try{const w=await exportVersion(S,l.type,$(e.out,y),{...e,onProgress:b=>{R(n,b)}}),j=(await Promise.all(w.files.map(b=>X(b)))).reduce((b,pe)=>b+pe.size,0),h=Math.round((performance.now()-P)/10)/100;m.push({...w,name:ae(ee(e.out,w.files[0]??"")),path:w.files[0]??$(e.out,y),piece:l.target.piece,type:l.type,combo:l.target.combo,key:Y(l.target.combo),format:l.target.format,bytes:j,seconds:h}),e.log?.(`[${String(++de)}/${String(x.length)}] ${y} (${h.toFixed(1)} s)`)}catch(w){if(!(w instanceof ke))throw w;f.push({name:y,piece:l.target.piece,type:l.type,code:w.code,message:w.message,...w.hint?{hint:w.hint}:{}})}finally{G.push(...await S.problems()),A.add(l.target,await S.console()),await S.close(),R(n,1)}}};x.length>0&&e.log?.(`Rendering ${W(x.length,"file")}…`),await Promise.all(Array.from({length:exportsAtOnce(x.length)},fe)),v=oe([...v,...G])}const H=s=>d.problems.find(t=>t.level==="error"&&t.where?.file!==void 0&&s.includes(t.where.file));for(const s of[...g,...C]){const t=H("files"in s?s.files:[s.file]);t&&f.push({name:s.place,piece:s.place,type:"files"in s?"xlsx":"pdf",code:"check-failed",message:`${t.where?.file??s.place}: ${t.message}`,hint:"Fix it, then render again."})}const J=s=>s.filter(t=>H("files"in t?t.files:[t.file])===void 0);return m.push(...await st(e.root,J(g),i,e.out,e.log),...await ot(e.root,J(C),i,e.out,e.log)),{out:e.out,files:m,failed:f,problems:v,console:A.report(),unindexed:a}}finally{await u.close()}}const ae=e=>e.split(he).join("/");function et(e,i){const c=ee(e,i);return c===""?".":c.startsWith("..")||ue(c)?i:ae(c)}async function tt(e,i,c,r){const p=[];for(const o of c.length>0?c:[void 0])p.push(await Ye({dir:i,session:e,facts:!1,...o===void 0?{}:{piece:o},...r?{combos:[...r]}:{}}));const m=new Set,f=p.flatMap(o=>o.targets).filter(o=>{const u=`${o.piece}\0${o.key}\0${o.format}`;return m.has(u)?!1:(m.add(u),!0)}),a=oe(p.flatMap(o=>o.problems));return{targets:f,results:p.flatMap(o=>o.results),plans:p.flatMap(o=>o.plans),problems:a,errors:a.filter(o=>o.level==="error").length,console:Ue(e.consoleLimit,...p.map(o=>o.console))}}function nt(e){let i="";return c=>{const r=c.status==="failed"?`Could not index ${c.file}: ${c.message}`:c.message;c.status==="running"&&c.share!==void 0||r!==i&&(i=r,e?.(r))}}async function F(e,i,c,r,p){const m=$(e,i);return{files:[m],name:i,path:m,piece:c,type:r,bytes:(await X(m)).size,seconds:Math.round((performance.now()-p)/10)/100}}async function st(e,i,c,r,p){const m=(c??["pdf"]).filter(a=>DOC_TYPES.includes(a)),f=[];for(const a of i){if(m.length===0)break;p?.(`Rendering ${a.file}…`);const o=performance.now();if(m.includes("md")){const g=await V($(e,a.file),"utf8");await L($(r,a.place),{recursive:!0}),await M($(r,a.place,"doc.md"),we(ge(g).blocks)),f.push(await F(r,`${a.place}/doc.md`,a.place,"md",o))}const u=m.filter(g=>g!=="md");if(u.length===0)continue;const d=await Ne({root:e,doc:{file:a.file,dir:a.dir,path:a.place,title:a.title},out:$(r,a.place),types:u});for(const g of d)f.push(await F(r,`${a.place}/${g}`,a.place,g.endsWith(".png")?"png":"pdf",o))}return f}async function ot(e,i,c,r,p){const m=(c??["xlsx"]).filter(a=>SHEET_TYPES.includes(a)),f=[];for(const a of i){if(m.length===0)break;p?.(`Writing ${a.file}…`);const o=performance.now(),u=await V($(e,a.file),"utf8"),d=await V($(e,a.dir,Ae),"utf8").catch(()=>{}),{data:g}=Fe(u),C=d===void 0?{columns:{}}:_e(d).spec;await L($(r,a.place),{recursive:!0});for(const k of m){const O=`${a.place}/sheet.${k}`,E=$(r,O);if(k==="csv")await M(E,u);else if(k==="md")await M(E,Le(g,C));else if(k==="json")await M(E,`${JSON.stringify(ve(g,C),null,2)}
|
|
3
|
-
`);else{const{xlsxOf:_}=await import("@allyhub-next/sheet/xlsx"),
|
|
2
|
+
import{mkdir as F,readFile as W,stat as Z,writeFile as T}from"node:fs/promises";import{cpus as ue}from"node:os";import{basename as he,dirname as ee,isAbsolute as ge,join as g,relative as te,sep as we}from"node:path";import{parseDoc as be,markdownOf as ye}from"@allyhub-next/doc";import{codeOf as ke,fontsDigest as xe}from"@allyhub-next/build";import{RenderError as $e,VIDEO_TYPES as Pe,renderCaptions as Se,renderCover as Ee,renderPdf as Ce,renderPng as Me,renderPptx as je,renderVideo as Oe,mixSound as Te,requireEncoder as Ne,requireFfmpeg as ve}from"@allyhub-next/render";import{renderDoc as Le}from"@allyhub-next/render/doc";import{jsonOf as _e,markdownOf as De,readSheet as Fe,readSpec as Ae}from"@allyhub-next/sheet";import{CACHE_DIR as Ie,SHEET_SPEC as Re}from"@allyhub-next/formats";import{buildModule as Ye}from"@allyhub-next/model/build";import{graphicsPage as Ve,stageIdentity as ze}from"@allyhub-next/stage";import{DEFAULT_TYPES as He,FILE_TYPES as ne,comboKey as q,exportProblem as We,pieceIs as A,pieceNamed as se}from"@allyhub-next/video-core";import{runCheck as qe}from"@allyhub-next/check";import{batchCsv as Be,batchRows as Je}from"./batch.js";import{batchName as Ke,checkName as Ue,exportName as oe,exportNames as Ge}from"./names.js";import{ConsolePool as Qe,mergeConsole as Xe,dedupe as ie,indexNeeds as Ze,makeIndex as et,CheckSession as tt,OpenedVersion as nt,ProjectError as v,versionLabel as re}from"@allyhub-next/project";const ae=e=>Pe.includes(e);export async function exportVersion(e,o,c,r={}){await F(ee(c),{recursive:!0});const p={page:e.graphics(),target:e.target,look:e.look,media:e.media,out:c};if(o==="wav"){const f=await Te({timeline:e.timeline,sound:await e.sound(),out:c});return r.onProgress?.(1),{files:[c],duration:Math.round(e.timeline.duration*e.timeline.fps)/e.timeline.fps,...f.loudness?{loudness:f.loudness}:{},master:{...f}}}if(ae(o)&&(o!=="png"||e.piece.kind==="video")){const f=e.prepared,a=await xe(f.root,f.files,f.fonts),i=await Oe({target:e.target,look:e.look,media:e.media,pages:[e.graphics()],openPage:async()=>{const u=await e.session.open(e.piece,e.target,"render");return Ve(u.stage,{gpu:e.session.gpu})},...o==="gif"?{}:{sound:await e.sound()},out:c,type:o,...r.encode?{encode:r.encode}:{},...r.workers===void 0?{}:{workers:r.workers},...r.onProgress?{onProgress:r.onProgress}:{},code:await ke(f,e.piece,ze(a)),...r.partCache===!1?{partCache:!1}:{}});return{files:i.files??[i.out],duration:i.duration,parts:i.parts,...i.junctions?{junctions:i.junctions}:{},...i.loudness?{loudness:i.loudness}:{},...i.master?{master:{...i.master}}:{},timings:i.timings}}const m=o==="srt"||o==="vtt"?await Se({...p,type:o,...r.captions?{captions:r.captions}:{}}):o==="pdf"?await Ce(p):o==="pptx"?await je(p):o==="png"?await Me(p):await Ee(p);return r.onProgress?.(1),{files:m.files??[m.out]}}export const exportsAtOnce=e=>Math.max(1,Math.min(e,Math.floor(ue().length/4))),DOC_TYPES=["pdf","png","md"],SHEET_TYPES=["xlsx","csv","md","json"],MODEL_TYPES=["glb"];const B=(e,o)=>`${String(e)} ${o}${e===1?"":"s"}`;function st(e){if(e===void 0)return;const o=new Set([...Object.keys(ne),...DOC_TYPES,...SHEET_TYPES,...MODEL_TYPES]);for(const c of e)if(!o.has(c))throw new v("bad-type",`Cannot render ${c}.`,"usage",`Types: ${[...o].join(", ")}.`);return[...e]}export async function exportProject(e){const o=st(e.types);e.name!==void 0&&Ue(e.name);const c=e.items??[],r=c.length>0,p=d=>c.some(w=>A({id:d,path:d},w)),m=[],f=[],a=[],i=()=>tt.open({root:e.root,...e.gpu===void 0?{}:{gpu:e.gpu},...e.consoleLimit===void 0?{}:{consoleLimit:e.consoleLimit}});let u=await i();try{const d=u.prepared,w=d.docs.filter(t=>!r||p(t.place)),j=d.sheets.filter(t=>!r||p(t.place)),E=d.items.filter(t=>t.kind==="model"&&(!r||p(t.dir))),$=c.filter(t=>!d.items.some(n=>n.kind==="model"&&A({id:n.dir,path:n.dir},t))&&!d.docs.some(n=>A({id:n.place,path:n.place},t))&&!d.sheets.some(n=>A({id:n.place,path:n.place},t)));for(const t of $)if(!d.pieces.some(n=>se({id:n.id,path:n.place},t)))throw new v("no-item",`No item ${t}.`,"not-found",`Items: ${[...d.pieces.map(n=>n.id),...d.docs.map(n=>n.place),...d.sheets.map(n=>n.place),...d.items.filter(n=>n.kind==="model").map(n=>n.dir)].join(", ")||"none"}.`);const C=r&&$.length===0,_=o?.filter(t=>t in ne),I=C?[]:d.pieces.filter(t=>$.length===0||$.some(n=>se({id:t.id,path:t.place},n))),R=o?.includes("csv")===!0?I.filter(t=>t.matrix!==void 0):[];if(o?.includes("csv")===!0&&$.length>0&&R.length===0)throw new v("bad-type",`${$.join(", ")} has no slots (matrix.slots), so there is no table of ads to write as csv.`,"usage","csv is a batch's table of ads, or a sheet's rows.");let D=[...d.problems];const Y=new Qe(u.consoleLimit),le=new Set([...d.docs.map(t=>t.file),...d.sheets.flatMap(t=>t.files)]),de=t=>t.where?.file!==void 0&&le.has(t.where.file),J=t=>t.filter(n=>n.level==="error"&&!de(n)).length;if(!C&&(_?.length!==0||R.length>0)&&(d.pieces.length>0||J(d.problems)>0)){e.log?.("Checking…");const t=()=>it(u,e.root,$,e.combos);let n=await t();const N=e.index===!1?[]:Ze(n.results);if(N.length>0){const s=await et(d.root,N,rt(e.log),e.signal);a.push(...s.failed.map(l=>({file:l.need.file,error:l.error}))),s.done.length>0&&(await u.close(),u=await i(),n=await t())}D=n.problems,Y.addReport(n.console);const O=J(n.problems);if(O>0)throw new v("check-failed",`The check found ${B(O,"must-fix problem")}, so nothing is rendered.`,"failed","allyhub check lists them; fix them, then render.");for(const s of R){const l=performance.now(),k=Ke(s.id),P=Je(s,n.plans,u.prepared.media,ot(e.root,e.out),e.name);await F(ee(g(e.out,k)),{recursive:!0}),await T(g(e.out,k),Be(P));const S=n.targets.filter(b=>b.piece===s.id).length;P.length<S&&e.log?.(`${k}: ${B(S-P.length,"ad")} not listed, which did not load (allyhub check says why).`),m.push(await L(e.out,k,s.id,"csv",l))}const x=[],V=new Set;for(const s of n.targets){const l=u.prepared.pieces.find(h=>h.id===s.piece);if(!l)continue;if(!r&&l.options.deliverable===!1){V.add(s.piece);continue}const k=l.kind==="video"?"video":"paged",P=n.results.find(h=>h.piece===s.piece&&q(h.combo)===s.key&&h.format===s.format),S=n.plans.find(h=>h.piece===s.piece&&q(h.combo)===s.key&&h.format===s.format),b=P?.timeline?(P.timeline.audio.speech?.length??0)>0:S?.parts.some(h=>h.speech!==void 0)??!1,M={piece:s.piece,output:s.output,combo:s.combo,format:s.format,...s.id===void 0?{}:{id:s.id}};for(const h of _??He[k]){const y=We({kind:k,speech:b},h);if(!(y?.code==="bad_type"&&!r)){if(y&&y.code!=="no_speech")throw new v("bad-type",`${re(M)}: ${y.message}`,"usage",y.hint);x.push({target:M,type:h,...y?{refused:{name:oe(M,h),piece:M.piece,type:h,code:"no-speech",message:`${re(M)}: ${y.message}`,...y.hint?{hint:y.hint}:{}}}:{}})}}}if(V.size>0&&e.log?.(`Not rendered, shown only inside another video (deliverable: false): ${[...V].join(", ")}. Name one to render it.`),x.some(s=>ae(s.type)||s.type==="wav")){await ve();for(const s of new Set(x.map(l=>l.type)))await Ne(s,e.encode?.codec)}const G=Ge(x,e.name);x.forEach((s,l)=>{s.refused&&(s.refused.name=G[l]??s.refused.name)});const Q=[],z=new Array(x.length).fill(0),H=(s,l)=>{z[s]=Math.max(z[s]??0,l),e.onProgress?.(z.reduce((k,P)=>k+P,0)/x.length)};let X=0,fe=0;const pe=async()=>{for(let s=X++;s<x.length;s=X++){const l=x[s];if(!l)continue;const k=G[s]??oe(l.target,l.type);if(l.refused){f.push(l.refused),H(s,1);continue}const P=performance.now(),S=await nt.open({root:e.root,session:u,item:l.target.piece,combos:[l.target.combo],purpose:"render"});try{const b=await exportVersion(S,l.type,g(e.out,k),{...e,onProgress:y=>{H(s,y)}}),M=(await Promise.all(b.files.map(y=>Z(y)))).reduce((y,me)=>y+me.size,0),h=Math.round((performance.now()-P)/10)/100;m.push({...b,name:ce(te(e.out,b.files[0]??"")),path:b.files[0]??g(e.out,k),piece:l.target.piece,type:l.type,combo:l.target.combo,key:q(l.target.combo),format:l.target.format,bytes:M,seconds:h}),e.log?.(`[${String(++fe)}/${String(x.length)}] ${k} (${h.toFixed(1)} s)`)}catch(b){if(!(b instanceof $e))throw b;f.push({name:k,piece:l.target.piece,type:l.type,code:b.code,message:b.message,...b.hint?{hint:b.hint}:{}})}finally{Q.push(...await S.problems()),Y.add(l.target,await S.console()),await S.close(),H(s,1)}}};x.length>0&&e.log?.(`Rendering ${B(x.length,"file")}…`),await Promise.all(Array.from({length:exportsAtOnce(x.length)},pe)),D=ie([...D,...Q])}const K=t=>d.problems.find(n=>n.level==="error"&&n.where?.file!==void 0&&t.includes(n.where.file));for(const t of[...w,...j]){const n=K("files"in t?t.files:[t.file]);n&&f.push({name:t.place,piece:t.place,type:"files"in t?"xlsx":"pdf",code:"check-failed",message:`${n.where?.file??t.place}: ${n.message}`,hint:"Fix it, then render again."})}const U=t=>t.filter(n=>K("files"in n?n.files:[n.file])===void 0);if(m.push(...await at(e.root,U(w),o,e.out,e.log),...await ct(e.root,U(j),o,e.out,e.log)),o===void 0||o.includes("glb"))for(const t of E){e.log?.(`Building ${t.entry}…`);const n=performance.now(),N=`${t.dir}/${he(t.dir)}.glb`;try{await Ye(g(e.root,t.entry),{root:e.root,out:g(e.out,N),cache:g(e.root,Ie,"model"),log:()=>{}}),m.push(await L(e.out,N,t.dir,"glb",n))}catch(O){f.push({name:t.dir,piece:t.dir,type:"glb",code:"model-failed",message:`${t.entry}: ${O instanceof Error?O.message:String(O)}`,hint:"Fix it, then render again."})}}return{out:e.out,files:m,failed:f,problems:D,console:Y.report(),unindexed:a}}finally{await u.close()}}const ce=e=>e.split(we).join("/");function ot(e,o){const c=te(e,o);return c===""?".":c.startsWith("..")||ge(c)?o:ce(c)}async function it(e,o,c,r){const p=[];for(const i of c.length>0?c:[void 0])p.push(await qe({dir:o,session:e,facts:!1,...i===void 0?{}:{piece:i},...r?{combos:[...r]}:{}}));const m=new Set,f=p.flatMap(i=>i.targets).filter(i=>{const u=`${i.piece}\0${i.key}\0${i.format}`;return m.has(u)?!1:(m.add(u),!0)}),a=ie(p.flatMap(i=>i.problems));return{targets:f,results:p.flatMap(i=>i.results),plans:p.flatMap(i=>i.plans),problems:a,errors:a.filter(i=>i.level==="error").length,console:Xe(e.consoleLimit,...p.map(i=>i.console))}}function rt(e){let o="";return c=>{const r=c.status==="failed"?`Could not index ${c.file}: ${c.message}`:c.message;c.status==="running"&&c.share!==void 0||r!==o&&(o=r,e?.(r))}}async function L(e,o,c,r,p){const m=g(e,o);return{files:[m],name:o,path:m,piece:c,type:r,bytes:(await Z(m)).size,seconds:Math.round((performance.now()-p)/10)/100}}async function at(e,o,c,r,p){const m=(c??["pdf"]).filter(a=>DOC_TYPES.includes(a)),f=[];for(const a of o){if(m.length===0)break;p?.(`Rendering ${a.file}…`);const i=performance.now();if(m.includes("md")){const w=await W(g(e,a.file),"utf8");await F(g(r,a.place),{recursive:!0}),await T(g(r,a.place,"doc.md"),ye(be(w).blocks)),f.push(await L(r,`${a.place}/doc.md`,a.place,"md",i))}const u=m.filter(w=>w!=="md");if(u.length===0)continue;const d=await Le({root:e,doc:{file:a.file,dir:a.dir,path:a.place,title:a.title},out:g(r,a.place),types:u});for(const w of d)f.push(await L(r,`${a.place}/${w}`,a.place,w.endsWith(".png")?"png":"pdf",i))}return f}async function ct(e,o,c,r,p){const m=(c??["xlsx"]).filter(a=>SHEET_TYPES.includes(a)),f=[];for(const a of o){if(m.length===0)break;p?.(`Writing ${a.file}…`);const i=performance.now(),u=await W(g(e,a.file),"utf8"),d=await W(g(e,a.dir,Re),"utf8").catch(()=>{}),{data:w}=Fe(u),j=d===void 0?{columns:{}}:Ae(d).spec;await F(g(r,a.place),{recursive:!0});for(const E of m){const $=`${a.place}/sheet.${E}`,C=g(r,$);if(E==="csv")await T(C,u);else if(E==="md")await T(C,De(w,j));else if(E==="json")await T(C,`${JSON.stringify(_e(w,j),null,2)}
|
|
3
|
+
`);else{const{xlsxOf:_}=await import("@allyhub-next/sheet/xlsx"),I=(await import("exceljs")).default;await T(C,await _(I,w,j,{title:a.title??a.place.split("/").pop()??"Sheet"}))}f.push(await L(r,$,a.place,E,i))}}return f}
|
|
@@ -29,6 +29,11 @@ export declare const ITEM_KINDS: {
|
|
|
29
29
|
readonly editor: "scenery";
|
|
30
30
|
readonly name: "3D scenery";
|
|
31
31
|
};
|
|
32
|
+
readonly model: {
|
|
33
|
+
readonly entries: readonly string[];
|
|
34
|
+
readonly editor: "scenery";
|
|
35
|
+
readonly name: "3D model";
|
|
36
|
+
};
|
|
32
37
|
readonly website: {
|
|
33
38
|
readonly entries: readonly ["astro.config.mjs", "astro.config.ts", "astro.config.mts", "astro.config.js"];
|
|
34
39
|
readonly editor: "website";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{baseOf as p,dirOf as
|
|
2
|
+
import{baseOf as p,dirOf as l,unscanned as u,within as f}from"./layout.js";export const CODE_EXTENSIONS=["ts","tsx","mts","js","jsx","mjs"];const d=e=>CODE_EXTENSIONS.map(n=>`${e}.${n}`);export const EDITORS=["video","slides","doc","sheet","scenery","website"],ITEM_KINDS={video:{entries:d("video"),editor:"video",name:"video"},slides:{entries:d("slides"),editor:"slides",name:"slides"},doc:{entries:["doc.mdx"],editor:"doc",name:"doc"},sheet:{entries:["sheet.csv"],editor:"sheet",name:"sheet"},scenery:{entries:d("scenery"),editor:"scenery",name:"3D scenery"},model:{entries:d("model"),editor:"scenery",name:"3D model"},website:{entries:["astro.config.mjs","astro.config.ts","astro.config.mts","astro.config.js"],editor:"website",name:"website"}},KINDS=Object.keys(ITEM_KINDS);const h=new Map(KINDS.flatMap(e=>ITEM_KINDS[e].entries.map(n=>[n,e])));export function entryKind(e){return h.get(p(e))}export function scanItems(e){const n=[...e].filter(t=>!u(t)).sort(),o=[],i=new Map;for(const t of n){if(entryKind(t)===void 0)continue;const s=l(t);if(s===""){o.push({code:"at-root",entry:t});continue}i.set(s,[...i.get(s)??[],t])}const c=[];for(const[t,s]of i){const[r]=s;if(s.length>1||r===void 0){o.push({code:"two-entries",dir:t,entries:s});continue}const m=entryKind(r);m&&c.push({kind:m,dir:t,entry:r})}c.sort((t,s)=>t.dir.localeCompare(s.dir));const a=[];for(const t of c){const s=a.find(r=>f(t.dir,r.dir));s?o.push({code:"nested",dir:t.dir,inside:s.dir}):a.push(t)}return{items:a,problems:o}}export function itemFor(e,n){let o;for(const i of n)f(e,i.dir)&&(!o||i.dir.length>o.dir.length)&&(o=i);return o}export function itemManifest(){return{version:1,kinds:KINDS.map(e=>({kind:e,name:ITEM_KINDS[e].name,editor:ITEM_KINDS[e].editor,patterns:ITEM_KINDS[e].entries.map(n=>`**/${n}`)})),ignore:["**/.*/**","**/node_modules/**"]}}
|
|
@@ -18,6 +18,8 @@ export declare const LOCAL_DIR = ".allyhub";
|
|
|
18
18
|
export declare const WORK_DIR = ".allyhub/work";
|
|
19
19
|
/** Reference videos measured (allyhub reference), a folder each. */
|
|
20
20
|
export declare const REFERENCE_DIR = ".allyhub/work/reference";
|
|
21
|
+
/** A running `allyhub dev`'s note: its page's address and its process, so another run opens that page. */
|
|
22
|
+
export declare const DEV_FILE = ".allyhub/dev.json";
|
|
21
23
|
/** Renders and exports. */
|
|
22
24
|
export declare const OUT_DIR = ".allyhub/out";
|
|
23
25
|
/** What the tools rebuild. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
export const ASSETS_DIR="assets",MEDIA_DIR="assets/media",DATA_DIR="assets/data",TEXT_DIR="assets/text",FONTS_DIR="assets/fonts",MODELS_DIR="assets/media/models",ENVIRONMENTS_DIR="assets/media/environments",TEXTURES_DIR="assets/media/textures",COMPONENTS_DIR="components",SCENERIES_DIR="sceneries",LOCAL_DIR=".allyhub",WORK_DIR=".allyhub/work",REFERENCE_DIR=".allyhub/work/reference",OUT_DIR=".allyhub/out",CACHE_DIR=".allyhub/cache",BAKE_DIR=".allyhub/cache/bake",TRASH_DIR=".allyhub/trash",MEMORY_DIR=".allyhub/memory",PACKAGE_FILE="package.json",TSCONFIG_FILE="tsconfig.json",AGENTS_FILE="AGENTS.md",CLAUDE_FILE="CLAUDE.md",CONFIG_FILES=["allyhub.config.ts","allyhub.config.mts","allyhub.config.js","allyhub.config.mjs"],GITIGNORE=`node_modules/
|
|
2
|
+
export const ASSETS_DIR="assets",MEDIA_DIR="assets/media",DATA_DIR="assets/data",TEXT_DIR="assets/text",FONTS_DIR="assets/fonts",MODELS_DIR="assets/media/models",ENVIRONMENTS_DIR="assets/media/environments",TEXTURES_DIR="assets/media/textures",COMPONENTS_DIR="components",SCENERIES_DIR="sceneries",LOCAL_DIR=".allyhub",WORK_DIR=".allyhub/work",REFERENCE_DIR=".allyhub/work/reference",DEV_FILE=".allyhub/dev.json",OUT_DIR=".allyhub/out",CACHE_DIR=".allyhub/cache",BAKE_DIR=".allyhub/cache/bake",TRASH_DIR=".allyhub/trash",MEMORY_DIR=".allyhub/memory",PACKAGE_FILE="package.json",TSCONFIG_FILE="tsconfig.json",AGENTS_FILE="AGENTS.md",CLAUDE_FILE="CLAUDE.md",CONFIG_FILES=["allyhub.config.ts","allyhub.config.mts","allyhub.config.js","allyhub.config.mjs"],GITIGNORE=`node_modules/
|
|
3
3
|
${LOCAL_DIR}/
|
|
4
4
|
.playwright-cli/
|
|
5
5
|
`;export function unscanned(t){return t.split("/").some(e=>e.startsWith(".")||e==="node_modules")}export function projectPath(t){return t.replaceAll("\\","/").replace(/^(?:\.\/)+/u,"").replace(/\/+$/u,"").replace(/\/{2,}/gu,"/")}export function dirOf(t){const e=t.lastIndexOf("/");return e<0?"":t.slice(0,e)}export function baseOf(t){return t.slice(t.lastIndexOf("/")+1)}export function within(t,e){return e===""||t===e||t.startsWith(`${e}/`)}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* A built model as plain data: what `allyhub model inspect` and `model build`
|
|
2
|
+
* A built model as plain data: what `allyhub 3d-model inspect` and `model build`
|
|
3
3
|
* print. Bounds are world-space surface bounds in Blender Z-up metres; a
|
|
4
4
|
* transform-only object's are null. Textures name their image and where it
|
|
5
5
|
* comes from, never its pixels.
|
|
@@ -36,6 +36,7 @@ export declare const CardItemSchema: z.ZodObject<{
|
|
|
36
36
|
doc: "doc";
|
|
37
37
|
sheet: "sheet";
|
|
38
38
|
scenery: "scenery";
|
|
39
|
+
model: "model";
|
|
39
40
|
website: "website";
|
|
40
41
|
}>;
|
|
41
42
|
dir: z.ZodString;
|
|
@@ -56,6 +57,7 @@ export declare const CardSchema: z.ZodObject<{
|
|
|
56
57
|
doc: "doc";
|
|
57
58
|
sheet: "sheet";
|
|
58
59
|
scenery: "scenery";
|
|
60
|
+
model: "model";
|
|
59
61
|
website: "website";
|
|
60
62
|
}>;
|
|
61
63
|
dir: z.ZodString;
|
|
@@ -87,6 +89,7 @@ export declare const CardSchema: z.ZodObject<{
|
|
|
87
89
|
doc: "doc";
|
|
88
90
|
sheet: "sheet";
|
|
89
91
|
scenery: "scenery";
|
|
92
|
+
model: "model";
|
|
90
93
|
website: "website";
|
|
91
94
|
}>;
|
|
92
95
|
dir: z.ZodString;
|
|
@@ -25,6 +25,10 @@ export declare const ORGANIZATION_HEADER = "x-allyhub-organization";
|
|
|
25
25
|
export declare const DEVICES_PAGE_PATH = "/devices";
|
|
26
26
|
/** `GET`: the computers signed in as the person (a session's alone); `DELETE <path>/<id>` signs one out. */
|
|
27
27
|
export declare const DEVICES_PATH = "/api/account/devices";
|
|
28
|
+
/** `GET`, from the account site: everything kept about the person, as a file. */
|
|
29
|
+
export declare const ACCOUNT_EXPORT_PATH = "/api/account/export";
|
|
30
|
+
/** `POST`, from the account site: mails the link that deletes the account, unless something stands in the way. */
|
|
31
|
+
export declare const ACCOUNT_DELETE_PATH = "/api/account/delete";
|
|
28
32
|
export declare const DevicesSchema: z.ZodObject<{
|
|
29
33
|
devices: z.ZodArray<z.ZodObject<{
|
|
30
34
|
id: z.ZodString;
|
|
@@ -34,6 +38,19 @@ export declare const DevicesSchema: z.ZodObject<{
|
|
|
34
38
|
}, z.core.$strip>>;
|
|
35
39
|
}, z.core.$strip>;
|
|
36
40
|
export type Devices = z.infer<typeof DevicesSchema>;
|
|
41
|
+
/**
|
|
42
|
+
* `POST { to }` with a computer's sign-in (the CLI's client): a link,
|
|
43
|
+
* `{ url }`, that signs a browser in as the person once, within three
|
|
44
|
+
* minutes, then opens `to`, a page of the account site (`/plan?view=…`).
|
|
45
|
+
*/
|
|
46
|
+
export declare const BROWSER_LINK_PATH = "/api/account/browser-link";
|
|
47
|
+
export declare const BrowserLinkRequestSchema: z.ZodObject<{
|
|
48
|
+
to: z.ZodString;
|
|
49
|
+
}, z.core.$strict>;
|
|
50
|
+
export declare const BrowserLinkSchema: z.ZodObject<{
|
|
51
|
+
url: z.ZodURL;
|
|
52
|
+
}, z.core.$strip>;
|
|
53
|
+
export type BrowserLink = z.infer<typeof BrowserLinkSchema>;
|
|
37
54
|
/** The credentials file, relative to the home folder (ALLYHUB_HOME moves it). */
|
|
38
55
|
export declare const CREDENTIALS_FILE = ".allyhub/credentials.json";
|
|
39
56
|
/** A token endpoint's answer (RFC 6749 5.1). */
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{z as e}from"zod";export const AuthServerSchema=e.object({issuer:e.url(),authorization_endpoint:e.url(),token_endpoint:e.url(),device_authorization_endpoint:e.url(),revocation_endpoint:e.url(),code_challenge_methods_supported:e.array(e.string()).refine(t=>t.includes("S256"),{message:"The server must take S256 PKCE challenges."})}),CLIENT_ID="allyhub-cli",ISSUER_PATH="/api/auth",METADATA_PATH=`/.well-known/oauth-authorization-server${ISSUER_PATH}`,SCOPES="openid profile email offline_access",ACCOUNT_PATH="/api/account",ORGANIZATION_HEADER="x-allyhub-organization",DEVICES_PAGE_PATH="/devices",DEVICES_PATH="/api/account/devices",DevicesSchema=e.object({devices:e.array(e.object({id:e.string(),client:e.string(),signedInAt:e.iso.datetime(),lastActiveAt:e.iso.datetime()}))}),CREDENTIALS_FILE=".allyhub/credentials.json",TokenResponseSchema=e.object({access_token:e.string().min(1),token_type:e.string(),expires_in:e.number().positive(),refresh_token:e.string().min(1).optional(),scope:e.string().optional()}),OAuthErrorSchema=e.object({error:e.string(),error_description:e.string().optional()}),DeviceAuthorizationSchema=e.object({device_code:e.string().min(1),user_code:e.string().min(1),verification_uri:e.url(),verification_uri_complete:e.url().optional(),expires_in:e.number().positive(),interval:e.number().positive().optional()}),AccountSchema=e.strictObject({id:e.string().min(1),email:e.email(),name:e.string().optional(),organization:e.strictObject({id:e.string().min(1),name:e.string()}).optional()}),CredentialsFileSchema=e.strictObject({version:e.literal(1),url:e.url(),issuer:e.url(),account:AccountSchema,refreshToken:e.string().min(1),access:e.strictObject({token:e.string().min(1),expiresAt:e.iso.datetime({offset:!0})}).optional(),since:e.iso.datetime({offset:!0})}),TokenOutputSchema=e.strictObject({accessToken:e.string().min(1),expiresAt:e.iso.datetime({offset:!0}),account:AccountSchema}),bearer=t=>`Bearer ${t.accessToken}`;
|
|
2
|
+
import{z as e}from"zod";export const AuthServerSchema=e.object({issuer:e.url(),authorization_endpoint:e.url(),token_endpoint:e.url(),device_authorization_endpoint:e.url(),revocation_endpoint:e.url(),code_challenge_methods_supported:e.array(e.string()).refine(t=>t.includes("S256"),{message:"The server must take S256 PKCE challenges."})}),CLIENT_ID="allyhub-cli",ISSUER_PATH="/api/auth",METADATA_PATH=`/.well-known/oauth-authorization-server${ISSUER_PATH}`,SCOPES="openid profile email offline_access",ACCOUNT_PATH="/api/account",ORGANIZATION_HEADER="x-allyhub-organization",DEVICES_PAGE_PATH="/devices",DEVICES_PATH="/api/account/devices",ACCOUNT_EXPORT_PATH="/api/account/export",ACCOUNT_DELETE_PATH="/api/account/delete",DevicesSchema=e.object({devices:e.array(e.object({id:e.string(),client:e.string(),signedInAt:e.iso.datetime(),lastActiveAt:e.iso.datetime()}))}),BROWSER_LINK_PATH="/api/account/browser-link",BrowserLinkRequestSchema=e.strictObject({to:e.string().startsWith("/")}),BrowserLinkSchema=e.object({url:e.url()}),CREDENTIALS_FILE=".allyhub/credentials.json",TokenResponseSchema=e.object({access_token:e.string().min(1),token_type:e.string(),expires_in:e.number().positive(),refresh_token:e.string().min(1).optional(),scope:e.string().optional()}),OAuthErrorSchema=e.object({error:e.string(),error_description:e.string().optional()}),DeviceAuthorizationSchema=e.object({device_code:e.string().min(1),user_code:e.string().min(1),verification_uri:e.url(),verification_uri_complete:e.url().optional(),expires_in:e.number().positive(),interval:e.number().positive().optional()}),AccountSchema=e.strictObject({id:e.string().min(1),email:e.email(),name:e.string().optional(),organization:e.strictObject({id:e.string().min(1),name:e.string()}).optional()}),CredentialsFileSchema=e.strictObject({version:e.literal(1),url:e.url(),issuer:e.url(),account:AccountSchema,refreshToken:e.string().min(1),access:e.strictObject({token:e.string().min(1),expiresAt:e.iso.datetime({offset:!0})}).optional(),since:e.iso.datetime({offset:!0})}),TokenOutputSchema=e.strictObject({accessToken:e.string().min(1),expiresAt:e.iso.datetime({offset:!0}),account:AccountSchema}),bearer=t=>`Bearer ${t.accessToken}`;
|
|
@@ -26,7 +26,7 @@ export declare const CliErrorSchema: z.ZodObject<{
|
|
|
26
26
|
}, z.core.$strict>;
|
|
27
27
|
}, z.core.$strict>;
|
|
28
28
|
export type CliError = z.infer<typeof CliErrorSchema>;
|
|
29
|
-
/** A command's name: words in lowercase, `scenery view`. */
|
|
29
|
+
/** A command's name: words in lowercase, `scenery view`; a word may start with a digit, `3d-model`. */
|
|
30
30
|
export declare const COMMAND_NAME: RegExp;
|
|
31
31
|
export interface CommandSpec<I extends z.ZodObject = z.ZodObject, O extends z.ZodType = z.ZodType> {
|
|
32
32
|
name: string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{z as o}from"zod";export const EXIT={ok:0,failed:1,usage:2,conflict:3,auth:4,platform:5,notFound:6,interrupted:130},CliErrorSchema=o.strictObject({error:o.strictObject({code:o.string().regex(/^[a-z][a-z0-9-]*$/u),message:o.string().min(1),hint:o.string().optional()})}),COMMAND_NAME=/^[a-
|
|
2
|
+
import{z as o}from"zod";export const EXIT={ok:0,failed:1,usage:2,conflict:3,auth:4,platform:5,notFound:6,interrupted:130},CliErrorSchema=o.strictObject({error:o.strictObject({code:o.string().regex(/^[a-z][a-z0-9-]*$/u),message:o.string().min(1),hint:o.string().optional()})}),COMMAND_NAME=/^[a-z0-9][a-z0-9-]*(?: [a-z0-9][a-z0-9-]*)*$/u;export function command(t){if(!COMMAND_NAME.test(t.name))throw new Error(`"${t.name}" is not a command name.`);const e=Object.keys(t.input.shape);for(const n of t.positional??[])if(!e.includes(n))throw new Error(`${t.name}: positional "${n}" is not a field of its input.`);for(const[n,r]of Object.entries(t.input.shape))if(!r.description)throw new Error(`${t.name}: "${n}" has no description.`);return t}export function describeCommand(t){return{name:t.name,summary:t.summary,positional:[...t.positional??[]],input:o.toJSONSchema(t.input,{io:"input",unrepresentable:"any"}),output:o.toJSONSchema(t.output,{io:"output",unrepresentable:"any"}),examples:[...t.examples??[]]}}export const toolName=t=>`allyhub_${t.replaceAll(/[ -]/gu,"_")}`;
|
|
@@ -23,6 +23,7 @@ export declare const HostContextSchema: z.ZodObject<{
|
|
|
23
23
|
doc: "doc";
|
|
24
24
|
sheet: "sheet";
|
|
25
25
|
scenery: "scenery";
|
|
26
|
+
model: "model";
|
|
26
27
|
website: "website";
|
|
27
28
|
}>;
|
|
28
29
|
dir: z.ZodString;
|
|
@@ -70,6 +71,7 @@ export declare const HOST_METHODS: {
|
|
|
70
71
|
doc: "doc";
|
|
71
72
|
sheet: "sheet";
|
|
72
73
|
scenery: "scenery";
|
|
74
|
+
model: "model";
|
|
73
75
|
website: "website";
|
|
74
76
|
}>;
|
|
75
77
|
dir: z.ZodString;
|
|
@@ -232,6 +234,7 @@ export declare const HOST_NOTIFICATIONS: {
|
|
|
232
234
|
doc: "doc";
|
|
233
235
|
sheet: "sheet";
|
|
234
236
|
scenery: "scenery";
|
|
237
|
+
model: "model";
|
|
235
238
|
website: "website";
|
|
236
239
|
}>;
|
|
237
240
|
dir: z.ZodString;
|
|
@@ -268,6 +271,7 @@ export declare const EDITOR_HOST_METHODS: {
|
|
|
268
271
|
doc: "doc";
|
|
269
272
|
sheet: "sheet";
|
|
270
273
|
scenery: "scenery";
|
|
274
|
+
model: "model";
|
|
271
275
|
website: "website";
|
|
272
276
|
}>;
|
|
273
277
|
dir: z.ZodString;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
export declare const REGISTRY_TYPES: readonly ["allyhub:component", "allyhub:template", "allyhub:scenery", "allyhub:model", "allyhub:skill"];
|
|
2
|
+
export declare const REGISTRY_TYPES: readonly ["allyhub:component", "allyhub:template", "allyhub:scenery", "allyhub:model", "allyhub:skill", "allyhub:lib"];
|
|
3
3
|
export declare const RegistryFileSchema: z.ZodObject<{
|
|
4
4
|
path: z.ZodString;
|
|
5
5
|
target: z.ZodString;
|
|
@@ -73,6 +73,7 @@ export declare const RegistryItemSchema: z.ZodObject<{
|
|
|
73
73
|
"allyhub:scenery": "allyhub:scenery";
|
|
74
74
|
"allyhub:model": "allyhub:model";
|
|
75
75
|
"allyhub:skill": "allyhub:skill";
|
|
76
|
+
"allyhub:lib": "allyhub:lib";
|
|
76
77
|
}>;
|
|
77
78
|
title: z.ZodString;
|
|
78
79
|
description: z.ZodString;
|
|
@@ -137,6 +138,7 @@ export declare const RegistryIndexSchema: z.ZodObject<{
|
|
|
137
138
|
"allyhub:scenery": "allyhub:scenery";
|
|
138
139
|
"allyhub:model": "allyhub:model";
|
|
139
140
|
"allyhub:skill": "allyhub:skill";
|
|
141
|
+
"allyhub:lib": "allyhub:lib";
|
|
140
142
|
}>;
|
|
141
143
|
name: z.ZodString;
|
|
142
144
|
title: z.ZodString;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{z as t}from"zod";export const REGISTRY_TYPES=["allyhub:component","allyhub:template","allyhub:scenery","allyhub:model","allyhub:skill"];const e=t.string().regex(/^[a-z0-9][a-z0-9-]*$/u);export const RegistryFileSchema=t.strictObject({path:t.string().min(1),target:t.string().min(1),sha256:t.string().regex(/^[0-9a-f]{64}$/u),content:t.string().optional()}),RegistryAssetSchema=t.strictObject({source:t.literal("polyhaven"),id:t.string().min(1),resolution:t.string().min(1).optional(),maps:t.array(t.string().min(1)).optional()}),RegistryBakeSchema=t.strictObject({scenery:t.string().min(1),digest:t.string().regex(/^[0-9a-f]+$/u),renderer:t.string().min(1),sha256:t.string().regex(/^[0-9a-f]{64}$/u),size:t.number().int().positive(),url:t.url()}),SkillCardWordsSchema=t.strictObject({title:t.string().min(1),description:t.string().min(1),prompt:t.string().min(1).optional()}),SkillCardSchema=t.strictObject({category:t.enum(["video","writing","research"]),order:t.number().int().positive(),cover:t.string().optional(),words:SkillCardWordsSchema,languages:t.record(t.string(),SkillCardWordsSchema.partial()).default({})}),RegistryItemSchema=t.strictObject({$schema:t.string().optional(),name:e,type:t.enum(REGISTRY_TYPES),title:t.string().min(1),description:t.string().min(1),author:t.string().optional(),license:t.string().min(1),dependencies:t.array(t.string()).default([]),registryDependencies:t.array(e).default([]),files:t.array(RegistryFileSchema).min(1),assets:t.array(RegistryAssetSchema).default([]),bakes:t.array(RegistryBakeSchema).default([]),categories:t.array(t.string()).default([]),preview:t.string().optional(),version:t.string().optional(),card:SkillCardSchema.optional()}),RegistryIndexSchema=t.strictObject({$schema:t.string().optional(),name:t.string().min(1),homepage:t.url().optional(),items:t.array(RegistryItemSchema.pick({name:!0,type:!0,title:!0,description:!0,categories:!0,preview:!0,version:!0,card:!0}))});
|
|
2
|
+
import{z as t}from"zod";export const REGISTRY_TYPES=["allyhub:component","allyhub:template","allyhub:scenery","allyhub:model","allyhub:skill","allyhub:lib"];const e=t.string().regex(/^[a-z0-9][a-z0-9-]*$/u);export const RegistryFileSchema=t.strictObject({path:t.string().min(1),target:t.string().min(1),sha256:t.string().regex(/^[0-9a-f]{64}$/u),content:t.string().optional()}),RegistryAssetSchema=t.strictObject({source:t.literal("polyhaven"),id:t.string().min(1),resolution:t.string().min(1).optional(),maps:t.array(t.string().min(1)).optional()}),RegistryBakeSchema=t.strictObject({scenery:t.string().min(1),digest:t.string().regex(/^[0-9a-f]+$/u),renderer:t.string().min(1),sha256:t.string().regex(/^[0-9a-f]{64}$/u),size:t.number().int().positive(),url:t.url()}),SkillCardWordsSchema=t.strictObject({title:t.string().min(1),description:t.string().min(1),prompt:t.string().min(1).optional()}),SkillCardSchema=t.strictObject({category:t.enum(["video","writing","research"]),order:t.number().int().positive(),cover:t.string().optional(),words:SkillCardWordsSchema,languages:t.record(t.string(),SkillCardWordsSchema.partial()).default({})}),RegistryItemSchema=t.strictObject({$schema:t.string().optional(),name:e,type:t.enum(REGISTRY_TYPES),title:t.string().min(1),description:t.string().min(1),author:t.string().optional(),license:t.string().min(1),dependencies:t.array(t.string()).default([]),registryDependencies:t.array(e).default([]),files:t.array(RegistryFileSchema).min(1),assets:t.array(RegistryAssetSchema).default([]),bakes:t.array(RegistryBakeSchema).default([]),categories:t.array(t.string()).default([]),preview:t.string().optional(),version:t.string().optional(),card:SkillCardSchema.optional()}),RegistryIndexSchema=t.strictObject({$schema:t.string().optional(),name:t.string().min(1),homepage:t.url().optional(),items:t.array(RegistryItemSchema.pick({name:!0,type:!0,title:!0,description:!0,categories:!0,preview:!0,version:!0,card:!0}))});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{ACCOUNT_PATH as
|
|
2
|
+
import{ACCOUNT_DELETE_PATH as d,ACCOUNT_EXPORT_PATH as m,ACCOUNT_PATH as _,BROWSER_LINK_PATH as O,DEVICES_PATH as o,METADATA_PATH as r}from"./auth.js";import{AUTO_TOP_UP_PATH as e,BILLING_CHECKOUT_PATH as L,BILLING_PLANS_PATH as S,BILLING_PORTAL_PATH as G,BILLING_SUMMARY_PATH as H,BILLING_USAGE_PATH as I,CATALOG_PATH as i,FILES_PATH as T,LLM_MESSAGES_PATH as N,LLM_MODELS_PATH as n}from"./cloud.js";import{MEMBERS_PATH as E,ORGANIZATIONS_PATH as p,ORGANIZATION_PATH as U,STUDIO_OPEN_PATH as s,STUDIO_PATH as a,STUDIO_WAKE_PATH as C}from"./teams.js";export const CLIENT_ROUTES=[{method:"GET",path:r},{method:"GET",path:_},{method:"GET",path:m},{method:"POST",path:d},{method:"GET",path:o},{method:"DELETE",path:`${o}/:id`},{method:"POST",path:O},{method:"GET",path:S},{method:"GET",path:H},{method:"GET",path:I},{method:"POST",path:L},{method:"POST",path:G},{method:"PUT",path:e},{method:"DELETE",path:e},{method:"GET",path:n},{method:"POST",path:N},{method:"GET",path:i},{method:"POST",path:"/api/tools/:name/calls"},{method:"GET",path:"/api/calls/:id"},{method:"POST",path:T},{method:"POST",path:`${T}/:id/done`},{method:"GET",path:`${T}/:id/content`},{method:"GET",path:p},{method:"POST",path:`${p}/:id/restore`},{method:"DELETE",path:U},{method:"GET",path:E},{method:"PUT",path:`${E}/:userId/limit`},{method:"GET",path:a},{method:"DELETE",path:a},{method:"POST",path:s},{method:"PUT",path:C}],probePath=t=>t.path.replace(/:[A-Za-z]+/gu,"probe");export function routeMissing(t,A,P){if(A!==404)return!1;const h=P.error;return h?.code==="not_found"&&h.message===`There is no ${t.method} ${probePath(t)}.`}
|