@uibot/hub-runtime 0.0.0-stage → 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/a2a.d.ts ADDED
@@ -0,0 +1,72 @@
1
+ import type { ComponentArtifact } from "@uibot/contracts";
2
+ import type { UIBotHubService } from "./service.js";
3
+ export interface UIBotHubA2ASkill {
4
+ id: string;
5
+ name: string;
6
+ description: string;
7
+ inputModes: string[];
8
+ outputModes: string[];
9
+ examples?: string[];
10
+ }
11
+ export interface UIBotHubA2AAgentCard {
12
+ name: string;
13
+ description: string;
14
+ url: string;
15
+ version: string;
16
+ protocolVersion: string;
17
+ provider: {
18
+ organization: string;
19
+ url: string;
20
+ };
21
+ capabilities: {
22
+ streaming: boolean;
23
+ pushNotifications: boolean;
24
+ stateTransitionHistory: boolean;
25
+ };
26
+ authentication: {
27
+ schemes: string[];
28
+ };
29
+ skills: UIBotHubA2ASkill[];
30
+ }
31
+ export interface UIBotHubA2ATaskView {
32
+ id?: string;
33
+ status: "working" | "completed" | "failed";
34
+ state: "pending" | "running" | "ready" | "failed";
35
+ progress?: number;
36
+ artifact?: ComponentArtifact;
37
+ error?: string;
38
+ }
39
+ export interface UIBotHubA2AJsonRpcRequest<TParams = unknown> {
40
+ jsonrpc: "2.0";
41
+ id?: string | number | null;
42
+ method: "agent.getCard" | "component.request" | "tasks.get";
43
+ params?: TParams;
44
+ }
45
+ export interface UIBotHubA2AJsonRpcSuccess<TResult = unknown> {
46
+ jsonrpc: "2.0";
47
+ id: string | number | null;
48
+ result: TResult;
49
+ }
50
+ export interface UIBotHubA2AJsonRpcError {
51
+ jsonrpc: "2.0";
52
+ id: string | number | null;
53
+ error: {
54
+ code: number;
55
+ message: string;
56
+ };
57
+ }
58
+ export type UIBotHubA2AJsonRpcResponse<TResult = unknown> = UIBotHubA2AJsonRpcSuccess<TResult> | UIBotHubA2AJsonRpcError;
59
+ export interface CreateUIBotHubA2AHandlerOptions {
60
+ service: UIBotHubService;
61
+ baseUrl: string;
62
+ card?: Partial<UIBotHubA2AAgentCard>;
63
+ agentCardPath?: string;
64
+ rpcPath?: string;
65
+ }
66
+ export declare function createDefaultUIBotHubA2AAgentCard(baseUrl: string, overrides?: Partial<UIBotHubA2AAgentCard>): UIBotHubA2AAgentCard;
67
+ export interface UIBotHubA2AHandler {
68
+ readonly card: UIBotHubA2AAgentCard;
69
+ handleJsonRpc(request: UIBotHubA2AJsonRpcRequest<Record<string, unknown>>): Promise<UIBotHubA2AJsonRpcResponse>;
70
+ handleHttp(request: Request): Promise<Response>;
71
+ }
72
+ export declare function createUIBotHubA2AHandler(options: CreateUIBotHubA2AHandlerOptions): UIBotHubA2AHandler;
@@ -0,0 +1,19 @@
1
+ import type { UIBotPlugin } from "@uibot/contracts";
2
+ export interface UIBotHubWorkflowDefinition {
3
+ id: string;
4
+ description: string;
5
+ triggers: string[];
6
+ }
7
+ export interface UIBotHubProtocolSurface {
8
+ rest: boolean;
9
+ a2a: boolean;
10
+ mcp: boolean;
11
+ }
12
+ export interface UIBotHubRuntimeBlueprint {
13
+ name: string;
14
+ workflows: UIBotHubWorkflowDefinition[];
15
+ protocols: UIBotHubProtocolSurface;
16
+ observability: "builtin" | "external";
17
+ }
18
+ export declare function createDefaultUIBotHubBlueprint(): UIBotHubRuntimeBlueprint;
19
+ export declare function createUIBotHubPlugin(): UIBotPlugin;
package/dist/http.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ import { type UIBotHubService } from "./service.js";
2
+ export interface CreateUIBotHubHttpHandlerOptions {
3
+ service: UIBotHubService;
4
+ basePath?: string;
5
+ }
6
+ export declare function createUIBotHubHttpHandler(options: CreateUIBotHubHttpHandlerOptions): (request: Request) => Promise<Response>;
@@ -0,0 +1,7 @@
1
+ export * from "./blueprint.js";
2
+ export * from "./task-store.js";
3
+ export * from "./service.js";
4
+ export * from "./http.js";
5
+ export * from "./workflow.js";
6
+ export * from "./a2a.js";
7
+ export * from "./mcp.js";
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ var Ur=Object.create;var{getPrototypeOf:Nr,defineProperty:De,getOwnPropertyNames:Lr}=Object;var Oe=Object.prototype.hasOwnProperty;function Fr(e){return this[e]}var qr,_r,Mr=(e,t,r)=>{var n=e!=null&&typeof e==="object";if(n){var o=t?qr??=new WeakMap:_r??=new WeakMap,i=o.get(e);if(i)return i}r=e!=null?Ur(Nr(e)):{};let s=t||!e||!e.__esModule||!Oe.call(e,"default")?De(r,"default",{value:e,enumerable:!0}):r;if(e&&typeof e==="object"||typeof e==="function"){for(let a of Lr(e))if(!Oe.call(s,a))De(s,a,{get:Fr.bind(e,a),enumerable:!0})}if(n)o.set(e,s);return s};var m=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var D=m(function(ms,Be){var Hr=Number.MAX_SAFE_INTEGER||9007199254740991,$r=["major","premajor","minor","preminor","patch","prepatch","prerelease"];Be.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:Hr,RELEASE_TYPES:$r,SEMVER_SPEC_VERSION:"2.0.0",FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var N=m(function(fs,Ue){var Vr=typeof process==="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};Ue.exports=Vr});var O=m(function(S,Ne){var{MAX_SAFE_COMPONENT_LENGTH:le,MAX_SAFE_BUILD_LENGTH:jr,MAX_LENGTH:Gr}=D(),Wr=N();S=Ne.exports={};var zr=S.re=[],Yr=S.safeRe=[],d=S.src=[],Kr=S.safeSrc=[],p=S.t={},Jr=0,ce="[a-zA-Z0-9-]",Xr=[["\\s",1],["\\d",Gr],[ce,jr]],Qr=(e)=>{for(let[t,r]of Xr)e=e.split(`${t}*`).join(`${t}{0,${r}}`).split(`${t}+`).join(`${t}{1,${r}}`);return e},f=(e,t,r)=>{let n=Qr(t),o=Jr++;Wr(e,o,t),p[e]=o,d[o]=t,Kr[o]=n,zr[o]=new RegExp(t,r?"g":void 0),Yr[o]=new RegExp(n,r?"g":void 0)};f("NUMERICIDENTIFIER","0|[1-9]\\d*");f("NUMERICIDENTIFIERLOOSE","\\d+");f("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${ce}*`);f("MAINVERSION",`(${d[p.NUMERICIDENTIFIER]})\\.(${d[p.NUMERICIDENTIFIER]})\\.(${d[p.NUMERICIDENTIFIER]})`);f("MAINVERSIONLOOSE",`(${d[p.NUMERICIDENTIFIERLOOSE]})\\.(${d[p.NUMERICIDENTIFIERLOOSE]})\\.(${d[p.NUMERICIDENTIFIERLOOSE]})`);f("PRERELEASEIDENTIFIER",`(?:${d[p.NONNUMERICIDENTIFIER]}|${d[p.NUMERICIDENTIFIER]})`);f("PRERELEASEIDENTIFIERLOOSE",`(?:${d[p.NONNUMERICIDENTIFIER]}|${d[p.NUMERICIDENTIFIERLOOSE]})`);f("PRERELEASE",`(?:-(${d[p.PRERELEASEIDENTIFIER]}(?:\\.${d[p.PRERELEASEIDENTIFIER]})*))`);f("PRERELEASELOOSE",`(?:-?(${d[p.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${d[p.PRERELEASEIDENTIFIERLOOSE]})*))`);f("BUILDIDENTIFIER",`${ce}+`);f("BUILD",`(?:\\+(${d[p.BUILDIDENTIFIER]}(?:\\.${d[p.BUILDIDENTIFIER]})*))`);f("FULLPLAIN",`v?${d[p.MAINVERSION]}${d[p.PRERELEASE]}?${d[p.BUILD]}?`);f("FULL",`^${d[p.FULLPLAIN]}$`);f("LOOSEPLAIN",`[v=\\s]*${d[p.MAINVERSIONLOOSE]}${d[p.PRERELEASELOOSE]}?${d[p.BUILD]}?`);f("LOOSE",`^${d[p.LOOSEPLAIN]}$`);f("GTLT","((?:<|>)?=?)");f("XRANGEIDENTIFIERLOOSE",`${d[p.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);f("XRANGEIDENTIFIER",`${d[p.NUMERICIDENTIFIER]}|x|X|\\*`);f("XRANGEPLAIN",`[v=\\s]*(${d[p.XRANGEIDENTIFIER]})(?:\\.(${d[p.XRANGEIDENTIFIER]})(?:\\.(${d[p.XRANGEIDENTIFIER]})(?:${d[p.PRERELEASE]})?${d[p.BUILD]}?)?)?`);f("XRANGEPLAINLOOSE",`[v=\\s]*(${d[p.XRANGEIDENTIFIERLOOSE]})(?:\\.(${d[p.XRANGEIDENTIFIERLOOSE]})(?:\\.(${d[p.XRANGEIDENTIFIERLOOSE]})(?:${d[p.PRERELEASELOOSE]})?${d[p.BUILD]}?)?)?`);f("XRANGE",`^${d[p.GTLT]}\\s*${d[p.XRANGEPLAIN]}$`);f("XRANGELOOSE",`^${d[p.GTLT]}\\s*${d[p.XRANGEPLAINLOOSE]}$`);f("COERCEPLAIN",`(^|[^\\d])(\\d{1,${le}})(?:\\.(\\d{1,${le}}))?(?:\\.(\\d{1,${le}}))?`);f("COERCE",`${d[p.COERCEPLAIN]}(?:$|[^\\d])`);f("COERCEFULL",d[p.COERCEPLAIN]+`(?:${d[p.PRERELEASE]})?(?:${d[p.BUILD]})?(?:$|[^\\d])`);f("COERCERTL",d[p.COERCE],!0);f("COERCERTLFULL",d[p.COERCEFULL],!0);f("LONETILDE","(?:~>?)");f("TILDETRIM",`(\\s*)${d[p.LONETILDE]}\\s+`,!0);S.tildeTrimReplace="$1~";f("TILDE",`^${d[p.LONETILDE]}${d[p.XRANGEPLAIN]}$`);f("TILDELOOSE",`^${d[p.LONETILDE]}${d[p.XRANGEPLAINLOOSE]}$`);f("LONECARET","(?:\\^)");f("CARETTRIM",`(\\s*)${d[p.LONECARET]}\\s+`,!0);S.caretTrimReplace="$1^";f("CARET",`^${d[p.LONECARET]}${d[p.XRANGEPLAIN]}$`);f("CARETLOOSE",`^${d[p.LONECARET]}${d[p.XRANGEPLAINLOOSE]}$`);f("COMPARATORLOOSE",`^${d[p.GTLT]}\\s*(${d[p.LOOSEPLAIN]})$|^$`);f("COMPARATOR",`^${d[p.GTLT]}\\s*(${d[p.FULLPLAIN]})$|^$`);f("COMPARATORTRIM",`(\\s*)${d[p.GTLT]}\\s*(${d[p.LOOSEPLAIN]}|${d[p.XRANGEPLAIN]})`,!0);S.comparatorTrimReplace="$1$2$3";f("HYPHENRANGE",`^\\s*(${d[p.XRANGEPLAIN]})\\s+-\\s+(${d[p.XRANGEPLAIN]})\\s*$`);f("HYPHENRANGELOOSE",`^\\s*(${d[p.XRANGEPLAINLOOSE]})\\s+-\\s+(${d[p.XRANGEPLAINLOOSE]})\\s*$`);f("STAR","(<|>)?=?\\s*\\*");f("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");f("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var j=m(function(ys,Le){var Zr=Object.freeze({loose:!0}),en=Object.freeze({}),tn=(e)=>{if(!e)return en;if(typeof e!=="object")return Zr;return e};Le.exports=tn});var ue=m(function(Cs,_e){var Fe=/^[0-9]+$/,qe=(e,t)=>{if(typeof e==="number"&&typeof t==="number")return e===t?0:e<t?-1:1;let r=Fe.test(e),n=Fe.test(t);if(r&&n)e=+e,t=+t;return e===t?0:r&&!n?-1:n&&!r?1:e<t?-1:1},rn=(e,t)=>qe(t,e);_e.exports={compareIdentifiers:qe,rcompareIdentifiers:rn}});var R=m(function(bs,He){var G=N(),{MAX_LENGTH:Me,MAX_SAFE_INTEGER:W}=D(),{safeRe:z,t:Y}=O(),nn=j(),{compareIdentifiers:de}=ue(),on=(e,t)=>{let r=t.split(".");if(r.length>e.length)return!1;for(let n=0;n<r.length;n++)if(de(e[n],r[n])!==0)return!1;return!0};class w{constructor(e,t){if(t=nn(t),e instanceof w)if(e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease)return e;else e=e.version;else if(typeof e!=="string")throw TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>Me)throw TypeError(`version is longer than ${Me} characters`);G("SemVer",e,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;let r=e.trim().match(t.loose?z[Y.LOOSE]:z[Y.FULL]);if(!r)throw TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+r[1],this.minor=+r[2],this.patch=+r[3],this.major>W||this.major<0)throw TypeError("Invalid major version");if(this.minor>W||this.minor<0)throw TypeError("Invalid minor version");if(this.patch>W||this.patch<0)throw TypeError("Invalid patch version");if(!r[4])this.prerelease=[];else this.prerelease=r[4].split(".").map((n)=>{if(/^[0-9]+$/.test(n)){let o=+n;if(o>=0&&o<W)return o}return n});this.build=r[5]?r[5].split("."):[],this.format()}format(){if(this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length)this.version+=`-${this.prerelease.join(".")}`;return this.version}toString(){return this.version}compare(e){if(G("SemVer.compare",this.version,this.options,e),!(e instanceof w)){if(typeof e==="string"&&e===this.version)return 0;e=new w(e,this.options)}if(e.version===this.version)return 0;return this.compareMain(e)||this.comparePre(e)}compareMain(e){if(!(e instanceof w))e=new w(e,this.options);if(this.major<e.major)return-1;if(this.major>e.major)return 1;if(this.minor<e.minor)return-1;if(this.minor>e.minor)return 1;if(this.patch<e.patch)return-1;if(this.patch>e.patch)return 1;return 0}comparePre(e){if(!(e instanceof w))e=new w(e,this.options);if(this.prerelease.length&&!e.prerelease.length)return-1;else if(!this.prerelease.length&&e.prerelease.length)return 1;else if(!this.prerelease.length&&!e.prerelease.length)return 0;let t=0;do{let r=this.prerelease[t],n=e.prerelease[t];if(G("prerelease compare",t,r,n),r===void 0&&n===void 0)return 0;else if(n===void 0)return 1;else if(r===void 0)return-1;else if(r===n)continue;else return de(r,n)}while(++t)}compareBuild(e){if(!(e instanceof w))e=new w(e,this.options);let t=0;do{let r=this.build[t],n=e.build[t];if(G("build compare",t,r,n),r===void 0&&n===void 0)return 0;else if(n===void 0)return 1;else if(r===void 0)return-1;else if(r===n)continue;else return de(r,n)}while(++t)}inc(e,t,r){if(e.startsWith("pre")){if(!t&&r===!1)throw Error("invalid increment argument: identifier is empty");if(t){let n=`-${t}`.match(this.options.loose?z[Y.PRERELEASELOOSE]:z[Y.PRERELEASE]);if(!n||n[1]!==t)throw Error(`invalid identifier: ${t}`)}}switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t,r);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t,r);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t,r),this.inc("pre",t,r);break;case"prerelease":if(this.prerelease.length===0)this.inc("patch",t,r);this.inc("pre",t,r);break;case"release":if(this.prerelease.length===0)throw Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":if(this.minor!==0||this.patch!==0||this.prerelease.length===0)this.major++;this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":if(this.patch!==0||this.prerelease.length===0)this.minor++;this.patch=0,this.prerelease=[];break;case"patch":if(this.prerelease.length===0)this.patch++;this.prerelease=[];break;case"pre":{let n=Number(r)?1:0;if(this.prerelease.length===0)this.prerelease=[n];else{let o=this.prerelease.length;while(--o>=0)if(typeof this.prerelease[o]==="number")this.prerelease[o]++,o=-2;if(o===-1){if(t===this.prerelease.join(".")&&r===!1)throw Error("invalid increment argument: identifier already exists");this.prerelease.push(n)}}if(t){let o=[t,n];if(r===!1)o=[t];if(on(this.prerelease,t)){let i=this.prerelease[t.split(".").length];if(isNaN(i))this.prerelease=o}else this.prerelease=o}break}default:throw Error(`invalid increment argument: ${e}`)}if(this.raw=this.format(),this.build.length)this.raw+=`+${this.build.join(".")}`;return this}}He.exports=w});var T=m(function(hs,Ve){var $e=R(),sn=(e,t,r=!1)=>{if(e instanceof $e)return e;try{return new $e(e,t)}catch(n){if(!r)return null;throw n}};Ve.exports=sn});var Ge=m(function(Rs,je){var an=T(),ln=(e,t)=>{let r=an(e,t);return r?r.version:null};je.exports=ln});var ze=m(function(xs,We){var cn=T(),un=(e,t)=>{let r=cn(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null};We.exports=un});var Je=m(function(Is,Ke){var Ye=R(),dn=(e,t,r,n,o)=>{if(typeof r==="string")o=n,n=r,r=void 0;try{return new Ye(e instanceof Ye?e.version:e,r).inc(t,n,o).version}catch(i){return null}};Ke.exports=dn});var Ze=m(function(ks,Qe){var Xe=T(),pn=(e,t)=>{let r=Xe(e,null,!0),n=Xe(t,null,!0),o=r.compare(n);if(o===0)return null;let i=o>0,s=i?r:n,a=i?n:r,l=!!s.prerelease.length;if(!!a.prerelease.length&&!l){if(!a.patch&&!a.minor)return"major";if(a.compareMain(s)===0){if(a.minor&&!a.patch)return"minor";return"patch"}}let u=l?"pre":"";if(r.major!==n.major)return u+"major";if(r.minor!==n.minor)return u+"minor";if(r.patch!==n.patch)return u+"patch";return"prerelease"};Qe.exports=pn});var tt=m(function(Ps,et){var gn=R(),mn=(e,t)=>new gn(e,t).major;et.exports=mn});var nt=m(function(Es,rt){var fn=R(),yn=(e,t)=>new fn(e,t).minor;rt.exports=yn});var it=m(function(ws,ot){var Cn=R(),bn=(e,t)=>new Cn(e,t).patch;ot.exports=bn});var at=m(function(Ss,st){var hn=T(),Rn=(e,t)=>{let r=hn(e,t);return r&&r.prerelease.length?r.prerelease:null};st.exports=Rn});var P=m(function(As,ct){var lt=R(),xn=(e,t,r)=>new lt(e,r).compare(new lt(t,r));ct.exports=xn});var dt=m(function(vs,ut){var In=P(),kn=(e,t,r)=>In(t,e,r);ut.exports=kn});var gt=m(function(Ts,pt){var Pn=P(),En=(e,t)=>Pn(e,t,!0);pt.exports=En});var K=m(function(Ds,ft){var mt=R(),wn=(e,t,r)=>{let n=new mt(e,r),o=new mt(t,r);return n.compare(o)||n.compareBuild(o)};ft.exports=wn});var Ct=m(function(Os,yt){var Sn=K(),An=(e,t)=>e.sort((r,n)=>Sn(r,n,t));yt.exports=An});var ht=m(function(Bs,bt){var vn=K(),Tn=(e,t)=>e.sort((r,n)=>vn(n,r,t));bt.exports=Tn});var L=m(function(Us,Rt){var Dn=P(),On=(e,t,r)=>Dn(e,t,r)>0;Rt.exports=On});var J=m(function(Ns,xt){var Bn=P(),Un=(e,t,r)=>Bn(e,t,r)<0;xt.exports=Un});var pe=m(function(Ls,It){var Nn=P(),Ln=(e,t,r)=>Nn(e,t,r)===0;It.exports=Ln});var ge=m(function(Fs,kt){var Fn=P(),qn=(e,t,r)=>Fn(e,t,r)!==0;kt.exports=qn});var X=m(function(qs,Pt){var _n=P(),Mn=(e,t,r)=>_n(e,t,r)>=0;Pt.exports=Mn});var Q=m(function(_s,Et){var Hn=P(),$n=(e,t,r)=>Hn(e,t,r)<=0;Et.exports=$n});var me=m(function(Ms,wt){var Vn=pe(),jn=ge(),Gn=L(),Wn=X(),zn=J(),Yn=Q(),Kn=(e,t,r,n)=>{switch(t){case"===":if(typeof e==="object")e=e.version;if(typeof r==="object")r=r.version;return e===r;case"!==":if(typeof e==="object")e=e.version;if(typeof r==="object")r=r.version;return e!==r;case"":case"=":case"==":return Vn(e,r,n);case"!=":return jn(e,r,n);case">":return Gn(e,r,n);case">=":return Wn(e,r,n);case"<":return zn(e,r,n);case"<=":return Yn(e,r,n);default:throw TypeError(`Invalid operator: ${t}`)}};wt.exports=Kn});var At=m(function(Hs,St){var Jn=R(),Xn=T(),{safeRe:Z,t:ee}=O(),Qn=(e,t)=>{if(e instanceof Jn)return e;if(typeof e==="number")e=String(e);if(typeof e!=="string")return null;t=t||{};let r=null;if(!t.rtl)r=e.match(t.includePrerelease?Z[ee.COERCEFULL]:Z[ee.COERCE]);else{let l=t.includePrerelease?Z[ee.COERCERTLFULL]:Z[ee.COERCERTL],c;while((c=l.exec(e))&&(!r||r.index+r[0].length!==e.length)){if(!r||c.index+c[0].length!==r.index+r[0].length)r=c;l.lastIndex=c.index+c[1].length+c[2].length}l.lastIndex=-1}if(r===null)return null;let n=r[2],o=r[3]||"0",i=r[4]||"0",s=t.includePrerelease&&r[5]?`-${r[5]}`:"",a=t.includePrerelease&&r[6]?`+${r[6]}`:"";return Xn(`${n}.${o}.${i}${s}${a}`,t)};St.exports=Qn});var Tt=m(function($s,vt){var Zn=T(),eo=D(),to=R(),ro=(e,t,r)=>{if(!eo.RELEASE_TYPES.includes(t))return null;let n=no(e,r);return n&&oo(n,t)},no=(e,t)=>{let r=e instanceof to?e.version:e;return Zn(r,t)},oo=(e,t)=>{if(io(t))return e.version;switch(e.prerelease=[],t){case"major":e.minor=0,e.patch=0;break;case"minor":e.patch=0;break}return e.format()},io=(e)=>e.startsWith("pre");vt.exports=ro});var Bt=m(function(Vs,Ot){class Dt{constructor(){this.max=1000,this.map=new Map}get(e){let t=this.map.get(e);if(t===void 0)return;else return this.map.delete(e),this.map.set(e,t),t}delete(e){return this.map.delete(e)}set(e,t){if(!this.delete(e)&&t!==void 0){if(this.map.size>=this.max){let n=this.map.keys().next().value;this.delete(n)}this.map.set(e,t)}return this}}Ot.exports=Dt});var E=m(function(js,Ft){var so=/\s+/g;class F{constructor(e,t){if(t=lo(t),e instanceof F)if(e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease)return e;else return new F(e.raw,t);if(e instanceof fe)return this.raw=e.value,this.set=[[e]],this.formatted=void 0,this;if(this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease,this.raw=e.trim().replace(so," "),this.set=this.raw.split("||").map((r)=>this.parseRange(r.trim())).filter((r)=>r.length),!this.set.length)throw TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let r=this.set[0];if(this.set=this.set.filter((n)=>!Nt(n[0])),this.set.length===0)this.set=[r];else if(this.set.length>1){for(let n of this.set)if(n.length===1&&bo(n[0])){this.set=[n];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let e=0;e<this.set.length;e++){if(e>0)this.formatted+="||";let t=this.set[e];for(let r=0;r<t.length;r++){if(r>0)this.formatted+=" ";this.formatted+=t[r].toString().trim()}}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){e=e.replace(Co,"");let r=((this.options.includePrerelease&&fo)|(this.options.loose&&yo))+":"+e,n=Ut.get(r);if(n)return n;let o=this.options.loose,i=o?I[x.HYPHENRANGELOOSE]:I[x.HYPHENRANGE];e=e.replace(i,vo(this.options.includePrerelease)),b("hyphen replace",e),e=e.replace(I[x.COMPARATORTRIM],po),b("comparator trim",e),e=e.replace(I[x.TILDETRIM],go),b("tilde trim",e),e=e.replace(I[x.CARETTRIM],mo),b("caret trim",e);let s=e.split(" ").map((u)=>ho(u,this.options)).join(" ").split(/\s+/).map((u)=>Ao(u,this.options));if(o)s=s.filter((u)=>(b("loose invalid filter",u,this.options),!!u.match(I[x.COMPARATORLOOSE])));b("range list",s);let a=new Map,l=s.map((u)=>new fe(u,this.options));for(let u of l){if(Nt(u))return[u];a.set(u.value,u)}if(a.size>1&&a.has(""))a.delete("");let c=[...a.values()];return Ut.set(r,c),c}intersects(e,t){if(!(e instanceof F))throw TypeError("a Range is required");return this.set.some((r)=>Lt(r,t)&&e.set.some((n)=>Lt(n,t)&&r.every((o)=>n.every((i)=>o.intersects(i,t)))))}test(e){if(!e)return!1;if(typeof e==="string")try{e=new co(e,this.options)}catch(t){return!1}for(let t=0;t<this.set.length;t++)if(To(this.set[t],e,this.options))return!0;return!1}}Ft.exports=F;var ao=Bt(),Ut=new ao,lo=j(),fe=q(),b=N(),co=R(),{safeRe:I,src:uo,t:x,comparatorTrimReplace:po,tildeTrimReplace:go,caretTrimReplace:mo}=O(),{FLAG_INCLUDE_PRERELEASE:fo,FLAG_LOOSE:yo}=D(),Co=new RegExp(uo[x.BUILD],"g"),Nt=(e)=>e.value==="<0.0.0-0",bo=(e)=>e.value==="",Lt=(e,t)=>{let r=!0,n=e.slice(),o=n.pop();while(r&&n.length)r=n.every((i)=>o.intersects(i,t)),o=n.pop();return r},ho=(e,t)=>(e=e.replace(I[x.BUILD],""),b("comp",e,t),e=ko(e,t),b("caret",e),e=xo(e,t),b("tildes",e),e=Eo(e,t),b("xrange",e),e=So(e,t),b("stars",e),e),h=(e)=>!e||e.toLowerCase()==="x"||e==="*",Ro=(e,t,r)=>h(e)&&!h(t)||h(t)&&r&&!h(r),xo=(e,t)=>e.trim().split(/\s+/).map((r)=>Io(r,t)).join(" "),Io=(e,t)=>{let r=t.loose?I[x.TILDELOOSE]:I[x.TILDE],n=t.includePrerelease?"-0":"";return e.replace(r,(o,i,s,a,l)=>{b("tilde",e,o,i,s,a,l);let c;if(h(i))c="";else if(h(s))c=`>=${i}.0.0${n} <${+i+1}.0.0-0`;else if(h(a))c=`>=${i}.${s}.0${n} <${i}.${+s+1}.0-0`;else if(l)b("replaceTilde pr",l),c=`>=${i}.${s}.${a}-${l} <${i}.${+s+1}.0-0`;else c=`>=${i}.${s}.${a} <${i}.${+s+1}.0-0`;return b("tilde return",c),c})},ko=(e,t)=>e.trim().split(/\s+/).map((r)=>Po(r,t)).join(" "),Po=(e,t)=>{b("caret",e,t);let r=t.loose?I[x.CARETLOOSE]:I[x.CARET],n=t.includePrerelease?"-0":"";return e.replace(r,(o,i,s,a,l)=>{b("caret",e,o,i,s,a,l);let c;if(h(i))c="";else if(h(s))c=`>=${i}.0.0${n} <${+i+1}.0.0-0`;else if(h(a))if(i==="0")c=`>=${i}.${s}.0${n} <${i}.${+s+1}.0-0`;else c=`>=${i}.${s}.0${n} <${+i+1}.0.0-0`;else if(l)if(b("replaceCaret pr",l),i==="0")if(s==="0")c=`>=${i}.${s}.${a}-${l} <${i}.${s}.${+a+1}-0`;else c=`>=${i}.${s}.${a}-${l} <${i}.${+s+1}.0-0`;else c=`>=${i}.${s}.${a}-${l} <${+i+1}.0.0-0`;else if(b("no pr"),i==="0")if(s==="0")c=`>=${i}.${s}.${a} <${i}.${s}.${+a+1}-0`;else c=`>=${i}.${s}.${a} <${i}.${+s+1}.0-0`;else c=`>=${i}.${s}.${a} <${+i+1}.0.0-0`;return b("caret return",c),c})},Eo=(e,t)=>(b("replaceXRanges",e,t),e.split(/\s+/).map((r)=>wo(r,t)).join(" ")),wo=(e,t)=>{e=e.trim();let r=t.loose?I[x.XRANGELOOSE]:I[x.XRANGE];return e.replace(r,(n,o,i,s,a,l)=>{if(b("xRange",e,n,o,i,s,a,l),Ro(i,s,a))return e;let c=h(i),u=c||h(s),y=u||h(a),C=y;if(o==="="&&C)o="";if(l=t.includePrerelease?"-0":"",c)if(o===">"||o==="<")n="<0.0.0-0";else n="*";else if(o&&C){if(u)s=0;if(a=0,o===">")if(o=">=",u)i=+i+1,s=0,a=0;else s=+s+1,a=0;else if(o==="<=")if(o="<",u)i=+i+1;else s=+s+1;if(o==="<")l="-0";n=`${o+i}.${s}.${a}${l}`}else if(u)n=`>=${i}.0.0${l} <${+i+1}.0.0-0`;else if(y)n=`>=${i}.${s}.0${l} <${i}.${+s+1}.0-0`;return b("xRange return",n),n})},So=(e,t)=>(b("replaceStars",e,t),e.trim().replace(I[x.STAR],"")),Ao=(e,t)=>(b("replaceGTE0",e,t),e.trim().replace(I[t.includePrerelease?x.GTE0PRE:x.GTE0],"")),vo=(e)=>(t,r,n,o,i,s,a,l,c,u,y,C)=>{if(h(n))r="";else if(h(o))r=`>=${n}.0.0${e?"-0":""}`;else if(h(i))r=`>=${n}.${o}.0${e?"-0":""}`;else if(s)r=`>=${r}`;else r=`>=${r}${e?"-0":""}`;if(h(c))l="";else if(h(u))l=`<${+c+1}.0.0-0`;else if(h(y))l=`<${c}.${+u+1}.0-0`;else if(C)l=`<=${c}.${u}.${y}-${C}`;else if(e)l=`<${c}.${u}.${+y+1}-0`;else l=`<=${l}`;return`${r} ${l}`.trim()},To=(e,t,r)=>{for(let n=0;n<e.length;n++)if(!e[n].test(t))return!1;if(t.prerelease.length&&!r.includePrerelease){for(let n=0;n<e.length;n++){if(b(e[n].semver),e[n].semver===fe.ANY)continue;if(e[n].semver.prerelease.length>0){let o=e[n].semver;if(o.major===t.major&&o.minor===t.minor&&o.patch===t.patch)return!0}}return!1}return!0}});var q=m(function(Gs,Vt){var _=Symbol("SemVer ANY");class te{static get ANY(){return _}constructor(e,t){if(t=qt(t),e instanceof te)if(e.loose===!!t.loose)return e;else e=e.value;if(e=e.trim().split(/\s+/).join(" "),Ce("comparator",e,t),this.options=t,this.loose=!!t.loose,this.parse(e),this.semver===_)this.value="";else this.value=this.operator+this.semver.version;Ce("comp",this)}parse(e){let t=this.options.loose?_t[Mt.COMPARATORLOOSE]:_t[Mt.COMPARATOR],r=e.match(t);if(!r)throw TypeError(`Invalid comparator: ${e}`);if(this.operator=r[1]!==void 0?r[1]:"",this.operator==="=")this.operator="";if(!r[2])this.semver=_;else this.semver=new Ht(r[2],this.options.loose)}toString(){return this.value}test(e){if(Ce("Comparator.test",e,this.options.loose),this.semver===_||e===_)return!0;if(typeof e==="string")try{e=new Ht(e,this.options)}catch(t){return!1}return ye(e,this.operator,this.semver,this.options)}intersects(e,t){if(!(e instanceof te))throw TypeError("a Comparator is required");if(this.operator===""){if(this.value==="")return!0;return new $t(e.value,t).test(this.value)}else if(e.operator===""){if(e.value==="")return!0;return new $t(this.value,t).test(e.semver)}if(t=qt(t),t.includePrerelease&&(this.value==="<0.0.0-0"||e.value==="<0.0.0-0"))return!1;if(!t.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0")))return!1;if(this.operator.startsWith(">")&&e.operator.startsWith(">"))return!0;if(this.operator.startsWith("<")&&e.operator.startsWith("<"))return!0;if(this.semver.version===e.semver.version&&this.operator.includes("=")&&e.operator.includes("="))return!0;if(ye(this.semver,"<",e.semver,t)&&this.operator.startsWith(">")&&e.operator.startsWith("<"))return!0;if(ye(this.semver,">",e.semver,t)&&this.operator.startsWith("<")&&e.operator.startsWith(">"))return!0;return!1}}Vt.exports=te;var qt=j(),{safeRe:_t,t:Mt}=O(),ye=me(),Ce=N(),Ht=R(),$t=E()});var M=m(function(Ws,jt){var Do=E(),Oo=(e,t,r)=>{try{t=new Do(t,r)}catch(n){return!1}return t.test(e)};jt.exports=Oo});var Wt=m(function(zs,Gt){var Bo=E(),Uo=(e,t)=>new Bo(e,t).set.map((r)=>r.map((n)=>n.value).join(" ").trim().split(" "));Gt.exports=Uo});var Yt=m(function(Ys,zt){var No=R(),Lo=E(),Fo=(e,t,r)=>{let n=null,o=null,i=null;try{i=new Lo(t,r)}catch(s){return null}return e.forEach((s)=>{if(i.test(s)){if(!n||o.compare(s)===-1)n=s,o=new No(n,r)}}),n};zt.exports=Fo});var Jt=m(function(Ks,Kt){var qo=R(),_o=E(),Mo=(e,t,r)=>{let n=null,o=null,i=null;try{i=new _o(t,r)}catch(s){return null}return e.forEach((s)=>{if(i.test(s)){if(!n||o.compare(s)===1)n=s,o=new qo(n,r)}}),n};Kt.exports=Mo});var Zt=m(function(Js,Qt){var be=R(),Ho=E(),Xt=L(),$o=(e,t)=>{e=new Ho(e,t);let r=new be("0.0.0");if(e.test(r))return r;if(r=new be("0.0.0-0"),e.test(r))return r;r=null;for(let n=0;n<e.set.length;++n){let o=e.set[n],i=null;if(o.forEach((s)=>{let a=new be(s.semver.version);switch(s.operator){case">":if(a.prerelease.length===0)a.patch++;else a.prerelease.push(0);a.raw=a.format();case"":case">=":if(!i||Xt(a,i))i=a;break;case"<":case"<=":break;default:throw Error(`Unexpected operation: ${s.operator}`)}}),i&&(!r||Xt(r,i)))r=i}if(r&&e.test(r))return r;return null};Qt.exports=$o});var tr=m(function(Xs,er){var Vo=E(),jo=(e,t)=>{try{return new Vo(e,t).range||"*"}catch(r){return null}};er.exports=jo});var re=m(function(Qs,ir){var Go=R(),or=q(),{ANY:Wo}=or,zo=E(),Yo=M(),rr=L(),nr=J(),Ko=Q(),Jo=X(),Xo=(e,t,r,n)=>{e=new Go(e,n),t=new zo(t,n);let o,i,s,a,l;switch(r){case">":o=rr,i=Ko,s=nr,a=">",l=">=";break;case"<":o=nr,i=Jo,s=rr,a="<",l="<=";break;default:throw TypeError('Must provide a hilo val of "<" or ">"')}if(Yo(e,t,n))return!1;for(let c=0;c<t.set.length;++c){let u=t.set[c],y=null,C=null;if(u.forEach((g)=>{if(g.semver===Wo)g=new or(">=0.0.0");if(y=y||g,C=C||g,o(g.semver,y.semver,n))y=g;else if(s(g.semver,C.semver,n))C=g}),y.operator===a||y.operator===l)return!1;if((!C.operator||C.operator===a)&&i(e,C.semver))return!1;else if(C.operator===l&&s(e,C.semver))return!1}return!0};ir.exports=Xo});var ar=m(function(Zs,sr){var Qo=re(),Zo=(e,t,r)=>Qo(e,t,">",r);sr.exports=Zo});var cr=m(function(ea,lr){var ei=re(),ti=(e,t,r)=>ei(e,t,"<",r);lr.exports=ti});var pr=m(function(ta,dr){var ur=E(),ri=(e,t,r)=>(e=new ur(e,r),t=new ur(t,r),e.intersects(t,r));dr.exports=ri});var mr=m(function(ra,gr){var ni=M(),oi=P();gr.exports=(e,t,r)=>{let n=[],o=null,i=null,s=e.sort((u,y)=>oi(u,y,r));for(let u of s)if(ni(u,t,r)){if(i=u,!o)o=u}else{if(i)n.push([o,i]);i=null,o=null}if(o)n.push([o,null]);let a=[];for(let[u,y]of n)if(u===y)a.push(u);else if(!y&&u===s[0])a.push("*");else if(!y)a.push(`>=${u}`);else if(u===s[0])a.push(`<=${y}`);else a.push(`${u} - ${y}`);let l=a.join(" || "),c=typeof t.raw==="string"?t.raw:String(t);return l.length<c.length?l:t}});var Rr=m(function(na,hr){var fr=E(),xe=q(),{ANY:he}=xe,Re=M(),Ie=P(),ii=(e,t,r={})=>{if(e===t)return!0;e=new fr(e,r),t=new fr(t,r);let n=!1;e:for(let o of e.set){for(let i of t.set){let s=ai(o,i,r);if(n=n||s!==null,s)continue e}if(n)return!1}return!0},si=[new xe(">=0.0.0-0")],yr=[new xe(">=0.0.0")],ai=(e,t,r)=>{if(e===t)return!0;if(e.length===1&&e[0].semver===he)if(t.length===1&&t[0].semver===he)return!0;else if(r.includePrerelease)e=si;else e=yr;if(t.length===1&&t[0].semver===he)if(r.includePrerelease)return!0;else t=yr;let n=new Set,o,i;for(let g of e)if(g.operator===">"||g.operator===">=")o=Cr(o,g,r);else if(g.operator==="<"||g.operator==="<=")i=br(i,g,r);else n.add(g.semver);if(n.size>1)return null;let s;if(o&&i){if(s=Ie(o.semver,i.semver,r),s>0)return null;else if(s===0&&(o.operator!==">="||i.operator!=="<="))return null}for(let g of n){if(o&&!Re(g,String(o),r))return null;if(i&&!Re(g,String(i),r))return null;for(let Br of t)if(!Re(g,String(Br),r))return!1;return!0}let a,l,c,u,y=i&&!r.includePrerelease&&i.semver.prerelease.length?i.semver:!1,C=o&&!r.includePrerelease&&o.semver.prerelease.length?o.semver:!1;if(y&&y.prerelease.length===1&&i.operator==="<"&&y.prerelease[0]===0)y=!1;for(let g of t){if(u=u||g.operator===">"||g.operator===">=",c=c||g.operator==="<"||g.operator==="<=",o){if(C){if(g.semver.prerelease&&g.semver.prerelease.length&&g.semver.major===C.major&&g.semver.minor===C.minor&&g.semver.patch===C.patch)C=!1}if(g.operator===">"||g.operator===">="){if(a=Cr(o,g,r),a===g&&a!==o)return!1}else if(o.operator===">="&&!g.test(o.semver))return!1}if(i){if(y){if(g.semver.prerelease&&g.semver.prerelease.length&&g.semver.major===y.major&&g.semver.minor===y.minor&&g.semver.patch===y.patch)y=!1}if(g.operator==="<"||g.operator==="<="){if(l=br(i,g,r),l===g&&l!==i)return!1}else if(i.operator==="<="&&!g.test(i.semver))return!1}if(!g.operator&&(i||o)&&s!==0)return!1}if(o&&c&&!i&&s!==0)return!1;if(i&&u&&!o&&s!==0)return!1;if(C||y)return!1;return!0},Cr=(e,t,r)=>{if(!e)return t;let n=Ie(e.semver,t.semver,r);return n>0?e:n<0?t:t.operator===">"&&e.operator===">="?t:e},br=(e,t,r)=>{if(!e)return t;let n=Ie(e.semver,t.semver,r);return n<0?e:n>0?t:t.operator==="<"&&e.operator==="<="?t:e};hr.exports=ii});var Pr=m(function(oa,kr){var ke=O(),xr=D(),li=R(),Ir=ue(),ci=T(),ui=Ge(),di=ze(),pi=Je(),gi=Ze(),mi=tt(),fi=nt(),yi=it(),Ci=at(),bi=P(),hi=dt(),Ri=gt(),xi=K(),Ii=Ct(),ki=ht(),Pi=L(),Ei=J(),wi=pe(),Si=ge(),Ai=X(),vi=Q(),Ti=me(),Di=At(),Oi=Tt(),Bi=q(),Ui=E(),Ni=M(),Li=Wt(),Fi=Yt(),qi=Jt(),_i=Zt(),Mi=tr(),Hi=re(),$i=ar(),Vi=cr(),ji=pr(),Gi=mr(),Wi=Rr();kr.exports={parse:ci,valid:ui,clean:di,inc:pi,diff:gi,major:mi,minor:fi,patch:yi,prerelease:Ci,compare:bi,rcompare:hi,compareLoose:Ri,compareBuild:xi,sort:Ii,rsort:ki,gt:Pi,lt:Ei,eq:wi,neq:Si,gte:Ai,lte:vi,cmp:Ti,coerce:Di,truncate:Oi,Comparator:Bi,Range:Ui,satisfies:Ni,toComparators:Li,maxSatisfying:Fi,minSatisfying:qi,minVersion:_i,validRange:Mi,outside:Hi,gtr:$i,ltr:Vi,intersects:ji,simplifyRange:Gi,subset:Wi,SemVer:li,re:ke.re,src:ke.src,tokens:ke.t,SEMVER_SPEC_VERSION:xr.SEMVER_SPEC_VERSION,RELEASE_TYPES:xr.RELEASE_TYPES,compareIdentifiers:Ir.compareIdentifiers,rcompareIdentifiers:Ir.rcompareIdentifiers}});var zi=Mr(Pr(),1);function Er(e){return e}function wr(e){return e}function H(e){return e}function Yi(){return{name:"UIBot Hub Runtime",workflows:[{id:"component-request",description:"Request, generate, evaluate, and publish missing components",triggers:["api:component-request","compiler:gap-detected","renderer:unknown-component"]},{id:"component-review",description:"Review generated artifacts and feed the evaluator pipeline",triggers:["workflow:component-request:generated"]},{id:"component-evolve",description:"Run scheduled reevaluations and trigger upgrade tasks",triggers:["cron:daily-02:00"]}],protocols:{rest:!0,a2a:!0,mcp:!0},observability:"builtin"}}function aa(){let e=Er({pluginId:"uibot.hub-runtime",version:"0.1.0",displayName:"UIBot Hub Runtime",description:"Official UIBot Hub runtime for orchestration, protocol surfaces, and evaluations.",sdkRange:"^0.1.0",engineRange:"^0.1.0",capabilities:[{id:"uibot.hub.runtime",type:"agent:runtime",description:"UIBot Hub workflow runtime for orchestration"},{id:"uibot.hub.a2a",type:"protocol:adapter",description:"A2A adapter provided by UIBot Hub runtime"},{id:"uibot.hub.mcp",type:"protocol:adapter",description:"MCP adapter provided by UIBot Hub runtime"},{id:"uibot.hub.evals",type:"evaluation:runner",description:"Evaluation bridge executed via UIBot Hub workflow surfaces"}],permissions:[{resource:"network:https",reason:"Connect to model providers and remote registries",required:!0},{resource:"remote:execute",reason:"Coordinate signed remote workers for long-running generation jobs",required:!1}]});return wr({manifest:e,register(t){let r=Yi(),n=[H({id:"uibot.hub.runtime",type:"agent:runtime",description:"UIBot Hub workflow runtime",contribution:r}),H({id:"uibot.hub.a2a",type:"protocol:adapter",description:"A2A support through UIBot Hub runtime",contribution:r.protocols}),H({id:"uibot.hub.mcp",type:"protocol:adapter",description:"MCP support through UIBot Hub runtime",contribution:r.protocols}),H({id:"uibot.hub.evals",type:"evaluation:runner",description:"Evaluation entrypoints managed by UIBot Hub workflows",contribution:r.workflows})];for(let o of n)t.addCapability(o)}})}function ne(e){return{...e,request:{...e.request},...e.artifact?{artifact:{...e.artifact}}:{}}}function Ki(e,t){let r=t.status??e.status,n={...e,status:r,updatedAt:t.updatedAt??new Date().toISOString()};if(typeof t.progress==="number")n.progress=t.progress;else if(r==="ready")n.progress=100;else if(r==="failed")delete n.progress;if(t.artifact)n.artifact=t.artifact;else if(r!=="ready")delete n.artifact;if(typeof t.error==="string")n.error=t.error;else if(r!=="failed")delete n.error;if(r==="ready")delete n.error;return n}function Sr(){let e=new Map;return{createTask(t){let r=t.createdAt??new Date().toISOString(),n={taskId:t.taskId,request:{...t.request},status:"pending",createdAt:r,updatedAt:r};return e.set(n.taskId,n),ne(n)},getTask(t){let r=e.get(t);return r?ne(r):void 0},listTasks(){return[...e.values()].map((t)=>ne(t))},updateTask(t,r){let n=e.get(t);if(!n)throw Error(`Hub task not found: ${t}`);let o=Ki(n,r);return e.set(t,o),ne(o)}}}function Ar(e){if(e instanceof Error)return e.message;return typeof e==="string"?e:"Unknown Hub task error"}function Pe(e="/api/hub"){return(e.startsWith("/")?e:`/${e}`).replace(/\/+$/,"")||"/api/hub"}function Ji(e,t,r){function n(o,i){return t.updateTask(e,{status:o,...typeof i?.progress==="number"?{progress:i.progress}:{},updatedAt:r().toISOString()})}return{taskId:e,getSnapshot(){let o=t.getTask(e);if(!o)throw Error(`Hub task not found: ${e}`);return o},markPending(o){return n("pending",typeof o==="number"?{progress:o}:void 0)},markRunning(o){return n("running",typeof o==="number"?{progress:o}:void 0)},markReady(o){return t.updateTask(e,{status:"ready",artifact:o,updatedAt:r().toISOString()})},markFailed(o){return t.updateTask(e,{status:"failed",error:o,updatedAt:r().toISOString()})}}}function Xi(e){switch(e.status){case"ready":if(!e.artifact)throw Error(`Hub task ${e.taskId} is ready but artifact is missing`);return{taskId:e.taskId,status:"ready",artifact:e.artifact};case"failed":return{taskId:e.taskId,status:"failed",error:e.error??"Unknown Hub task error"};case"pending":case"running":return{taskId:e.taskId,status:e.status,...typeof e.progress==="number"?{progress:e.progress}:{}}}}function Qi(e,t){Promise.resolve().then(async()=>{let r=await e.run(t);if(r)t.markReady(r)}).catch((r)=>{t.markFailed(Ar(r))})}function da(e){let t=Pe(e.basePath),r=e.taskStore??Sr(),n=e.clock??(()=>new Date),o=e.createTaskId??(()=>crypto.randomUUID());return{async requestComponent(i){let s=o(),a=r.createTask({taskId:s,request:i,createdAt:n().toISOString()}),l=Ji(s,r,n),c;try{c=await e.requestComponent({payload:i,task:a,controller:l})}catch(C){throw l.markFailed(Ar(C)),C}if(c.mode==="ready")return l.markReady(c.artifact),{status:"ready",artifact:c.artifact};if(c.initialStatus==="running")l.markRunning(c.progress);else if(typeof c.progress==="number")l.markPending(c.progress);Qi(c,l);let u=l.getSnapshot();if(u.status==="ready"&&u.artifact)return{status:"ready",artifact:u.artifact};if(u.status==="failed")throw Error(u.error??"Unknown Hub task error");return{status:u.status==="running"?"running":"pending",taskId:s,pollUrl:`${t}/tasks/${s}`}},getTask(i){return r.getTask(i)},listTasks(){return r.listTasks()},getTaskStatus(i){let s=r.getTask(i);return s?Xi(s):void 0}}}function Ee(e,t=200){return Response.json(e,{status:t})}function B(e,t){return Ee({error:t},e)}function ma(e){let t=Pe(e.basePath),r=`${t}/components/request`,n=`${t}/tasks/`;return async function(i){let s=new URL(i.url);if(i.method==="POST"&&s.pathname===r){let a;try{a=await i.json()}catch{return B(400,"Invalid JSON payload")}if(!a.name)return B(400,"Field 'name' is required");try{let l=await e.service.requestComponent(a),c=l.status==="ready"?200:202;return Ee(l,c)}catch(l){return B(500,l instanceof Error?l.message:"Hub request failed")}}if(i.method==="GET"&&s.pathname.startsWith(n)){let a=decodeURIComponent(s.pathname.slice(n.length));if(!a||a.includes("/"))return B(404,"Task not found");let l=e.service.getTaskStatus(a);return l?Ee(l):B(404,"Task not found")}return B(404,"Not found")}}function Zi(e){return{mode:"ready",artifact:e.artifact}}function es(e){return{mode:"async",...e.initialStatus?{initialStatus:e.initialStatus}:{},...typeof e.progress==="number"?{progress:e.progress}:{},async run(){return e.waitForResult?await e.waitForResult():void 0}}}function ya(e){let t=e.workflowId??"component-request";return async function(n){let o=await e.runtime.runWorkflow({workflowId:t,input:n.payload,taskId:n.task.taskId});return o.state==="ready"?Zi(o):es(o)}}function ts(e){if(e.status==="ready")return{status:"completed",state:"ready",artifact:e.artifact};return{id:e.taskId,status:"working",state:e.status}}function rs(e){switch(e.status){case"ready":return{id:e.taskId,status:"completed",state:"ready",artifact:e.artifact};case"failed":return{id:e.taskId,status:"failed",state:"failed",error:e.error};case"pending":case"running":return{id:e.taskId,status:"working",state:e.status,...typeof e.progress==="number"?{progress:e.progress}:{}}}}function we(e,t){return{jsonrpc:"2.0",id:e,result:t}}function V(e,t,r){return{jsonrpc:"2.0",id:e,error:{code:t,message:r}}}function ns(e,t){return{name:"UIBot ComponentHub",description:"AI-driven component hub that generates, maintains, and evolves UI components on demand.",url:e.replace(/\/+$/,""),version:"1.0.0",protocolVersion:"1.0",provider:{organization:"UIBot",url:"https://github.com/Foundj/uibot"},capabilities:{streaming:!1,pushNotifications:!1,stateTransitionHistory:!1},authentication:{schemes:["none","bearer"]},skills:[{id:"component-request",name:"Request Component Generation",description:"Request generation of a missing UI component.",inputModes:["text","data"],outputModes:["text","data"],examples:["Generate a KanbanBoard component","I need a multi-step form wizard component"]},{id:"get-task-status",name:"Get Task Status",description:"Read the status of an existing Hub task.",inputModes:["data"],outputModes:["data"]}],...t}}function oe(e,t=200){return Response.json(e,{status:t})}function ba(e){let t=ns(e.baseUrl,e.card),r=e.agentCardPath??"/.well-known/agent.json",n=e.rpcPath??"/api/a2a",o=async(s)=>{let a=s.id??null;try{switch(s.method){case"agent.getCard":return we(a,t);case"component.request":{let l=s.params??{},c=typeof l.name==="string"?l.name:"";if(!c)return V(a,-32602,"Field 'name' is required");let u=await e.service.requestComponent({name:c,...typeof l.context==="string"?{context:l.context}:{},...typeof l.requestedBy==="string"?{requestedBy:l.requestedBy}:{},...l.priority==="low"||l.priority==="normal"||l.priority==="high"?{priority:l.priority}:{}});return we(a,{task:ts(u)})}case"tasks.get":{let l=s.params??{},c=typeof l.taskId==="string"?l.taskId:"";if(!c)return V(a,-32602,"Field 'taskId' is required");let u=e.service.getTaskStatus(c);if(!u)return V(a,-32004,"Task not found");return we(a,{task:rs(u)})}}}catch(l){return V(a,-32000,l instanceof Error?l.message:"A2A request failed")}};return{card:t,handleJsonRpc:o,handleHttp:async(s)=>{let a=new URL(s.url);if(s.method==="GET"&&a.pathname===r)return oe(t);if(s.method==="POST"&&a.pathname===n){let l;try{l=await s.json()}catch{return oe(V(null,-32700,"Invalid JSON payload"),400)}let c=await o(l),u="error"in c?400:200;return oe(c,u)}return oe({error:"Not found"},404)}}}var ss={spec:["html","markdown","zip"],prototype:["html","zip"],deck:["html","pptx","zip"],poster:["html","zip"]},sl=Array.from(new Set(Object.values(ss).flat()));var Se=["component","template","design-guide","example","skill"],Ae=["experimental","candidate","recommended"];var ve=Object.freeze([Object.freeze({name:"manifest",summary:"Describe query operations and list the derived resource index.",positionals:Object.freeze([]),options:Object.freeze([])}),Object.freeze({name:"search",summary:"Search resources with deterministic bilingual ranking and reasons.",positionals:Object.freeze([Object.freeze({name:"text",property:"text",type:"string",required:!1})]),options:Object.freeze([Object.freeze({name:"kind",property:"kinds",type:"resource-kind",multiple:!0,cliEncoding:"comma-separated"}),Object.freeze({name:"tag",property:"tags",type:"string",multiple:!0,cliEncoding:"comma-separated"}),Object.freeze({name:"category",property:"categories",type:"string",multiple:!0,cliEncoding:"comma-separated"}),Object.freeze({name:"capability",property:"capabilities",type:"string",multiple:!0,cliEncoding:"comma-separated"}),Object.freeze({name:"maturity",property:"maturities",type:"resource-maturity",multiple:!0,cliEncoding:"comma-separated"}),Object.freeze({name:"limit",property:"limit",type:"positive-integer"})])}),Object.freeze({name:"get",summary:"Resolve one canonical resource id or unambiguous alias.",positionals:Object.freeze([Object.freeze({name:"id-or-alias",property:"id",type:"string",required:!0})]),options:Object.freeze([])}),Object.freeze({name:"build",summary:"Plan dependency closure and gaps without writing or installing.",positionals:Object.freeze([Object.freeze({name:"root",property:"roots",type:"string",required:!0,variadic:!0})]),options:Object.freeze([])})]);var Or=["resource-mcp-invalid-argument","resource-query-failed"];function ie(e,t){return`Tool '${e}' is not wired in this build: no '${t}' discovery provider was supplied. `+`This is not an empty result \u2014 supply a 'discovery.${t}' provider to enable it.`}function vr(e){return`Tool '${e}' is not wired in this build: no Hub service was supplied. Supply a service to enable component requests and task status.`}function as(e){if(e.status==="ready")return{status:"ready",artifact:e.artifact};return{status:e.status,taskId:e.taskId,pollUrl:e.pollUrl}}function ls(e){switch(e.status){case"ready":return{taskId:e.taskId,status:"ready",artifact:e.artifact};case"failed":return{taskId:e.taskId,status:"failed",error:e.error};case"pending":case"running":return{taskId:e.taskId,status:e.status,...typeof e.progress==="number"?{progress:e.progress}:{}}}}function A(e){return{content:[{type:"json",json:e}]}}function k(e){return{content:[{type:"text",text:e}],isError:!0}}function Te(e,t){return{content:[{type:"json",json:{error:{code:e,detail:t}}}],isError:!0}}var ae="uibot_resource_";function cs(e){return`${ae}${e}`}function Tr(e,t){let r;if(e==="resource-kind")r={type:"string",enum:[...Se]};else if(e==="resource-maturity")r={type:"string",enum:[...Ae]};else if(e==="positive-integer")r={type:"integer",minimum:1};else r={type:"string"};return t?{type:"array",items:r}:r}function us(){return ve.map((e)=>{let t={},r=[];for(let n of e.positionals)if(t[n.property]=Tr(n.type,"variadic"in n&&n.variadic===!0),n.required)r.push(n.property);for(let n of e.options)t[n.property]=Tr(n.type,"multiple"in n&&n.multiple===!0);return{name:cs(e.name),description:e.summary,inputSchema:{type:"object",properties:t,additionalProperties:!1,...r.length?{required:r}:{}}}})}class v extends Error{detail;code=Or[0];constructor(e){super(e);this.detail=e;this.name="ResourceMcpArgumentError"}}function se(e,t){let r=new Set(t),n=Object.keys(e).find((o)=>!r.has(o));if(n)throw new v(`unsupported argument: ${n}`)}function Dr(e,t){let r=e[t];if(r===void 0)return;if(typeof r!=="string"||!r.trim())throw new v(`${t} must be a non-empty string`);return r}function U(e,t,r){let n=e[t];if(n===void 0)return;if(!Array.isArray(n)||n.length===0||n.some((o)=>typeof o!=="string"||!o.trim()))throw new v(`${t} must be a non-empty string array`);if(r){let o=n.find((i)=>!r.includes(i));if(o)throw new v(`${t} contains unsupported value: ${o}`)}return n}function ds(e){if(e instanceof v)return Te(e.code,e.detail);if(e&&typeof e==="object"){let t=e;if(typeof t.code==="string"){let r=typeof t.detail==="string"?t.detail:typeof t.message==="string"?t.message:t.code;return Te(t.code,r)}}return Te(Or[1],"resource query callback failed")}async function ps(e,t,r){try{if(e==="manifest")return se(t,[]),A({data:{index:await r.manifest()}});if(e==="search"){se(t,["text","kinds","tags","categories","capabilities","maturities","limit"]);let o=Dr(t,"text"),i=U(t,"kinds",Se),s=U(t,"tags"),a=U(t,"categories"),l=U(t,"capabilities"),c=U(t,"maturities",Ae),u=t.limit;if(u!==void 0&&(typeof u!=="number"||!Number.isInteger(u)||u<=0))throw new v("limit must be a positive integer");let y={...o?{text:o}:{},...i?{kinds:i}:{},...s?{tags:s}:{},...a?{categories:a}:{},...l?{capabilities:l}:{},...c?{maturities:c}:{},...typeof u==="number"?{limit:u}:{}};return A({data:{matches:await r.search(y)}})}if(e==="get"){se(t,["id"]);let o=Dr(t,"id");if(!o)throw new v("id must be a non-empty string");return A({data:{resource:await r.get(o)}})}se(t,["roots"]);let n=U(t,"roots");if(!n)throw new v("roots must be a non-empty string array");return A({data:{plan:await r.build(n)}})}catch(n){return ds(n)}}function dc(e){let t=[{name:"uibot_request_component",description:"Request a missing component from the UIBot Hub runtime.",inputSchema:{type:"object",properties:{name:{type:"string",description:"Component name"},context:{type:"string",description:"Optional usage context"},requestedBy:{type:"string",description:"Requester identifier"},priority:{type:"string",enum:["low","normal","high"]}},required:["name"]}},{name:"uibot_get_task_status",description:"Read the status of a Hub task.",inputSchema:{type:"object",properties:{taskId:{type:"string",description:"Hub task identifier"}},required:["taskId"]}},{name:"uibot_list_catalog",description:"List catalog components available to agents (read-only discovery). Returns name/description/category entries.",inputSchema:{type:"object",properties:{query:{type:"string",description:"Optional substring filter on name/description"}}}},{name:"uibot_get_design_md",description:"Get design-md entries (read-only). Omit id to list summaries; provide id for one full entry.",inputSchema:{type:"object",properties:{id:{type:"string",description:"Optional design-md id"}}}},{name:"uibot_list_templates",description:"List installable UIBot templates (read-only discovery).",inputSchema:{type:"object",properties:{query:{type:"string",description:"Optional substring filter"}}}},{name:"uibot_validate",description:"Validate a generated artifact. Pass `spec` (UIBot Spec object, or JSON/YAML text) to compile it against the catalog and get missing-component gaps and warnings; pass `html` to run the design-quality rules. Fix every gap before handing the result on.",inputSchema:{type:"object",properties:{spec:{description:"UIBot Spec object, or its JSON/YAML text"},html:{type:"string",description:"Generated HTML document"}}}},...us()];return{listTools(){return t.filter((r)=>{if(r.name==="uibot_request_component")return e.serviceAvailable!==!1;if(r.name==="uibot_get_task_status")return e.serviceAvailable!==!1;if(r.name==="uibot_list_catalog")return e.discovery?.listCatalog!=null;if(r.name==="uibot_get_design_md")return e.discovery?.getDesignMd!=null;if(r.name==="uibot_list_templates")return e.discovery?.listTemplates!=null;if(r.name==="uibot_validate")return e.validate!=null;if(r.name.startsWith(ae))return e.resourceQuery!=null;return!0})},async callTool(r,n){if(r.startsWith(ae)){let o=r.slice(ae.length);if(!ve.some((s)=>s.name===o))return k(`Unknown tool: ${r}`);if(!e.resourceQuery)return k(ie(r,"resourceQuery"));return ps(o,n,e.resourceQuery)}if(r==="uibot_request_component"){if(e.serviceAvailable===!1)return k(vr(r));let o=typeof n.name==="string"?n.name:"";if(!o)return k("Field 'name' is required");let i=await e.service.requestComponent({name:o,...typeof n.context==="string"?{context:n.context}:{},...typeof n.requestedBy==="string"?{requestedBy:n.requestedBy}:{},...n.priority==="low"||n.priority==="normal"||n.priority==="high"?{priority:n.priority}:{}});return A(as(i))}if(r==="uibot_get_task_status"){if(e.serviceAvailable===!1)return k(vr(r));let o=typeof n.taskId==="string"?n.taskId:"";if(!o)return k("Field 'taskId' is required");let i=e.service.getTaskStatus(o);return i?A(ls(i)):k("Task not found")}if(r==="uibot_list_catalog"){let o=e.discovery?.listCatalog;if(!o)return k(ie(r,"listCatalog"));let i=await o(),s=Array.isArray(i)?i:[],a=typeof n.query==="string"?n.query.toLowerCase():"",l=a?s.filter((c)=>JSON.stringify(c).toLowerCase().includes(a)):s;return A({items:l,count:l.length})}if(r==="uibot_get_design_md"){let o=e.discovery?.getDesignMd;if(!o)return k(ie(r,"getDesignMd"));let i=typeof n.id==="string"?n.id:void 0,s=await o(i)??(i?null:[]);return A({id:i??null,data:s})}if(r==="uibot_list_templates"){let o=e.discovery?.listTemplates;if(!o)return k(ie(r,"listTemplates"));let i=await o(),s=Array.isArray(i)?i:[],a=typeof n.query==="string"?n.query.toLowerCase():"",l=a?s.filter((c)=>JSON.stringify(c).toLowerCase().includes(a)):s;return A({items:l,count:l.length})}if(r==="uibot_validate"){if(!e.validate)return k(`Tool '${r}' is not wired in this build: no 'validate' provider was supplied.`);let o=typeof n.html==="string"?n.html:void 0;if(n.spec===void 0&&o===void 0)return k("Provide 'spec' or 'html'");try{return A(await e.validate({...n.spec===void 0?{}:{spec:n.spec},...o===void 0?{}:{html:o}}))}catch(i){return k(i instanceof Error?i.message:String(i))}}return k(`Unknown tool: ${r}`)}}}export{Or as RESOURCE_MCP_ERROR_CODES,ns as createDefaultUIBotHubA2AAgentCard,Yi as createDefaultUIBotHubBlueprint,Sr as createInMemoryUIBotHubTaskStore,ba as createUIBotHubA2AHandler,ma as createUIBotHubHttpHandler,dc as createUIBotHubMcpAdapter,aa as createUIBotHubPlugin,da as createUIBotHubService,ya as createUIBotHubWorkflowRequestRunner,Pe as normalizeHubBasePath};
package/dist/mcp.d.ts ADDED
@@ -0,0 +1,74 @@
1
+ import { type ResourceQuery } from "@uibot/contracts";
2
+ import type { UIBotHubService } from "./service.js";
3
+ export interface UIBotHubMcpTool {
4
+ name: string;
5
+ description: string;
6
+ inputSchema: {
7
+ type: "object";
8
+ properties: Record<string, unknown>;
9
+ required?: string[];
10
+ additionalProperties?: false;
11
+ };
12
+ }
13
+ export declare const RESOURCE_MCP_ERROR_CODES: readonly ["resource-mcp-invalid-argument", "resource-query-failed"];
14
+ export interface UIBotHubMcpTextContent {
15
+ type: "text";
16
+ text: string;
17
+ }
18
+ export interface UIBotHubMcpJsonContent {
19
+ type: "json";
20
+ json: unknown;
21
+ }
22
+ export type UIBotHubMcpContent = UIBotHubMcpTextContent | UIBotHubMcpJsonContent;
23
+ export interface UIBotHubMcpToolCallResult {
24
+ content: UIBotHubMcpContent[];
25
+ isError?: boolean;
26
+ }
27
+ export interface UIBotHubMcpAdapter {
28
+ listTools(): UIBotHubMcpTool[];
29
+ callTool(name: string, args: Record<string, unknown>): Promise<UIBotHubMcpToolCallResult>;
30
+ }
31
+ export interface UIBotHubResourceQueryCallbacks {
32
+ manifest(): Promise<unknown> | unknown;
33
+ search(query: ResourceQuery): Promise<unknown> | unknown;
34
+ get(id: string): Promise<unknown> | unknown;
35
+ build(roots: readonly string[]): Promise<unknown> | unknown;
36
+ }
37
+ export interface CreateUIBotHubMcpAdapterOptions {
38
+ service: UIBotHubService;
39
+ /**
40
+ * Whether the supplied service has a real component/task backend.
41
+ *
42
+ * Defaults to true for compatibility. A transport may supply a fail-loud
43
+ * offline service with false so direct calls remain diagnosable without
44
+ * advertising Hub tools that cannot succeed.
45
+ */
46
+ serviceAvailable?: boolean;
47
+ /**
48
+ * Optional discovery providers for read-only capability surface tools (v2.28).
49
+ *
50
+ * A tool whose provider is omitted is not advertised. Direct calls still
51
+ * fail loudly so "no provider" and "the provider found nothing" remain
52
+ * different facts.
53
+ */
54
+ discovery?: {
55
+ listCatalog?: () => Promise<unknown[]> | unknown[];
56
+ getDesignMd?: (id?: string) => Promise<unknown> | unknown;
57
+ listTemplates?: () => Promise<unknown[]> | unknown[];
58
+ };
59
+ /**
60
+ * Framework-neutral callbacks for the canonical resource query service.
61
+ * Hub runtime owns only MCP transport mapping and never imports registry.
62
+ */
63
+ resourceQuery?: UIBotHubResourceQueryCallbacks;
64
+ /**
65
+ * Validates a generated artifact before an agent hands it on: a UIBot Spec
66
+ * (object, or JSON/YAML text) is compiled against the catalog; HTML is checked
67
+ * against the design-quality rules. Not advertised when omitted.
68
+ */
69
+ validate?: (input: {
70
+ spec?: unknown;
71
+ html?: string;
72
+ }) => Promise<unknown> | unknown;
73
+ }
74
+ export declare function createUIBotHubMcpAdapter(options: CreateUIBotHubMcpAdapterOptions): UIBotHubMcpAdapter;
@@ -0,0 +1,42 @@
1
+ import type { ComponentArtifact, HubComponentRequestPayload, HubComponentRequestResponse, HubTaskStatusResponse } from "@uibot/contracts";
2
+ import { type UIBotHubTaskRecord, type UIBotHubTaskStore } from "./task-store.js";
3
+ export interface UIBotHubTaskController {
4
+ readonly taskId: string;
5
+ getSnapshot(): UIBotHubTaskRecord;
6
+ markPending(progress?: number): UIBotHubTaskRecord;
7
+ markRunning(progress?: number): UIBotHubTaskRecord;
8
+ markReady(artifact: ComponentArtifact): UIBotHubTaskRecord;
9
+ markFailed(error: string): UIBotHubTaskRecord;
10
+ }
11
+ export interface UIBotHubReadyExecution {
12
+ mode: "ready";
13
+ artifact: ComponentArtifact;
14
+ }
15
+ export interface UIBotHubAsyncExecution {
16
+ mode: "async";
17
+ initialStatus?: "pending" | "running";
18
+ progress?: number;
19
+ run(controller: UIBotHubTaskController): Promise<ComponentArtifact | void> | ComponentArtifact | void;
20
+ }
21
+ export type UIBotHubComponentRequestExecution = UIBotHubReadyExecution | UIBotHubAsyncExecution;
22
+ export interface UIBotHubComponentRequestContext {
23
+ payload: HubComponentRequestPayload;
24
+ task: UIBotHubTaskRecord;
25
+ controller: UIBotHubTaskController;
26
+ }
27
+ export type UIBotHubComponentRequestRunner = (context: UIBotHubComponentRequestContext) => Promise<UIBotHubComponentRequestExecution> | UIBotHubComponentRequestExecution;
28
+ export interface CreateUIBotHubServiceOptions {
29
+ basePath?: string;
30
+ createTaskId?: () => string;
31
+ clock?: () => Date;
32
+ taskStore?: UIBotHubTaskStore;
33
+ requestComponent: UIBotHubComponentRequestRunner;
34
+ }
35
+ export interface UIBotHubService {
36
+ requestComponent(payload: HubComponentRequestPayload): Promise<HubComponentRequestResponse>;
37
+ getTask(taskId: string): UIBotHubTaskRecord | undefined;
38
+ listTasks(): UIBotHubTaskRecord[];
39
+ getTaskStatus(taskId: string): HubTaskStatusResponse | undefined;
40
+ }
41
+ export declare function normalizeHubBasePath(basePath?: string): string;
42
+ export declare function createUIBotHubService(options: CreateUIBotHubServiceOptions): UIBotHubService;
@@ -0,0 +1,31 @@
1
+ import type { ComponentArtifact, HubComponentRequestPayload } from "@uibot/contracts";
2
+ export type UIBotHubTaskStatus = "pending" | "running" | "ready" | "failed";
3
+ export interface UIBotHubTaskRecord {
4
+ taskId: string;
5
+ request: HubComponentRequestPayload;
6
+ status: UIBotHubTaskStatus;
7
+ progress?: number;
8
+ artifact?: ComponentArtifact;
9
+ error?: string;
10
+ createdAt: string;
11
+ updatedAt: string;
12
+ }
13
+ export interface CreateUIBotHubTaskInput {
14
+ taskId: string;
15
+ request: HubComponentRequestPayload;
16
+ createdAt?: string;
17
+ }
18
+ export interface UIBotHubTaskUpdate {
19
+ status?: UIBotHubTaskStatus;
20
+ progress?: number;
21
+ artifact?: ComponentArtifact;
22
+ error?: string;
23
+ updatedAt?: string;
24
+ }
25
+ export interface UIBotHubTaskStore {
26
+ createTask(input: CreateUIBotHubTaskInput): UIBotHubTaskRecord;
27
+ getTask(taskId: string): UIBotHubTaskRecord | undefined;
28
+ listTasks(): UIBotHubTaskRecord[];
29
+ updateTask(taskId: string, update: UIBotHubTaskUpdate): UIBotHubTaskRecord;
30
+ }
31
+ export declare function createInMemoryUIBotHubTaskStore(): UIBotHubTaskStore;
@@ -0,0 +1,26 @@
1
+ import type { ComponentArtifact, HubComponentRequestPayload } from "@uibot/contracts";
2
+ import type { UIBotHubComponentRequestRunner } from "./service.js";
3
+ export interface UIBotHubWorkflowInvocation {
4
+ workflowId: string;
5
+ input: HubComponentRequestPayload;
6
+ taskId: string;
7
+ }
8
+ export interface UIBotHubWorkflowReadyResult {
9
+ state: "ready";
10
+ artifact: ComponentArtifact;
11
+ }
12
+ export interface UIBotHubWorkflowAcceptedResult {
13
+ state: "accepted";
14
+ initialStatus?: "pending" | "running";
15
+ progress?: number;
16
+ waitForResult?: (() => Promise<ComponentArtifact | void>) | (() => ComponentArtifact | void);
17
+ }
18
+ export type UIBotHubWorkflowResult = UIBotHubWorkflowReadyResult | UIBotHubWorkflowAcceptedResult;
19
+ export interface UIBotHubWorkflowRuntime {
20
+ runWorkflow(invocation: UIBotHubWorkflowInvocation): Promise<UIBotHubWorkflowResult> | UIBotHubWorkflowResult;
21
+ }
22
+ export interface CreateUIBotHubWorkflowRunnerOptions {
23
+ runtime: UIBotHubWorkflowRuntime;
24
+ workflowId?: string;
25
+ }
26
+ export declare function createUIBotHubWorkflowRequestRunner(options: CreateUIBotHubWorkflowRunnerOptions): UIBotHubComponentRequestRunner;
package/package.json CHANGED
@@ -1,6 +1,41 @@
1
1
  {
2
2
  "name": "@uibot/hub-runtime",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.2.0",
4
+ "license": "MIT",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/Foundj/uibot.git",
8
+ "directory": "packages/hub-runtime"
9
+ },
10
+ "type": "module",
11
+ "main": "./dist/index.js",
12
+ "module": "./dist/index.js",
13
+ "types": "./dist/index.d.ts",
14
+ "exports": {
15
+ ".": {
16
+ "types": "./dist/index.d.ts",
17
+ "default": "./dist/index.js"
18
+ }
19
+ },
20
+ "files": [
21
+ "dist",
22
+ "!dist/**/*.map",
23
+ "!dist/**/*.test.d.ts",
24
+ "!dist/**/*.spec.d.ts"
25
+ ],
26
+ "publishConfig": {
27
+ "access": "public"
28
+ },
29
+ "dependencies": {
30
+ "@uibot/contracts": "^0.2.0",
31
+ "@uibot/plugin-sdk": "^0.2.0"
32
+ },
33
+ "devDependencies": {
34
+ "@uibot/application": "^0.2.0"
35
+ },
36
+ "scripts": {
37
+ "build": "rm -rf dist && bun build --minify ./src/index.ts --outdir ./dist --format esm --target bun && bun x tsc -p tsconfig.json",
38
+ "typecheck": "bun x tsc -p tsconfig.json --noEmit",
39
+ "test": "bun test"
40
+ }
41
+ }
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.