@uibot/application 0.0.0-stage → 0.2.1

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.
Files changed (74) hide show
  1. package/dist/collection-application.d.ts +3 -0
  2. package/dist/collection-application.js +25 -0
  3. package/dist/compose-system-prompt.d.ts +104 -0
  4. package/dist/composition.d.ts +24 -0
  5. package/dist/context-service.d.ts +42 -0
  6. package/dist/creation-annotations.d.ts +5 -0
  7. package/dist/creation-assets.d.ts +15 -0
  8. package/dist/creation-brand-http.d.ts +9 -0
  9. package/dist/creation-brand.d.ts +25 -0
  10. package/dist/creation-copy.d.ts +11 -0
  11. package/dist/creation-domains.d.ts +25 -0
  12. package/dist/creation-facts.d.ts +8 -0
  13. package/dist/creation-http-helpers.d.ts +35 -0
  14. package/dist/creation-http.d.ts +99 -0
  15. package/dist/creation-layout.d.ts +4 -0
  16. package/dist/creation-legacy-flat-spec.d.ts +42 -0
  17. package/dist/creation-prompt.d.ts +33 -0
  18. package/dist/creation-requirements.d.ts +6 -0
  19. package/dist/creation-routes.d.ts +26 -0
  20. package/dist/creation-runner.d.ts +20 -0
  21. package/dist/creation-schema-ids.d.ts +6 -0
  22. package/dist/creation-spec-prompt.d.ts +3 -0
  23. package/dist/creation-store.d.ts +121 -0
  24. package/dist/creation-theme-http.d.ts +13 -0
  25. package/dist/creation-theme.d.ts +16 -0
  26. package/dist/creation-web-data-prompt.d.ts +15 -0
  27. package/dist/discovery-protocol.d.ts +25 -0
  28. package/dist/gap-orchestrator.d.ts +19 -0
  29. package/dist/grounded-brief.d.ts +37 -0
  30. package/dist/html-preview/config.d.ts +14 -0
  31. package/dist/html-preview/index.d.ts +11 -0
  32. package/dist/html-preview/link-interceptor.d.ts +10 -0
  33. package/dist/html-preview/proxy.d.ts +57 -0
  34. package/dist/html-preview/render.d.ts +39 -0
  35. package/dist/html-preview/routes.d.ts +27 -0
  36. package/dist/html-preview/session-store.d.ts +44 -0
  37. package/dist/hub-client.d.ts +25 -0
  38. package/dist/index.d.ts +32 -0
  39. package/dist/index.js +819 -0
  40. package/dist/live-runtime-adapter.d.ts +11 -0
  41. package/dist/playground-session-http.d.ts +24 -0
  42. package/dist/prompt.d.ts +17 -0
  43. package/dist/resource-apply.d.ts +18 -0
  44. package/dist/runtime.d.ts +37 -0
  45. package/dist/studio-artifact-export-http.d.ts +52 -0
  46. package/dist/studio-compose-context.d.ts +47 -0
  47. package/dist/studio-compose-http.d.ts +31 -0
  48. package/dist/studio-design-http.d.ts +164 -0
  49. package/dist/studio-design-md-export-http.d.ts +11 -0
  50. package/dist/studio-http-shared.d.ts +34 -0
  51. package/dist/studio-http.d.ts +359 -0
  52. package/dist/studio-logo.d.ts +24 -0
  53. package/dist/studio-pages/agents-page.d.ts +48 -0
  54. package/dist/studio-pages/catalog-page.d.ts +22 -0
  55. package/dist/studio-pages/design-md-page.d.ts +55 -0
  56. package/dist/studio-pages/evolution-page.d.ts +111 -0
  57. package/dist/studio-pages/governance-page.d.ts +65 -0
  58. package/dist/studio-pages/index.d.ts +82 -0
  59. package/dist/studio-pages/models-page.d.ts +76 -0
  60. package/dist/studio-pages/operations-page.d.ts +61 -0
  61. package/dist/studio-pages/overview-page.d.ts +90 -0
  62. package/dist/studio-pages/plugins-page.d.ts +36 -0
  63. package/dist/studio-pages/shared.d.ts +25 -0
  64. package/dist/studio-pages/skills-page.d.ts +59 -0
  65. package/dist/studio-pages/spec-page.d.ts +33 -0
  66. package/dist/studio-project-design-http.d.ts +41 -0
  67. package/dist/studio-project-specs.d.ts +11 -0
  68. package/dist/studio-resource-index-http.d.ts +17 -0
  69. package/dist/studio-spec-recover-http.d.ts +45 -0
  70. package/dist/studio-spec-sync-http.d.ts +43 -0
  71. package/dist/studio.d.ts +64 -0
  72. package/dist/ui-craft-baseline.d.ts +14 -0
  73. package/package.json +49 -4
  74. package/README.md +0 -3
@@ -0,0 +1,3 @@
1
+ import { type PagedCollectionApplicationBuild, type CompiledCollectionApplication } from "@uibot/contracts";
2
+ export declare function compileCollectionApplication(build: PagedCollectionApplicationBuild, uibotCommit: string): Promise<CompiledCollectionApplication>;
3
+ export declare function exportCollectionApplication(build: PagedCollectionApplicationBuild, uibotCommit: string): Promise<import("@uibot/artifact-exporters").ArtifactExportResult>;
@@ -0,0 +1,25 @@
1
+ function ee(e){return{...e,components:e.components,actions:e.actions??{},templates:e.templates??{}}}var te=["SetState","ResetState","Request","Link","Validate","DisplayMessage","Login","Logout","CallMethod"],W={SetState:{name:"SetState",description:"Set a page state path to an evaluated declarative value",params:{path:{type:"string"},value:{description:"Literal or supported PropValue expression"}},generation:{evaluatedParams:["value"],prerequisites:["Declare the state path on the same page"],example:{action:"SetState",params:{path:"open",value:{_not:{_state:"open"}}}}}},ResetState:{name:"ResetState",description:"Restore paths from the supplied initial map; missing values become null",params:{paths:{type:"array",items:{type:"string"}},initial:{type:"object"}},generation:{evaluatedParams:[],prerequisites:["Supply literal initial values; omitting paths resets keys in initial"],example:{action:"ResetState",params:{paths:["open"],initial:{open:!1}}}}},Request:{name:"Request",description:"Execute a configured connection request",params:{connectionId:{type:"string"},request:{type:"object"},loadingPath:{type:"string"},responsePath:{type:"string"},errorPath:{type:"string"}},generation:{evaluatedParams:["connectionId","request"],prerequisites:["Host must inject the declared connection driver and secrets; Studio local Spec preview does not"],example:{action:"Request",params:{connectionId:"projects",request:{id:"list",connectionId:"projects",payload:{operation:"FindAll",resource:"projects"}},responsePath:"rows"}}}},Link:{name:"Link",description:"Emit navigation to a literal URL or page path",params:{path:{type:"string"},url:{type:"string"},target:{enum:["_self","_blank"]}},generation:{evaluatedParams:[],prerequisites:["Host handles navigation; local page paths must exist"],example:{action:"Link",params:{path:"/details"}}}},Validate:{name:"Validate",description:"Emit form validation event; does not itself throw for invalid fields",params:{formId:{type:"string"},errorPath:{type:"string"}},generation:{evaluatedParams:[],prerequisites:["Requires host form:validate listener; prefer native required controls and Form.Submit"],example:{action:"Validate",params:{formId:"contact"}}}},DisplayMessage:{name:"DisplayMessage",description:"Emit an evaluated message for the host to display",params:{message:{description:"Literal or supported PropValue expression"},level:{enum:["info","success","warning","error"]},duration:{type:"number"}},generation:{evaluatedParams:["message"],prerequisites:["Requires host message:display listener"],example:{action:"DisplayMessage",params:{message:"Saved locally",level:"success"}}}},Login:{name:"Login",description:"Set a supplied local session user or request external login",params:{user:{type:"object"},provider:{type:"string"}},generation:{evaluatedParams:[],prerequisites:["Requires host session/auth; setting a local user is not server authentication"],example:{action:"Login",params:{provider:"configured-provider"}}}},Logout:{name:"Logout",description:"Clear the local session and emit auth:logout",params:{},generation:{evaluatedParams:[],prerequisites:["Host owns server session invalidation"],example:{action:"Logout",params:{}}}},CallMethod:{name:"CallMethod",description:"Emit a call to an existing block method",params:{blockId:{type:"string"},method:{type:"string"},args:{type:"array"}},generation:{evaluatedParams:["args"],prerequisites:["Requires an explicitly documented installed block method/listener; never invent a method"],example:{action:"CallMethod",params:{blockId:"documented-block",method:"documented-method",args:[]}}}}};var Fe={spec:["html","markdown","zip"],prototype:["html","zip"],deck:["html","pptx","zip"],poster:["html","zip"]},vr=Array.from(new Set(Object.values(Fe).flat()));var wr=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 P=(e)=>e!==null&&typeof e==="object"&&!Array.isArray(e),S=(e,t)=>Object.keys(e).every((r)=>t.includes(r)),R=(e,t)=>typeof e==="string"&&e.length>0&&e.length<=t,re=(e)=>typeof e==="number"&&Number.isSafeInteger(e)&&e>0,B=(e)=>typeof e==="string"&&/^[A-Za-z0-9_]{1,64}$/.test(e),ne=(e,t=100)=>Array.isArray(e)&&e.length<=t&&e.every(B)&&new Set(e).size===e.length;function Be(e){if(!P(e)||!S(e,["id","name","type","required","options","link","lookup","formula","rollup"])||!B(e.id)||!R(e.name,200)||!["singleLineText","longText","number","checkbox","date","singleSelect","multipleSelect","linkedRecord","lookup","formula","rollup"].includes(String(e.type))||e.required!==void 0&&typeof e.required!=="boolean")return!1;if(e.options!==void 0&&(!Array.isArray(e.options)||e.options.length>100||e.options.some((t)=>!P(t)||!S(t,["id","name"])||!B(t.id)||!R(t.name,200))||new Set(e.options.map((t)=>t.id)).size!==e.options.length))return!1;if(e.options!==void 0&&!["singleSelect","multipleSelect"].includes(String(e.type)))return!1;for(let[t,r,n]of[["linkedRecord","link",["collectionId","displayFieldId"]],["lookup","lookup",["linkFieldId","targetFieldId"]],["formula","formula",["expression"]],["rollup","rollup",["linkFieldId","targetFieldId","function"]]]){let o=e[r];if(e.type===t!==(o!==void 0))return!1;if(o!==void 0&&(!P(o)||!S(o,[...n])||n.some((i)=>!R(o[i],i==="expression"?2048:512))))return!1}return!0}function oe(e){if(!P(e)||!S(e,["id","collectionId","descriptor","view","uibotCommit","authorId","createdAt","digest"])||!/^[a-f0-9]{64}$/.test(String(e.id))||!/^[a-f0-9]{64}$/.test(String(e.digest))||!/^[a-f0-9]{40}$/.test(String(e.uibotCommit))||!R(e.collectionId,512)||!R(e.authorId,512)||typeof e.createdAt!=="string"||!/^\d{4}-\d{2}-\d{2}T/.test(e.createdAt)||!Number.isFinite(Date.parse(e.createdAt)))return!1;try{if(new TextEncoder().encode(JSON.stringify(e)).length>131072)return!1}catch{return!1}let{descriptor:t,view:r}=e;if(!P(t)||!S(t,["id","name","schemaVersion","fields"])||t.id!==e.collectionId||!R(t.name,200)||!re(t.schemaVersion)||!Array.isArray(t.fields)||t.fields.length<1||t.fields.length>100||!t.fields.every(Be)||new Set(t.fields.map((i)=>i.id)).size!==t.fields.length)return!1;if(!P(r)||!S(r,["id","name","version","type","groupByFieldId","dateFieldId","search","filter","sort","columnOrder","hiddenColumns","columnWidths"])||!B(r.id)||!R(r.name,200)||!re(r.version)||!ne(r.columnOrder)||!ne(r.hiddenColumns)||!P(r.columnWidths)||Object.values(r.columnWidths).some((i)=>typeof i!=="number"||!Number.isInteger(i)||i<72||i>800))return!1;let n=t.fields,o=(i)=>n.some((s)=>P(s)&&s.id===i);if([...r.columnOrder,...r.hiddenColumns,...Object.keys(r.columnWidths)].some((i)=>!o(i)))return!1;if(r.type!==void 0&&!["grid","kanban","gallery","calendar","form"].includes(String(r.type)))return!1;if(r.type==="kanban"&&!t.fields.some((i)=>i.id===r.groupByFieldId&&["singleSelect","checkbox"].includes(i.type)))return!1;if(r.type==="calendar"&&!t.fields.some((i)=>i.id===r.dateFieldId&&i.type==="date"))return!1;if(r.search!==void 0&&(typeof r.search!=="string"||r.search.length>200))return!1;if(r.sort!==void 0&&(!Array.isArray(r.sort)||r.sort.length>4||r.sort.some((i)=>!P(i)||!S(i,["fieldId","direction"])||!o(i.fieldId)||!["asc","desc"].includes(String(i.direction)))))return!1;return!0}import{parse as Qn}from"yaml";class b extends Error{code;details;constructor(e,t,r){super(t);this.name="CompileSpecError",this.code=e,this.details=r}}function Me(e,t){let r=Object.hasOwn(t,e)?t[e]:void 0;if(!r)throw new b("unknown-template",`unknown template "${e}"`,{template:e});let n=r.pages[0]?.blocks[0];if(!n||n.type!=="PageLayout")throw new b("invalid-shell-root",`template "${e}" root is not PageLayout`,{template:e});return n}function M(e,t,r,n){let o=e;if(e.template){if(r.has(e.template))throw new b("template-cycle",`template cycle at "${e.template}"`,{template:e.template});let i=Me(e.template,t),s=new Set(r);s.add(e.template);let a={...i.slots,...e.slots};if(n&&!e.slots?.sidebar)delete a.sidebar;let l=e.children??i.children,c=e.events??i.events,p=e.visible??i.visible;return o={...i,...e.id?{id:e.id}:{},props:{...i.props,...e.props},slots:a,...l?{children:l}:{},...c?{events:c}:{},...p!==void 0?{visible:p}:{}},M(o,t,s,n)}return{...o,...o.children?{children:o.children.map((i)=>M(i,t,r,n))}:{},...o.slots?{slots:Object.fromEntries(Object.entries(o.slots).map(([i,s])=>[i,s.map((a)=>M(a,t,r,n))]))}:{}}}function Ne(e){let t=(r)=>{if(r.template)return!0;if(r.children?.some(t))return!0;return Object.values(r.slots??{}).some((n)=>n.some(t))};return e.pages.some((r)=>r.blocks.some(t))}function ie(e,t){return e.map((r)=>{if("children"in r&&Array.isArray(r.children))return{type:"MenuGroup",props:{title:r.label},children:ie(r.children,t)};let n=r,o={label:n.label,href:n.path};if(n.icon)o.icon=n.icon;if(n.path===t)o.active=!0;return{type:"MenuLink",props:o}})}function Le(e){let t=e.menus?.items;if(!t?.length)return e;return{...e,pages:e.pages.map((r)=>({...r,blocks:r.blocks.map((n)=>{if(n.type!=="PageLayout")return n;if(n.slots?.sidebar?.length)return n;return{...n,slots:{...n.slots,sidebar:[{type:"PageSiderMenu",props:{title:r.title??n.props?.title??"Menu"},children:ie(t,r.path)}]}}})}))}}function H(e,t={}){let r=Boolean(e.menus?.items?.length),n=Ne(e)?{...e,pages:e.pages.map((o)=>({...o,blocks:o.blocks.map((i)=>M(i,t,new Set,r))}))}:e;return Le(n)}function je(e){let t=new Map,r=new Map,n=new Map,o=(i,s)=>{if(i.id!==void 0){if(n.has(i.id)){let a=n.get(i.id);throw new b("duplicate-block-id",`Block id "${i.id}" is declared more than once`,{blockId:i.id,firstPageId:a,pageId:s})}n.set(i.id,s)}for(let a of i.children??[])o(a,s);for(let a of Object.values(i.slots??{}))for(let l of a)o(l,s)};return e.pages.forEach((i,s)=>{let a=t.get(i.id);if(a!==void 0)throw new b("duplicate-page-id",`Page id "${i.id}" is declared more than once`,{pageId:i.id,firstIndex:a,pageIndex:s});if(t.set(i.id,s),r.has(i.path)){let l=r.get(i.path);throw new b("duplicate-page-path",`Page path "${i.path}" is declared more than once`,{path:i.path,firstPageId:l,pageId:i.id})}r.set(i.path,i.id);for(let l of i.blocks)o(l,i.id)}),new Set(n.keys())}function Ve(e,t,r){while(!0){let n=t.counter++,o=r?`${r}_${n}`:`${e}_${n}`;if(!t.reservedIds.has(o)&&!t.assignedIds.has(o))return o}}function z(e,t,r,n,o,i){let s=e.id??Ve(t,n,i??o);if(n.assignedIds.has(s))throw new b("duplicate-block-id",`Block id "${s}" is declared more than once`,{blockId:s,pageId:t});n.assignedIds.add(s);let a=(e.children??[]).map((p)=>z(p,t,r,n,s,s)),l={};for(let[p,u]of Object.entries(e.slots??{}))l[p]=u.map((d)=>z(d,t,r,n,s,`${s}_${p}`));let c={id:s,pageId:t,type:e.type,...o?{parentId:o}:{},...e.props?{props:e.props}:{},...a.length?{children:a}:{},...Object.keys(l).length?{slots:l}:{},...e.events?{events:e.events}:{},...e.visible!==void 0?{visible:e.visible}:{},...e.template?{template:e.template}:{},...e.variant?{variant:e.variant}:{}};return r[s]=c,s}function G(e,t={}){e=H(e,t);let n={counter:0,reservedIds:je(e),assignedIds:new Set},o=Object.create(null);return{version:"2.0",pages:e.pages.map((s)=>{let a=[];for(let l of s.blocks)a.push(z(l,s.id,o,n));return{id:s.id,path:s.path,...s.title?{title:s.title}:{},rootBlockIds:a,...s.state?{state:s.state}:{},...s.auth?{auth:s.auth}:{},...s.lifecycle?{lifecycle:s.lifecycle}:{},...s.computed?{computed:s.computed}:{},...s.urlState?{urlState:s.urlState}:{}}}),...e.design?{design:e.design}:{},...e.connections?{connections:e.connections.map((s)=>({...s}))}:{},blocks:o}}var T=[{id:"_state",generation:{syntax:"page-state path",positions:["props","computed","action-value","visible"],example:{_state:"open"},prerequisite:"Declare the path on the same page"},bucket:"client",description:"Reads a value from the page state store"},{id:"_bindState",generation:{syntax:"page-state path",positions:["binding"],example:{_bindState:"name"},prerequisite:"Only installed controls implementing two-way binding"},bucket:"client",description:"Two-way state binding (read + write)"},{id:"_payload",generation:{syntax:"payload field",positions:["request-context"],example:{_payload:"name"},prerequisite:"Caller must supply request payload; ordinary preview props have no payload"},bucket:"client",description:"Request payload field"},{id:"_event",generation:{syntax:"event field",positions:["action-value"],example:{_event:"value"},prerequisite:"Only within an event action; permitted fields: type,name,value,checked,values"},bucket:"client",description:"Event payload field (e.g. form submit value)"},{id:"_global",generation:{syntax:"host-global field",positions:["host-context"],example:{_global:"configuredValue"},prerequisite:"Host-dependent and excluded from ordinary creation; no secrets"},bucket:"client",description:"Global (window) property access"},{id:"_if",generation:{syntax:"[condition, then, else]",positions:["props","computed","action-value"],example:{_if:[{_state:"open"},"Open","Closed"]}},bucket:"client",description:"Conditional ternary: [condition, then, else]"},{id:"_eq",generation:{syntax:"[a, b]",positions:["props","computed","action-value","visible","predicate"],example:{_eq:[{_state:"status"},"Active"]}},bucket:"client",description:"Equality: [a, b] → a === b"},{id:"_ne",generation:{syntax:"[a, b]",positions:["props","computed","action-value","visible","predicate"],example:{_ne:[{_state:"status"},"Active"]}},bucket:"client",description:"Inequality: [a, b] → a !== b"},{id:"_contains",generation:{syntax:"[haystack, needle]",positions:["props","computed","action-value","visible","predicate"],example:{_contains:[{_state:"name"},"orion"]}},bucket:"client",description:"Case-insensitive substring match: [haystack, needle] → haystack contains needle (empty needle → true)"},{id:"_gt",generation:{syntax:"[finite-number, finite-number]",positions:["props","computed","action-value","visible","predicate"],example:{_gt:[{_state:"count"},0]}},bucket:"client",description:"Greater-than for finite numbers: [a, b] → a > b. Non-numbers are false"},{id:"_lt",generation:{syntax:"[finite-number, finite-number]",positions:["props","computed","action-value","visible","predicate"],example:{_lt:[{_state:"count"},10]}},bucket:"client",description:"Less-than for finite numbers: [a, b] → a < b. Non-numbers are false"},{id:"_gte",generation:{syntax:"[finite-number, finite-number]",positions:["props","computed","action-value","visible","predicate"],example:{_gte:[{_state:"count"},0]}},bucket:"client",description:"Greater-or-equal for finite numbers: [a, b] → a >= b. Non-numbers are false"},{id:"_lte",generation:{syntax:"[finite-number, finite-number]",positions:["props","computed","action-value","visible","predicate"],example:{_lte:[{_state:"count"},10]}},bucket:"client",description:"Less-or-equal for finite numbers: [a, b] → a <= b. Non-numbers are false"},{id:"_in",generation:{syntax:"[value, array]",positions:["props","computed","action-value","visible","predicate"],example:{_in:[{_state:"status"},["Active","Draft"]]}},bucket:"client",description:"Membership: [value, array] → array includes value"},{id:"_not",generation:{syntax:"condition",positions:["props","computed","action-value","visible","predicate"],example:{_not:{_state:"open"}}},bucket:"client",description:"Logical NOT"},{id:"_and",generation:{syntax:"[condition, ...]",positions:["props","computed","action-value","visible","predicate"],example:{_and:[{_state:"ready"},{_state:"open"}]}},bucket:"client",description:"Logical AND over a list of conditions"},{id:"_or",generation:{syntax:"[condition, ...]",positions:["props","computed","action-value","visible","predicate"],example:{_or:[{_state:"ready"},{_state:"open"}]}},bucket:"client",description:"Logical OR over a list of conditions"},{id:"_user",generation:{syntax:"session user field",positions:["props","computed","action-value"],example:{_user:"name"},prerequisite:"Requires injected host session; no server ACL guarantee"},bucket:"client",description:"Current session user field (client-visible)"},{id:"_item",generation:{syntax:"item field or empty string",positions:["predicate","loop-props"],example:{_item:"name"},prerequisite:"Only inside a declared loop or filter/find predicate"},bucket:"client",description:"Current list item in a loop scope"},{id:"_index",generation:{syntax:"ignored scalar marker",positions:["predicate","loop-props"],example:{_index:0},prerequisite:"Only inside a declared loop or filter/find predicate"},bucket:"client",description:"Current list index in a loop scope"},{id:"_array.length",generation:{syntax:"array expression",positions:["props","computed","action-value"],example:{"_array.length":{_state:"rows"}}},bucket:"client",description:"Array length"},{id:"_string.concat",generation:{syntax:"[value, ...]",positions:["props","computed","action-value"],example:{"_string.concat":["Hello ",{_state:"name"}]}},bucket:"client",description:"String concatenation over a list"},{id:"_number.add",generation:{syntax:"[left, right] (finite numbers)",positions:["action-value"],example:{"_number.add":[{_state:"count"},1]},prerequisite:"Both operands must evaluate to finite numbers or the action fails and writes nothing; use it in SetState value for counters (e.g. SetState count = count + 1), never for strings or arrays"},bucket:"client",description:"Finite number addition: [left, right] → left + right. Throws on non-number, non-finite or overflowing operands (no coercion, no fallback to 0)"},{id:"_computed",generation:{syntax:"computed name",positions:["props","computed","action-value","visible"],example:{_computed:"filtered"},prerequisite:"Declare page computed expression"},bucket:"client",description:"Reads a derived (computed) state value by name from the __computed namespace"},{id:"_filter",generation:{syntax:"[array, predicate]",positions:["props","computed","action-value"],example:{_filter:[{_state:"rows"},{_eq:[{_item:"status"},"Active"]}]}},bucket:"client",description:"Filters an array: [arrayExpr, predExpr] with { _item, _index } scope"},{id:"_find",generation:{syntax:"[array, predicate]",positions:["props","computed","action-value"],example:{_find:[{_state:"rows"},{_eq:[{_item:"name"},"Orion"]}]}},bucket:"client",description:"Finds the first matching element: [arrayExpr, predExpr] with { _item, _index } scope"},{id:"_len",generation:{syntax:"array/string/object expression",positions:["props","computed","action-value"],example:{_len:{_state:"rows"}}},bucket:"client",description:"Length of an array, string, or object (0 if empty)"},{id:"_concat",generation:{syntax:"[value, ...]",positions:["props","computed","action-value"],example:{_concat:[[1],[2]]},prerequisite:"Concatenation is not numeric addition"},bucket:"client",description:"Concatenates a list: arrays are joined, otherwise values are string-concatenated"},{id:"_count",generation:{syntax:"array or [array, predicate?]",positions:["props","computed","action-value"],example:{_count:[{_state:"rows"}]}},bucket:"client",description:"Count of an array, or of elements matching a predicate: [array, predicate?]"},{id:"_groupCount",generation:{syntax:"[array, field]",positions:["props","computed","action-value"],example:{_groupCount:[{_state:"rows"},"status"]}},bucket:"client",description:"Counts array items by a field in one pass: [array, field] → { value: count }"},{id:"_sort",generation:{syntax:"[array, {by, order?, rank?}]",positions:["props","computed","action-value"],example:{_sort:[{_state:"rows"},{by:"name",order:"asc"}]}},bucket:"client",description:"Stable sort: [array, { by, order?: asc|desc, rank?: { field: values[] } }]. rank is enum order"},{id:"_js",generation:{syntax:"disabled",positions:[],example:{_js:"disabled"},prerequisite:"Arbitrary code execution is disabled; permissions do not enable it",disabled:!0},bucket:"client",description:"Legacy JS expression; execution is always disabled"}],N=new Set(T.map((e)=>e.id));var se=new Set(te),$e=new Map(T.map((e)=>[e.id,e])),ce=new Set(["array","boolean","integer","null","number","object","string"]),pe=new Set(["default","description","enum","items","properties","required","type"]);function ae(e){if(!e)return[];return Object.keys(e)}function Ue(e){if(!e||e.type!=="array")return;let t=e.items;if(!t||typeof t!=="object"||t.type!=="object"||!t.properties)return;return new Set(Object.keys(t.properties))}function Y(e,t,r){if(!e||typeof e!=="object")return;if(Array.isArray(e)){for(let[n,o]of e.entries())Y(o,`${t}[${n}]`,r);return}for(let[n,o]of Object.entries(e)){let i=t?`${t}.${n}`:n;r(n,o,i),Y(o,i,r)}}function L(e,t,r,n,o,i,s,a){Y(n,o,(l,c,p)=>{if((l==="_state"||l==="_bindState")&&typeof c==="string"){let u=c.split("."),d=u[0]??"";if(d==="__computed"){let g=u[1]??"";if(!s.has(g))e.push({code:"refs:computed-declared",message:`${t}: _computed "${g}" is not declared`,elementKey:r,path:p});return}if(!i.has(d))e.push({code:"refs:state-declared",message:`${t}: _state "${d}" is not declared in state`,elementKey:r,path:p})}if(l==="_computed"&&typeof c==="string"&&!s.has(c))e.push({code:"refs:computed-declared",message:`${t}: _computed "${c}" is not declared`,elementKey:r,path:p});if(l==="_item"&&typeof c==="string"&&c!==""&&a&&!a.has(c))e.push({code:"item:field-exists",message:`${t}: _item "${c}" is not in the item schema`,elementKey:r,path:p})})}function h(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function D(e){return h(e)&&Object.keys(e).some((t)=>t.startsWith("_"))}var le=new Set(["_eq","_ne","_contains","_gt","_lt","_gte","_lte","_in","_not","_and","_or"]);function qe(e,t){if(new Set(["_eq","_ne","_contains","_gt","_lt","_gte","_lte","_in","_filter","_find","_groupCount","_sort","_number.add"]).has(e)){if(!Array.isArray(t)||t.length!==2)return!1;if(e==="_groupCount")return typeof t[1]==="string";if(e==="_sort"){let n=t[1];if(!h(n))return!1;if(!(typeof n.by==="string"&&n.by.length>0||Array.isArray(n.by)&&n.by.length>0&&n.by.every((i)=>typeof i==="string"&&i.length>0)))return!1;if(n.order!==void 0&&n.order!=="asc"&&n.order!=="desc")return!1;if(n.rank!==void 0&&(!h(n.rank)||Object.values(n.rank).some((i)=>!Array.isArray(i))))return!1;return Object.keys(n).every((i)=>["by","order","rank"].includes(i))}return!0}if(e==="_if")return Array.isArray(t)&&t.length===3;if(e==="_and"||e==="_or")return Array.isArray(t)&&t.length>0;if(e==="_string.concat"||e==="_concat")return Array.isArray(t)&&t.length>0;if(e==="_count")return!Array.isArray(t)||t.length===1||t.length===2;if(e==="_index")return typeof t==="number"&&Number.isFinite(t);if(["_state","_bindState","_computed","_event","_global","_payload","_user"].includes(e))return typeof t==="string"&&t.length>0;if(e==="_item")return typeof t==="string";return!0}function de(e){return e.enum===void 0||Array.isArray(e.enum)&&e.enum.length>0&&e.enum.every((t)=>t===null||typeof t==="string"||typeof t==="boolean"||typeof t==="number"&&Number.isFinite(t))}function v(e,t,r,n,o,i){if(r==="predicate"&&(!D(e)||!le.has(Object.keys(e)[0]??"")))return n.push({code:"props:expression",message:`${o}: predicate must be a supported expression node`,elementKey:i,path:t}),!1;if(e===void 0)return n.push({code:"props:expression",message:`${o}: value is not part of the supported serialized expression syntax`,elementKey:i,path:t}),!1;if(Array.isArray(e))return e.reduce((d,g,m)=>v(g,`${t}[${m}]`,r,n,o,i)&&d,!0);if(!h(e)){if(typeof e==="number"&&!Number.isFinite(e)||e!==null&&!["string","number","boolean"].includes(typeof e))return n.push({code:"props:expression",message:`${o}: value is not part of the supported serialized expression syntax`,elementKey:i,path:t}),!1;return e===null||["string","number","boolean"].includes(typeof e)}let s=Object.keys(e).filter((d)=>d.startsWith("_"));if(s.length===0)return Object.entries(e).reduce((d,[g,m])=>v(m,`${t}.${g}`,r,n,o,i)&&d,!0);let a=s[0]??"",l=$e.get(a),c=`${t}.${a}`;if(s.length!==1||Object.keys(e).length!==1||!l)return n.push({code:"props:expression",message:`${o}: expression shape is not supported`,elementKey:i,path:c}),!1;if(l.generation?.disabled||!l.generation?.positions.includes(r)&&!(r==="props"&&l.generation?.positions.includes("binding"))&&!(r==="predicate-value"&&l.generation?.positions.some((d)=>["props","computed","predicate"].includes(d))))return n.push({code:"props:expression",message:`${o}: expression is not supported in this value position`,elementKey:i,path:c}),!1;let p=e[a];if(!qe(a,p))return n.push({code:"props:expression",message:`${o}: expression operand shape is not supported`,elementKey:i,path:c}),!1;let u=(d)=>D(d)||Array.isArray(d);if(["_filter","_find","_groupCount","_sort"].includes(a)&&!u(Array.isArray(p)?p[0]:void 0)||a==="_in"&&!u(Array.isArray(p)?p[1]:void 0))return n.push({code:"props:expression",message:`${o}: expression array operand has an unsupported literal shape`,elementKey:i,path:c}),!1;if(a==="_count"&&(Array.isArray(p)?!u(p[0]):!u(p))||a==="_array.length"&&!u(p))return n.push({code:"props:expression",message:`${o}: expression array operand has an unsupported literal shape`,elementKey:i,path:c}),!1;if(["_gt","_lt","_gte","_lte"].includes(a)&&Array.isArray(p)){if(p.some((g)=>!D(g)&&(typeof g!=="number"||!Number.isFinite(g))))return n.push({code:"props:expression",message:`${o}: numeric comparison literals must be finite numbers`,elementKey:i,path:c}),!1}if(Array.isArray(p))return p.reduce((d,g,m)=>{let y=r;if((["_filter","_find"].includes(a)||a==="_count")&&m===1)y="predicate";else if(r==="predicate"||r==="predicate-value"){if(y=le.has(a)?"predicate-value":r,r==="predicate"&&["_and","_or"].includes(a))y="predicate"}return v(g,`${c}[${m}]`,y,n,o,i)&&d},!0);if(h(p))return v(p,c,r==="predicate"&&a==="_not"?"predicate-value":r,n,o,i);return!0}function K(e,t,r,n,o,i,s){let a=(u)=>s==="props"?`props:${u}`:`actions:params-${u}`;if(Object.keys(t).filter((u)=>!pe.has(u)).length>0){n.push({code:"schema:unsupported",message:`${o}: schema contains unsupported constraints`,elementKey:i,path:r});return}if(t.type!==void 0&&!ce.has(t.type)){n.push({code:"schema:unsupported",message:`${o}: schema type is not supported`,elementKey:i,path:r});return}if(!de(t)){n.push({code:"schema:unsupported",message:`${o}: schema enum is not supported`,elementKey:i,path:r});return}if(t.required!==void 0&&(!Array.isArray(t.required)||t.required.some((u)=>typeof u!=="string"))){n.push({code:"schema:unsupported",message:`${o}: schema required list is not supported`,elementKey:i,path:r});return}if(t.items!==void 0&&(t.type!=="array"||!h(t.items))){n.push({code:"schema:unsupported",message:`${o}: schema items must describe an array`,elementKey:i,path:r});return}if(t.properties!==void 0&&(t.type!=="object"||!h(t.properties))){n.push({code:"schema:unsupported",message:`${o}: schema properties must describe an object`,elementKey:i,path:r});return}if(t.required?.length&&t.type!=="object"){n.push({code:"schema:unsupported",message:`${o}: schema required list is only supported for objects`,elementKey:i,path:r});return}if(D(e))return;let c=t.type;if(!(c===void 0||c==="null"&&e===null||c==="string"&&typeof e==="string"||c==="boolean"&&typeof e==="boolean"||c==="number"&&typeof e==="number"&&Number.isFinite(e)||c==="integer"&&typeof e==="number"&&Number.isInteger(e)||c==="array"&&Array.isArray(e)||c==="object"&&h(e))){n.push({code:a("type"),message:`${o}: value does not match the declared type`,elementKey:i,path:r});return}if(t.enum&&!t.enum.some((u)=>Object.is(u,e)))n.push({code:a("enum"),message:`${o}: value is outside the declared enum`,elementKey:i,path:r});if(c==="object"&&h(e)){for(let u of t.required??[])if(!Object.hasOwn(e,u))n.push({code:a("required"),message:`${o}: required object field is missing`,elementKey:i,path:`${r}.${u}`});for(let[u,d]of Object.entries(t.properties??{}))if(Object.hasOwn(e,u))K(e[u],d,`${r}.${u}`,n,o,i,s)}if(c==="array"&&Array.isArray(e)&&t.items)e.forEach((u,d)=>{K(u,t.items,`${r}[${d}]`,n,o,i,s)})}function ue(e,t,r,n,o,i,s){if(!r)return;for(let[a,l]of Object.entries(r)){let c=`${n}.${a}`;if(J(l,c,e,o,i)&&t&&Object.hasOwn(t,a))K(t[a],l,c,e,o,i,s)}}function ge(e,t,r,n,o,i,s={}){for(let[a,l]of Object.entries(t??{})){let c=n==="action-value"&&!s.evaluatedParams?.has(a)?"action-literal":n;v(l,`${r}.${a}`,c,e,o,i)}}function J(e,t,r,n,o){if(Object.keys(e).some((s)=>!pe.has(s))||e.type!==void 0&&!ce.has(e.type)||!de(e)||e.required!==void 0&&(!Array.isArray(e.required)||e.required.some((s)=>typeof s!=="string"))||e.items!==void 0&&(e.type!=="array"||!h(e.items))||e.properties!==void 0&&(e.type!=="object"||!h(e.properties))||Boolean(e.required?.length)&&e.type!=="object")return r.push({code:"schema:unsupported",message:`${n}: schema contains unsupported constraints`,elementKey:o,path:t}),!1;for(let[s,a]of Object.entries(e.properties??{}))if(!J(a,`${t}.${s}`,r,n,o))return!1;if(e.items&&!J(e.items,`${t}[]`,r,n,o))return!1;return!0}function j(e,t,r,n,o,i,s){if(!Array.isArray(n)){if(s)e.push({code:"actions:chain",message:`${t}: action chain must be an array`,elementKey:r,path:o});return}for(let[a,l]of n.entries()){if(!h(l)){if(s)e.push({code:"actions:chain",message:`${t}: action step must be an object`,elementKey:r,path:`${o}[${a}]`});continue}let c=l.action,p=`${o}[${a}]`;if(s&&(typeof c!=="string"||c.length===0))e.push({code:"actions:chain",message:`${t}: action step needs an action name`,elementKey:r,path:`${p}.action`});if(typeof c==="string"&&!se.has(c)&&!Object.hasOwn(i.actions??{},c))e.push({code:"actions:registered",message:`${t}: action "${c}" is not in the catalog. Registered actions: ${[...se,...Object.keys(i.actions??{})].join(", ")}. No equivalent is guaranteed: preserve the requirement and report unsupported behavior instead of disabling it.`,elementKey:r,path:`${p}.action`});if(s&&typeof c==="string"){let u=Object.hasOwn(i.actions??{},c)?i.actions[c]:Object.hasOwn(W,c)?W[c]:void 0,d=l.params;if(d!==void 0&&!h(d))e.push({code:"actions:chain",message:`${t}: action params must be an object`,elementKey:r,path:`${p}.params`});else{if(h(d))ge(e,d,`${p}.params`,"action-value",t,r,{evaluatedParams:new Set(u?.generation?.evaluatedParams??[])});if(u)ue(e,h(d)?d:void 0,u.params,`${p}.params`,t,r,"actions:params")}}if(Object.hasOwn(l,"onSuccess"))j(e,t,r,l.onSuccess,`${p}.onSuccess`,i,s);if(Object.hasOwn(l,"onError"))j(e,t,r,l.onError,`${p}.onError`,i,s)}}function me(e,t,r=!1){let n=[],o=new Set([...ae(e.state),...e.connectionIds??[]]),i=new Set(ae(e.computed)),s=e.pageId??e.root;if(e.computed)for(let[a,l]of Object.entries(e.computed)){if(r)v(l,`computed.${a}`,"computed",n,`${s}.computed`,s);L(n,`${s}.computed`,s,l,`computed.${a}`,o,i,We(e,t))}if(e.urlState)for(let[a,l]of Object.entries(e.urlState)){if(!o.has(a))n.push({code:"refs:url-state-declared",message:`${s}: urlState "${a}" is not declared in state`,elementKey:s,path:`urlState.${a}`});if(!l||typeof l.param!=="string"||l.param.length===0)n.push({code:"refs:url-state-declared",message:`${s}: urlState "${a}" needs a param name`,elementKey:s,path:`urlState.${a}.param`})}for(let[a,l]of Object.entries(e.elements)){let c=Object.hasOwn(t.components,l.type)?t.components[l.type]:void 0;if(!c)continue;let p=`${s}/${a}`,u=fe(c.props);if(r)ge(n,l.props,"props","props",p,a);if(l.visible!==null&&typeof l.visible==="object"){let d=Object.keys(l.visible);if(Array.isArray(l.visible)||d.length!==1||!d[0]?.startsWith("_"))n.push({code:"visibility:expression",message:`${p}: visible must be a boolean or an operator expression, not a literal record`,elementKey:a,path:"visible"})}if(r&&l.visible!==void 0)if(typeof l.visible!=="boolean"&&!D(l.visible))n.push({code:"visibility:expression",message:`${p}: visible must be a boolean or an operator expression`,elementKey:a,path:"visible"});else v(l.visible,"visible","visible",n,p,a);if(L(n,p,a,l.props,"props",o,i,u),L(n,p,a,l.visible,"visible",o,i,u),L(n,p,a,l.events,"events",o,i,u),c.props){let d=new Set(Object.keys(c.props));for(let g of Object.keys(l.props??{}))if(!d.has(g))n.push({code:"props:declared",message:`${p}: prop "${g}" is not declared on ${l.type}`,elementKey:a,path:`props.${g}`});if(r)ue(n,l.props,c.props,"props",p,a,"props")}if(c.events){let d=new Set(Object.keys(c.events));for(let[g,m]of Object.entries(l.events??{})){if(!d.has(g))n.push({code:"events:declared",message:`${p}: event "${g}" is not declared on ${l.type}`,elementKey:a,path:`events.${g}`});j(n,p,a,m,`events.${g}`,t,r)}}else for(let[d,g]of Object.entries(l.events??{}))j(n,p,a,g,`events.${d}`,t,r)}return n.map((a)=>({...a,path:a.elementKey===s?`${s}/${a.path}`:`${s}/${a.elementKey}/${a.path}`}))}function fe(e){let t=new Set;for(let r of Object.values(e??{})){let n=Ue(r);if(!n)continue;for(let o of n)t.add(o)}return t.size>0?t:void 0}function We(e,t){let r=new Set;for(let n of Object.values(e.elements)){let o=Object.hasOwn(t.components,n.type)?t.components[n.type]:void 0,i=fe(o?.props);if(!i)continue;for(let s of i)r.add(s)}return r.size>0?r:void 0}function ye(e){return e.map((t)=>({code:t.code,message:t.message,elementKey:t.elementKey,path:t.path}))}var Ce=[{id:"_request",bucket:"server",description:"Executes a connection request server-side and injects the result"},{id:"_secret",bucket:"server",description:"Reads a server-side secret value; never transmitted to the client"}],V=new Set(Ce.map((e)=>e.id));function Z(e){return{...e,...e.props?{props:{...e.props}}:{},...e.children?{children:[...e.children]}:{},...e.slots?{slots:{...e.slots}}:{},...e.events?{events:{...e.events}}:{}}}function he(e){return{...e,...e.roots?{roots:[...e.roots]}:{},...e.state?{state:{...e.state}}:{},elements:Object.fromEntries(Object.entries(e.elements).map(([t,r])=>[t,Z(r)]))}}function ze(e){return e.type==="compiler:operator"}function Ge(e){return e.type==="compiler:validator"}class O{operators;validators;constructor(e={}){let t=(e.capabilities??[]).filter(ze).map((n)=>n.contribution),r=(e.capabilities??[]).filter(Ge).map((n)=>n.contribution);this.operators=[...e.operators??[],...t],this.validators=[...e.validators??[],...r]}merge(e){if(e instanceof O)return new O({operators:[...this.operators,...e.operators],validators:[...this.validators,...e.validators]});return new O({operators:[...this.operators,...e.operators??[]],validators:[...this.validators,...e.validators??[]],...e.capabilities?{capabilities:e.capabilities}:{}})}}function Ye(e={}){return new O(e)}function Ke(e,t,r){let n=e.pages.find((s)=>s.id===t),o=[...n?.rootBlockIds??[]],i=Object.fromEntries(Object.entries(e.blocks).filter(([,s])=>s.pageId===t).map(([s,a])=>{let{id:l,pageId:c,parentId:p,...u}=a;return[s,Z(u)]}));if(r&&o.length===0){let s=e.blocks.__empty__?`__empty__:${t}`:"__empty__";o.push(s),i[s]={type:"Empty"}}return{version:e.version,root:o[0]??"__empty__",roots:o,pageId:t,...n?.state?{state:n.state}:{},...n?.computed?{computed:n.computed}:{},...n?.urlState?{urlState:n.urlState}:{},...e.connections?{connectionIds:e.connections.map((s)=>s.id)}:{},elements:i}}function Je(e,t){let r=[...t.roots??e.roots??[]];if(r.length>0&&t.root!==e.root)r[0]=t.root;else if(r.length===0&&t.elements[t.root])r.push(t.root);return r}async function Ze(e,t,r,n){let o=he(e);for(let i of r.operators){let s={spec:o,catalog:t,warnings:n,getElement(l){return o.elements[l]},updateElement(l,c){o={...o,elements:{...o.elements,[l]:Z(c)}}},addWarning(l){n.push(l)}},a=await i.apply(s);if(a)o=he(a)}return o}function be(e,t){return Object.hasOwn(e,t)?e[t]:void 0}function Qe(e,t,r,n,o){let i=Object.entries(e.elements);for(let a of e.roots?.length?e.roots:[e.root])if(!e.elements[a])r.push({code:"missing-root",message:`Root element "${a}" is missing from the elements map`,elementKey:a});for(let[a,l]of i){if(!(be(t.components,l.type)??be(t.templates,l.type)))n.push({missingType:l.type,elementKey:a,reason:l.template?"missing-template":"missing-component",context:`Element ${a} references ${l.type}`,path:`blocks.${a}.type`});for(let p of l.children??[])if(!e.elements[p])r.push({code:"dangling-child",message:`Element "${a}" references missing child "${p}"`,elementKey:a})}let s=me(e,t,o);if(o){for(let a of s)n.push({missingType:a.code,elementKey:a.elementKey,reason:"invalid-spec",context:a.message,code:a.code,path:a.path});return}r.push(...ye(s))}async function Xe(e,t,r,n,o){for(let i of r.validators){let s={spec:e,catalog:t,warnings:n,gaps:o,addWarning(a){n.push(a)},addGap(a){o.push(a)}};await i.validate(s)}}function A(e,t){if(!e||typeof e!=="object")return;if(Array.isArray(e)){for(let r of e)A(r,t);return}for(let[r,n]of Object.entries(e)){if(r.startsWith("_"))t.add(r);A(n,t)}}function et(e){let t=new Map;for(let[n,o]of Object.entries(e.blocks)){let i=new Set;A(o.props,i),A(o.visible,i);for(let s of i){let a=t.get(s)??new Set;a.add(n),t.set(s,a)}}for(let n of e.pages){let o=new Set;A(n.computed,o),A(n.lifecycle,o);for(let i of o){let s=t.get(i)??new Set;s.add(n.id),t.set(i,s)}}let r=[];for(let[n,o]of t){let i=N.has(n)?"client":V.has(n)?"server":n==="_ref"?"build":"shared";r.push({operatorId:n,bucket:i,blockIds:[...o]})}return r}async function xe(e,t,r={}){let n=[],o=[],i=r.registry??Ye(),s=G(e,r.templates),a=Object.create(null),l=[];for(let[u,d]of s.pages.entries()){let g=Ke(s,d.id,u===0),m=await Ze(g,t,i,n);Qe(m,t,n,o,r.strict===!0),await Xe(m,t,i,n,o);for(let[y,_]of Object.entries(m.elements)){let X=a[y];if(X)throw new b("duplicate-block-id",`Compiler output block id "${y}" conflicts across pages`,{blockId:y,firstPageId:X.pageId,pageId:d.id});let q=s.blocks[y];a[y]={..._,id:y,pageId:d.id,...q?.pageId===d.id&&q.parentId?{parentId:q.parentId}:{}}}l.push({...d,rootBlockIds:Je(g,m)})}let c={version:"2.0",pages:l,...s.design?{design:s.design}:{},...s.connections?{connections:s.connections.map((u)=>({...u}))}:{},blocks:a};if(r.strict===!0&&e.version!=="2.0")o.push({missingType:"spec:version",elementKey:"spec",reason:"invalid-spec",context:"Native Spec version must be 2.0",code:"spec:version",path:"version"});let p=et(c);return{spec:c,gaps:o,warnings:n,...p.length>0?{operatorUsage:p}:{}}}function Ie(e){let t=_e(e.title??Ot(e.source)??"artifact");switch(e.format){case"html":return{bytes:Re(Pe(e.source,e.title)),filename:`${t}.html`,contentType:"text/html; charset=utf-8"};case"markdown":return{bytes:Re(e.source),filename:`${t}.md`,contentType:"text/markdown; charset=utf-8"};case"zip":{let r=tt(t),o=((e.files?.length)?e.files:[{path:"index.html",content:Pe(e.source,e.title)}]).map((a)=>({...a,path:`${r}/${a.path}`})),i=e.title??t,s=[...o,{path:`${r}/DESIGN-HANDOFF.md`,content:nt(i,o,r)},{path:`${r}/design-manifest.json`,content:JSON.stringify(rt(i,o),null,2)}];return{bytes:Ae(s),filename:`${t}.zip`,contentType:"application/zip"}}case"pptx":return{bytes:dt(e.source,e.title??t),filename:`${t}.pptx`,contentType:"application/vnd.openxmlformats-officedocument.presentationml.presentation"}}}function tt(e){return _e(e??"artifact")}function rt(e,t){return{contract:"uibot.artifact.zip",title:e,generator:"UIBot",files:t.map((r)=>r.path)}}function nt(e,t,r){let n=t.map((l)=>`- \`${l.path}\``).join(`
2
+ `),o=[],i=t.filter((l)=>/\.html?$/i.test(l.path)),s=t.filter((l)=>/\.md$/i.test(l.path)),a=t.filter((l)=>/\.ya?ml$/i.test(l.path));if(i.length>0)o.push(`- Preview the HTML files in a browser: ${i.map((l)=>`\`${l.path}\``).join(", ")} — no build step required.`);if(s.length>0)o.push(`- Read or edit the Markdown files in a Markdown reader or editor: ${s.map((l)=>`\`${l.path}\``).join(", ")}.`);if(a.length>0)o.push(`- Keep the Spec YAML files as editable source: ${a.map((l)=>`\`${l.path}\``).join(", ")}.`);if(o.length===0)o.push("- No HTML, Markdown, or Spec YAML files are included with specialized usage guidance.");return[`# ${e} — Design Handoff`,"","Exported from UIBot. This bundle is self-contained: the artifact files plus","this note and a machine-readable manifest.","","## Contents","",n,`- \`${r}/DESIGN-HANDOFF.md\` (this file)`,`- \`${r}/design-manifest.json\` (machine-readable file list)`,"","## Usage","",...o,"","_Generated by UIBot._"].join(`
3
+ `)}function Pe(e,t="UIBot artifact"){let r=e.trim(),n=r.slice(0,128).toLowerCase();if(n.startsWith("<!doctype")||n.startsWith("<html"))return r;return["<!doctype html>",'<html lang="en">',"<head>",' <meta charset="utf-8" />',' <meta name="viewport" content="width=device-width, initial-scale=1" />',` <title>${Te(t)}</title>`,"</head>","<body>",e,"</body>","</html>"].join(`
4
+ `)}var ot=/^\uE000(ul|ol)(\d+)\uE001/;function it(e){let t=[];return e.replace(/<(\/?)(ul|ol|li)\b[^>]*>/gi,(r,n,o)=>{let i=o.toLowerCase();if(i==="li"){if(n)return`
5
+ `;return`
6
+ ${t[t.length-1]??"ul"}${Math.max(0,t.length-1)}`}if(n)t.pop();else t.push(i);return`
7
+ `})}function st(e){let t=ot.exec(e);if(!t)return{text:k(e)};return{text:k(e.slice(t[0].length)),list:{kind:t[1],lvl:Number(t[2])}}}function at(e){let t=/<html\b[^>]*>/i.exec(e)?.[0];if(!t)return null;let r=/\s(?:xml:)?lang\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/i.exec(t);return(r?.[1]??r?.[2]??r?.[3]??"").trim()||null}function lt(e){if(/[\u3040-\u30ff\u31f0-\u31ff\uff66-\uff9f]/.test(e))return"ja-JP";if(/[\uac00-\ud7af\u1100-\u11ff\u3130-\u318f]/.test(e))return"ko-KR";if(/[\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff]/.test(e))return"zh-CN";return"en-US"}var ct=/^(?:zh|ja|ko)(?:-|$)/i;function Q(e,t){let r=t??lt(e),n=ct.test(r)?' altLang="en-US"':"";return`lang="${E(r)}"${n}`}function pt(e){let t=w(e,"section"),r=t.length>0?[]:Tt(e);return(t.length>0?t:r.length>0?r:w(e,"article").length>0?w(e,"article"):[e]).map((o,i)=>{let s=Dt(o),a=s.reduce((m,y)=>m.replace(y,""),o),l=Ee(a,["h1","h2","h3"])||Se(a,"data-title")||`Slide ${i+1}`,c=w(a,"li").map((m)=>k(I(m))).filter(Boolean),p=k(I(U(a,["script","style","svg"]))),u=s.flatMap((m)=>{if(k(I(U(m,["script","style","svg"]))))return m.split(/\n{2,}|<\/p>|<br\s*\/?>/i);let _=/^<[^>]*>/.exec(m)?.[0]??"";return[Se(_,"data-notes")]}).map((m)=>k(I(U(m,["script","style","svg"])))).filter(Boolean),d=U(a,["script","style","svg"]);for(let m of["h1","h2","h3"]){let y=w(d,m)[0];if(y){d=d.replace(y,"");break}}d=it(d).replace(/<tr\b[^>]*>([\s\S]*?)<\/tr>/gi,(m,y)=>`${(y.match(/<t[dh]\b[^>]*>[\s\S]*?<\/t[dh]>/gi)??[]).map((_)=>k(I(_))).join(" | ")}
8
+ `).replace(/<\/(?:p|div|h[1-6]|table|header|footer)>/gi,`
9
+ `);let g=I(d).split(`
10
+ `).map(st).filter((m)=>m.text);return{title:k(l),bullets:c,body:p,notes:u,paragraphs:g}})}function dt(e,t="UIBot artifact"){let r=pt(e).flatMap(St),n=at(e),o=r.some((s)=>s.notes.length>0),i=[{path:"[Content_Types].xml",content:ut(r)},{path:"_rels/.rels",content:gt()},{path:"docProps/app.xml",content:mt(r.length)},{path:"docProps/core.xml",content:ft(t)},{path:"ppt/presentation.xml",content:yt(r.length,o)},{path:"ppt/_rels/presentation.xml.rels",content:Ct(r.length,o)},{path:"ppt/theme/theme1.xml",content:_t()},{path:"ppt/slideMasters/slideMaster1.xml",content:ht()},{path:"ppt/slideMasters/_rels/slideMaster1.xml.rels",content:bt()},{path:"ppt/slideLayouts/slideLayout1.xml",content:xt()},{path:"ppt/slideLayouts/_rels/slideLayout1.xml.rels",content:Pt()}];if(o)i.push({path:"ppt/notesMasters/notesMaster1.xml",content:wt()}),i.push({path:"ppt/notesMasters/_rels/notesMaster1.xml.rels",content:Et()});return r.forEach((s,a)=>{let l=a+1;if(i.push({path:`ppt/slides/slide${l}.xml`,content:vt(s,l,n)}),i.push({path:`ppt/slides/_rels/slide${l}.xml.rels`,content:kt(l,s.notes.length>0)}),s.notes.length>0)i.push({path:`ppt/notesSlides/notesSlide${l}.xml`,content:It(s,l,n)}),i.push({path:`ppt/notesSlides/_rels/notesSlide${l}.xml.rels`,content:At(l)})}),Ae(i)}function Ae(e){let t=new TextEncoder,r=[],n=[],o=0;for(let l of e){let c=Bt(l.path),p=t.encode(c),u=typeof l.content==="string"?t.encode(l.content):l.content,d=Mt(u),g=F([x(67324752),f(20),f(2048),f(0),f(0),f(0),x(d),x(u.length),x(u.length),f(p.length),f(0),p,u]);r.push(g),n.push(F([x(33639248),f(20),f(20),f(2048),f(0),f(0),f(0),x(d),x(u.length),x(u.length),f(p.length),f(0),f(0),f(0),f(0),x(0),x(o),p])),o+=g.length}let i=o,s=F(n),a=F([x(101010256),f(0),f(0),f(e.length),f(e.length),x(s.length),x(i),f(0)]);return F([...r,s,a])}function ut(e){let t=e.map((n,o)=>`<Override PartName="/ppt/slides/slide${o+1}.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.slide+xml"/>`).join(""),r=e.map((n,o)=>n.notes.length>0?`<Override PartName="/ppt/notesSlides/notesSlide${o+1}.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.notesSlide+xml"/>`:"").join("");return C(['<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">','<Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/>','<Default Extension="xml" ContentType="application/xml"/>','<Override PartName="/docProps/app.xml" ContentType="application/vnd.openxmlformats-officedocument.extended-properties+xml"/>','<Override PartName="/docProps/core.xml" ContentType="application/vnd.openxmlformats-package.core-properties+xml"/>','<Override PartName="/ppt/presentation.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml"/>','<Override PartName="/ppt/theme/theme1.xml" ContentType="application/vnd.openxmlformats-officedocument.theme+xml"/>','<Override PartName="/ppt/slideMasters/slideMaster1.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.slideMaster+xml"/>','<Override PartName="/ppt/slideLayouts/slideLayout1.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.slideLayout+xml"/>',t,e.some((n)=>n.notes.length>0)?'<Override PartName="/ppt/notesMasters/notesMaster1.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.notesMaster+xml"/>':"",r,"</Types>"])}function gt(){return C(['<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">','<Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="ppt/presentation.xml"/>','<Relationship Id="rId2" Type="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties" Target="docProps/core.xml"/>','<Relationship Id="rId3" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties" Target="docProps/app.xml"/>',"</Relationships>"])}function mt(e){return C(['<Properties xmlns="http://schemas.openxmlformats.org/officeDocument/2006/extended-properties" xmlns:vt="http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes">',"<Application>UIBot</Application>",`<Slides>${e}</Slides>`,"</Properties>"])}function ft(e){let t=new Date().toISOString();return C(['<cp:coreProperties xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:dcmitype="http://purl.org/dc/dcmitype/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">',`<dc:title>${E(e)}</dc:title>`,"<dc:creator>UIBot</dc:creator>",`<dcterms:created xsi:type="dcterms:W3CDTF">${t}</dcterms:created>`,`<dcterms:modified xsi:type="dcterms:W3CDTF">${t}</dcterms:modified>`,"</cp:coreProperties>"])}function yt(e,t){let r=Array.from({length:e},(n,o)=>`<p:sldId id="${256+o}" r:id="rId${o+2}"/>`).join("");return C(['<p:presentation xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main">','<p:sldMasterIdLst><p:sldMasterId id="2147483648" r:id="rId1"/></p:sldMasterIdLst>',t?'<p:notesMasterIdLst><p:notesMasterId r:id="rIdNotes"/></p:notesMasterIdLst>':"",`<p:sldIdLst>${r}</p:sldIdLst>`,'<p:sldSz cx="12192000" cy="6858000" type="screen16x9"/>','<p:notesSz cx="6858000" cy="9144000"/>',"</p:presentation>"])}function Ct(e,t){let r=[t?'<Relationship Id="rIdNotes" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesMaster" Target="notesMasters/notesMaster1.xml"/>':"",'<Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideMaster" Target="slideMasters/slideMaster1.xml"/>',...Array.from({length:e},(n,o)=>`<Relationship Id="rId${o+2}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide" Target="slides/slide${o+1}.xml"/>`)].join("");return C([`<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">${r}</Relationships>`])}function ht(){return C(['<p:sldMaster xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main">','<p:cSld><p:bg><p:bgPr><a:solidFill><a:srgbClr val="FFFFFF"/></a:solidFill></p:bgPr></p:bg><p:spTree><p:nvGrpSpPr><p:cNvPr id="1" name=""/><p:cNvGrpSpPr/><p:nvPr/></p:nvGrpSpPr><p:grpSpPr><a:xfrm><a:off x="0" y="0"/><a:ext cx="0" cy="0"/><a:chOff x="0" y="0"/><a:chExt cx="0" cy="0"/></a:xfrm></p:grpSpPr></p:spTree></p:cSld>','<p:clrMap bg1="lt1" tx1="dk1" bg2="lt2" tx2="dk2" accent1="accent1" accent2="accent2" accent3="accent3" accent4="accent4" accent5="accent5" accent6="accent6" hlink="hlink" folHlink="folHlink"/>','<p:sldLayoutIdLst><p:sldLayoutId id="2147483649" r:id="rId1"/></p:sldLayoutIdLst>',"<p:txStyles><p:titleStyle/><p:bodyStyle/><p:otherStyle/></p:txStyles>","</p:sldMaster>"])}function bt(){return C(['<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">','<Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout" Target="../slideLayouts/slideLayout1.xml"/>','<Relationship Id="rId2" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme" Target="../theme/theme1.xml"/>',"</Relationships>"])}function xt(){return C(['<p:sldLayout xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main" type="blank" preserve="1">','<p:cSld name="Blank"><p:spTree><p:nvGrpSpPr><p:cNvPr id="1" name=""/><p:cNvGrpSpPr/><p:nvPr/></p:nvGrpSpPr><p:grpSpPr><a:xfrm><a:off x="0" y="0"/><a:ext cx="0" cy="0"/><a:chOff x="0" y="0"/><a:chExt cx="0" cy="0"/></a:xfrm></p:grpSpPr></p:spTree></p:cSld>',"</p:sldLayout>"])}function Pt(){return C(['<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">','<Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideMaster" Target="../slideMasters/slideMaster1.xml"/>',"</Relationships>"])}function kt(e,t){return C(['<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">','<Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout" Target="../slideLayouts/slideLayout1.xml"/>',t?`<Relationship Id="rId2" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesSlide" Target="../notesSlides/notesSlide${e}.xml"/>`:"","</Relationships>"])}function St(e){let t=[],r=[];for(let n of e.paragraphs){let o=n.text,i=!1,s=(c)=>{r.push(i?{...n,text:c,continued:!0}:{...n,text:c}),i=!0},a="",l=0;for(let c of o){let p=(c.codePointAt(0)??0)>255?2:/[MWmw]/.test(c)?1.8:1;if(l+p>64){let u=a.lastIndexOf(" "),d=u>0?u+1:a.length;s(a.slice(0,d)),a=a.slice(d),l=Array.from(a).reduce((g,m)=>g+((m.codePointAt(0)??0)>255?2:/[MWmw]/.test(m)?1.8:1),0)}if(r.length===8)t.push({...e,paragraphs:r}),r=[];a+=c,l+=p}if(a)s(a);if(r.length===8)t.push({...e,paragraphs:r}),r=[]}if(r.length>0||t.length===0)t.push({...e,paragraphs:r});return t}var ke=342900;function Rt(e){if(!e.list)return'<a:pPr><a:lnSpc><a:spcPct val="115000"/></a:lnSpc><a:spcAft><a:spcPts val="600"/></a:spcAft><a:buNone/></a:pPr>';let{kind:r,lvl:n}=e.list,o=ke*(n+1);if(e.continued)return`<a:pPr marL="${o}" lvl="${n}" indent="0"><a:lnSpc><a:spcPct val="115000"/></a:lnSpc><a:spcAft><a:spcPts val="600"/></a:spcAft><a:buNone/></a:pPr>`;return`<a:pPr marL="${o}" lvl="${n}" indent="-${ke}"><a:lnSpc><a:spcPct val="115000"/></a:lnSpc><a:spcAft><a:spcPts val="600"/></a:spcAft>${r==="ol"?'<a:buAutoNum type="arabicPeriod"/>':'<a:buFont typeface="Arial"/><a:buChar char="•"/>'}</a:pPr>`}function vt(e,t,r=null){let n=e.paragraphs.map((o)=>`<a:p>${Rt(o)}<a:r><a:rPr ${Q(o.text,r)} sz="2200"/><a:t xml:space="preserve">${E(o.text)}</a:t></a:r></a:p>`).join("");return C(['<p:sld xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main">','<p:cSld><p:bg><p:bgPr><a:solidFill><a:srgbClr val="FFFFFF"/></a:solidFill></p:bgPr></p:bg><p:spTree>','<p:nvGrpSpPr><p:cNvPr id="1" name=""/><p:cNvGrpSpPr/><p:nvPr/></p:nvGrpSpPr><p:grpSpPr><a:xfrm><a:off x="0" y="0"/><a:ext cx="0" cy="0"/><a:chOff x="0" y="0"/><a:chExt cx="0" cy="0"/></a:xfrm></p:grpSpPr>',we(2,`Title ${t}`,e.title,685800,609600,10972800,914400,3600,!0,r),`<p:sp><p:nvSpPr><p:cNvPr id="3" name="Body ${t}"/><p:cNvSpPr txBox="1"/><p:nvPr/></p:nvSpPr><p:spPr><a:xfrm><a:off x="914400" y="1828800"/><a:ext cx="10363200" cy="4267200"/></a:xfrm><a:prstGeom prst="rect"><a:avLst/></a:prstGeom><a:noFill/></p:spPr><p:txBody><a:bodyPr wrap="square"/><a:lstStyle/>${n||"<a:p/>"}</p:txBody></p:sp>`,"</p:spTree></p:cSld>","</p:sld>"])}function It(e,t,r=null){let n=e.notes.map((o)=>`<a:p><a:r><a:rPr ${Q(o,r)} sz="1800"/><a:t>${E(o)}</a:t></a:r></a:p>`).join("");return C(['<p:notes xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main">',"<p:cSld><p:spTree>",'<p:nvGrpSpPr><p:cNvPr id="1" name=""/><p:cNvGrpSpPr/><p:nvPr/></p:nvGrpSpPr><p:grpSpPr><a:xfrm><a:off x="0" y="0"/><a:ext cx="0" cy="0"/><a:chOff x="0" y="0"/><a:chExt cx="0" cy="0"/></a:xfrm></p:grpSpPr>',we(2,`Notes title ${t}`,e.title,685800,457200,5486400,457200,1600,!0,r),`<p:sp><p:nvSpPr><p:cNvPr id="3" name="Speaker notes ${t}"/><p:cNvSpPr txBox="1"/><p:nvPr><p:ph type="body" idx="1"/></p:nvPr></p:nvSpPr><p:spPr><a:xfrm><a:off x="685800" y="1066800"/><a:ext cx="5486400" cy="7010400"/></a:xfrm><a:prstGeom prst="rect"><a:avLst/></a:prstGeom><a:noFill/></p:spPr><p:txBody><a:bodyPr wrap="square"/><a:lstStyle/>${n||"<a:p/>"}</p:txBody></p:sp>`,"</p:spTree></p:cSld><p:clrMapOvr><a:masterClrMapping/></p:clrMapOvr>","</p:notes>"])}function At(e){return C(['<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">',`<Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide" Target="../slides/slide${e}.xml"/>`,'<Relationship Id="rId2" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesMaster" Target="../notesMasters/notesMaster1.xml"/>',"</Relationships>"])}function wt(){return C(['<p:notesMaster xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main">','<p:cSld><p:spTree><p:nvGrpSpPr><p:cNvPr id="1" name=""/><p:cNvGrpSpPr/><p:nvPr/></p:nvGrpSpPr><p:grpSpPr><a:xfrm><a:off x="0" y="0"/><a:ext cx="0" cy="0"/><a:chOff x="0" y="0"/><a:chExt cx="0" cy="0"/></a:xfrm></p:grpSpPr></p:spTree></p:cSld>','<p:clrMap bg1="lt1" tx1="dk1" bg2="lt2" tx2="dk2" accent1="accent1" accent2="accent2" accent3="accent3" accent4="accent4" accent5="accent5" accent6="accent6" hlink="hlink" folHlink="folHlink"/>',"<p:notesStyle/>","</p:notesMaster>"])}function Et(){return C(['<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">','<Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme" Target="../theme/theme1.xml"/>',"</Relationships>"])}function we(e,t,r,n,o,i,s,a,l,c=null){let p=l?' b="1"':"";return`<p:sp><p:nvSpPr><p:cNvPr id="${e}" name="${E(t)}"/><p:cNvSpPr txBox="1"/><p:nvPr/></p:nvSpPr><p:spPr><a:xfrm><a:off x="${n}" y="${o}"/><a:ext cx="${i}" cy="${s}"/></a:xfrm><a:prstGeom prst="rect"><a:avLst/></a:prstGeom><a:noFill/></p:spPr><p:txBody><a:bodyPr wrap="square"/><a:lstStyle/><a:p><a:r><a:rPr ${Q(r,c)} sz="${a}"${p}/><a:t>${E(r)}</a:t></a:r></a:p></p:txBody></p:sp>`}function _t(){return C(['<a:theme xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" name="UIBot">','<a:themeElements><a:clrScheme name="UIBot"><a:dk1><a:srgbClr val="111111"/></a:dk1><a:lt1><a:srgbClr val="FFFFFF"/></a:lt1><a:dk2><a:srgbClr val="222222"/></a:dk2><a:lt2><a:srgbClr val="F5F5F5"/></a:lt2><a:accent1><a:srgbClr val="C15F3C"/></a:accent1><a:accent2><a:srgbClr val="3C7A89"/></a:accent2><a:accent3><a:srgbClr val="E0B44C"/></a:accent3><a:accent4><a:srgbClr val="6F6A5F"/></a:accent4><a:accent5><a:srgbClr val="8F4D2F"/></a:accent5><a:accent6><a:srgbClr val="4D5D53"/></a:accent6><a:hlink><a:srgbClr val="0563C1"/></a:hlink><a:folHlink><a:srgbClr val="954F72"/></a:folHlink></a:clrScheme><a:fontScheme name="UIBot"><a:majorFont><a:latin typeface="Arial"/><a:ea typeface=""/><a:cs typeface=""/></a:majorFont><a:minorFont><a:latin typeface="Arial"/><a:ea typeface=""/><a:cs typeface=""/></a:minorFont></a:fontScheme><a:fmtScheme name="UIBot"><a:fillStyleLst><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:solidFill><a:schemeClr val="phClr"/></a:solidFill></a:fillStyleLst><a:lnStyleLst><a:ln w="6350"><a:solidFill><a:schemeClr val="phClr"/></a:solidFill></a:ln><a:ln w="6350"><a:solidFill><a:schemeClr val="phClr"/></a:solidFill></a:ln><a:ln w="6350"><a:solidFill><a:schemeClr val="phClr"/></a:solidFill></a:ln></a:lnStyleLst><a:effectStyleLst><a:effectStyle><a:effectLst/></a:effectStyle><a:effectStyle><a:effectLst/></a:effectStyle><a:effectStyle><a:effectLst/></a:effectStyle></a:effectStyleLst><a:bgFillStyleLst><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:solidFill><a:schemeClr val="phClr"/></a:solidFill></a:bgFillStyleLst></a:fmtScheme></a:themeElements>',"</a:theme>"])}function C(e){return`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>${e.join("")}`}function w(e,t){let r=new RegExp(`<${t}\\b[^>]*>[\\s\\S]*?<\\/${t}>`,"gi");return e.match(r)??[]}function Tt(e){let t=/<([a-z][\w:-]*)\b(?=[^>]*(?:data-(?:pptx-)?slide(?:-container)?\b|class\s*=\s*["'][^"']*\bslide\b))[^>]*>[\s\S]*?<\/\1>/gi;return e.match(t)??[]}function Dt(e){let t=/<([a-z][\w:-]*)\b(?=[^>]*(?:\sdata-notes(?:\s|=|>)|class\s*=\s*["'][^"']*(?<![\w-])(?:notes|note|speaker-note)(?![\w-])))[^>]*>[\s\S]*?<\/\1>/gi;return e.match(t)??[]}function U(e,t){let r=e;for(let n of t)r=r.replace(new RegExp(`<${n}\\b[^>]*>[\\s\\S]*?<\\/${n}>`,"gi"),"");return r}function Ee(e,t){for(let r of t){let n=w(e,r)[0];if(n)return I(n)}return""}function Se(e,t){let n=new RegExp(`\\b${t}\\s*=\\s*(?:"([^"]*)"|'([^']*)')`,"i").exec(e);return n?.[1]??n?.[2]??""}function I(e){return e.replace(/<br\s*\/?>/gi,`
11
+ `).replace(/<[^>]+>/g," ").replace(/&nbsp;/g," ").replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#39;/g,"'").replace(/&#(?:10|13);/g,`
12
+ `)}function k(e){return e.replace(/\s+/g," ").trim()}function Ot(e){return k(Ee(e,["title","h1","h2"]))||null}function _e(e){return Array.from(e.trim().replace(/[^\p{L}\p{N}\p{M}_.-]+/gu,"-").replace(/^[.-]+|[.-]+$/g,"")).slice(0,80).join("")||"artifact"}function Ft(e){let r=e.replaceAll("\\","/").replace(/^\/+/,"").split("/").filter(Boolean);if(r.length===0||r.some((n)=>n==="."||n===".."))return null;return r}function Bt(e){let t=Ft(e);if(!t)throw Error(`invalid zip path: ${e}`);return t.join("/")}function Te(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function E(e){return Te(e).replace(/"/g,"&quot;").replace(/'/g,"&apos;")}function Re(e){return new TextEncoder().encode(e)}function F(e){let t=e.reduce((o,i)=>o+i.length,0),r=new Uint8Array(t),n=0;for(let o of e)r.set(o,n),n+=o.length;return r}function f(e){let t=new Uint8Array(2);return new DataView(t.buffer).setUint16(0,e,!0),t}function x(e){let t=new Uint8Array(4);return new DataView(t.buffer).setUint32(0,e>>>0,!0),t}var ve=null;function Mt(e){let t=ve??Nt();ve=t;let r=4294967295;for(let n of e)r=t[(r^n)&255]^r>>>8;return(r^4294967295)>>>0}function Nt(){let e=new Uint32Array(256);for(let t=0;t<256;t++){let r=t;for(let n=0;n<8;n++)r=r&1?3988292384^r>>>1:r>>>1;e[t]=r>>>0}return e}async function Lt(e,t){if(!oe(e))throw Error("Invalid application snapshot");if(e.uibotCommit!==t)throw Error("Application toolchain mismatch");let r=structuredClone(e),n={version:"2.0",pages:[{id:"main",path:"/",blocks:[{id:"collection_app",type:"CollectionApplication",props:{buildId:r.id}}]}]},o=ee({components:{CollectionApplication:{name:"CollectionApplication",description:"Version-bound read-only paged Collection preview",category:"app",level:"L5",props:{buildId:{type:"string"}}}}}),i=await xe(n,o,{strict:!0});if(i.gaps.length)throw Error("Application compile gaps");return{build:r,source:n,spec:i.spec}}async function yo(e,t){let r=await Lt(e,t),n=["# Collection application","","Read-only generated application. Inject an authenticated PagedCollectionApplicationClient in App.tsx; its rows port must use the version-fenced build endpoint. No credentials or records are included.","",`UIBot source: ${e.uibotCommit}`,`Build: ${e.id}`,`Schema: ${e.descriptor.schemaVersion}; view: ${e.view.id}@${e.view.version}`,"","Deployment and rollback require operator configuration; this archive is not a deployment receipt."].join(`
13
+ `),o=`import React from "react";
14
+ import { CollectionApplicationPreview } from "@uibot/renderer-react/collection-application";
15
+ import type { CompiledCollectionApplication, PagedCollectionApplicationClient } from "@uibot/contracts";
16
+ import artifact from "./application.json";
17
+ const application = artifact as CompiledCollectionApplication;
18
+ export default function App({ client }: { client: Pick<PagedCollectionApplicationClient, "rows"> }) { return <CollectionApplicationPreview application={application} client={client} />; }
19
+ `;return Ie({format:"zip",title:"collection-application",source:n,files:[{path:"application.json",content:JSON.stringify(r,null,2)},{path:"source.uibot.json",content:JSON.stringify(r.source,null,2)},{path:"App.tsx",content:`import React from "react";
20
+ import { CollectionApplicationPreview } from "@uibot/renderer-react/collection-application";
21
+ import type { CompiledCollectionApplication, PagedCollectionApplicationClient } from "@uibot/contracts";
22
+ import artifact from "./application.json";
23
+ const application = artifact as CompiledCollectionApplication;
24
+ export default function App({ client }: { client: Pick<PagedCollectionApplicationClient, "rows"> }) { return <CollectionApplicationPreview application={application} client={client} />; }
25
+ `},{path:"README.md",content:n}]})}export{Lt as compileCollectionApplication,yo as exportCollectionApplication};
@@ -0,0 +1,104 @@
1
+ import type { Agent, Catalog, DesignMdSelector, SkillSelector } from "@uibot/contracts";
2
+ import type { ResourceQueryService } from "@uibot/registry";
3
+ export interface ComposeSystemPromptOptions {
4
+ catalog: Catalog;
5
+ skillSelector?: SkillSelector;
6
+ designMdSelector?: DesignMdSelector;
7
+ agent?: Agent;
8
+ /** User's generation intent — used for skill selection scoring */
9
+ intent: string;
10
+ language?: "zh" | "en";
11
+ /** When set, catalog section uses intent-ranked resource search instead of full dump. */
12
+ resourceQuery?: ResourceQueryService;
13
+ /** Max resources from search (default 24). */
14
+ resourceSearchLimit?: number;
15
+ /**
16
+ * Max tokens to budget for design-md sections (default 2000).
17
+ * Shared by the force-include and intent `select()` calls — forced entries
18
+ * consume the budget first. Audit (chars/4): frontend-principles ≈1218
19
+ * leaves ~782, which cannot hold stripe ≈1821 / vercel ≈1712 / linear ≈1784
20
+ * intact. The generic default stays 2000; Studio / Playground / handoff
21
+ * must use `composeStudioPrompt` (`STUDIO_MAX_DESIGN_MD_TOKENS` = 4500).
22
+ */
23
+ maxDesignMdTokens?: number;
24
+ /** Max tokens to budget for skills sections (default 3000) */
25
+ maxSkillTokens?: number;
26
+ /**
27
+ * Design-md ids that must appear in the composed prompt regardless of intent
28
+ * matching. Used for "house style" entries (e.g. `frontend-principles`) that
29
+ * should anchor every generation. Force-included entries appear before
30
+ * intent-scored ones; duplicates between the two sets are collapsed to a
31
+ * single entry at the force-include position.
32
+ *
33
+ * Implementation calls `designMdSelector.select()` twice: once with
34
+ * `{ ids: forceIncludeDesignMdIds }` to pull forced entries, once with
35
+ * `{ intent }` to fill the remainder. The shared `maxDesignMdTokens` budget
36
+ * is consumed in that order.
37
+ */
38
+ forceIncludeDesignMdIds?: string[];
39
+ /**
40
+ * Maximum number of design-md entries to inject (forced + intent-matched).
41
+ * v2.16+ adds this knob to make the previously hard-coded `3` observable
42
+ * and tunable. When force-included ids exceed this cap, the overflow is
43
+ * **dropped** rather than silently overflowing the budget; the dropped ids
44
+ * are recorded in `PromptTrace.droppedForcedIds` and a `console.warn` is
45
+ * emitted so misconfigurations surface early.
46
+ *
47
+ * Default 3 (preserves pre-v2.16 behaviour).
48
+ */
49
+ maxDesignMdEntries?: number;
50
+ /**
51
+ * Called for each skill included in the composed prompt.
52
+ * Use this to record usage without adding a dependency on @uibot/skills:
53
+ *
54
+ * ```ts
55
+ * onSkillSelected: (skillId) => usageStore.recordInvocation(skillId, { ... })
56
+ * ```
57
+ */
58
+ onSkillSelected?: (skillId: string, intent: string) => void;
59
+ /**
60
+ * When true (default), inject the durable UI Craft baseline after the
61
+ * catalog and before design-md. The baseline is a prompt fragment, not a
62
+ * design-md entry: it still appears when the selector is missing or returns
63
+ * no matches. Pass `false` to opt out (tests / non-UI generation).
64
+ */
65
+ includeUiCraftBaseline?: boolean;
66
+ }
67
+ export interface PromptTrace {
68
+ catalogComponentCount: number;
69
+ designMdIds: string[];
70
+ skillIds: string[];
71
+ /** Resource ids injected via search (v2.45+). */
72
+ resourceIds?: string[];
73
+ agentId?: string;
74
+ /**
75
+ * Force-included design-md ids that were **dropped** because they did not
76
+ * fit under `maxDesignMdEntries` (v2.16+). The selector still returns them
77
+ * in priority order, so the suffix beyond the entry cap appears here; the
78
+ * caller can surface the warning to telemetry / dev console.
79
+ */
80
+ droppedForcedIds?: string[];
81
+ /** True when the durable UI Craft baseline section was injected. */
82
+ uiCraftBaseline?: boolean;
83
+ /**
84
+ * Absolute DESIGN.md path consumed as id `project`, or null when the
85
+ * consumer file was not in the selector result (missing or not loaded).
86
+ */
87
+ projectDesignPath: string | null;
88
+ }
89
+ export interface ComposedSystemPrompt {
90
+ text: string;
91
+ trace: PromptTrace;
92
+ }
93
+ /**
94
+ * Compose a full system prompt from catalog + optional design-md + skills + agent.
95
+ *
96
+ * Section order (cache-friendly: lowest change frequency → highest):
97
+ * 1. Agent system prompt
98
+ * 2. Catalog (components + templates)
99
+ * 3. UI Craft baseline (lane + anti-slop + UIBot hygiene; default on)
100
+ * 4. Design-md summaries
101
+ * 5. Skills body
102
+ * 6. User intent (last, highest cache-bust)
103
+ */
104
+ export declare function composeSystemPrompt(options: ComposeSystemPromptOptions): ComposedSystemPrompt;
@@ -0,0 +1,24 @@
1
+ import type { CapabilityDescriptor, CapabilityType, Catalog, CompiledUIBotSpec, CompileResult, UIBotSpec } from "@uibot/contracts";
2
+ import { type CompilerRegistry } from "@uibot/compiler";
3
+ import { type CreateRenderPlanOptions, type ReactRegistry, type RenderPlanNode, type RenderSpecOptions } from "@uibot/renderer-react";
4
+ export interface CreateUIBotCompositionOptions {
5
+ catalog: Catalog;
6
+ capabilities?: CapabilityDescriptor[];
7
+ compilerRegistry?: CompilerRegistry;
8
+ rendererRegistry?: ReactRegistry;
9
+ /** L3 AppShell specs for `BlockNode.template` expand. Same map as compileSpec/flatten. */
10
+ shellTemplates?: Readonly<Record<string, UIBotSpec>>;
11
+ }
12
+ export interface UIBotComposition {
13
+ readonly catalog: Catalog;
14
+ readonly compilerRegistry: CompilerRegistry;
15
+ readonly rendererRegistry: ReactRegistry;
16
+ readonly capabilities: CapabilityDescriptor[];
17
+ compile(spec: UIBotSpec): Promise<CompileResult>;
18
+ createRenderPlan(spec: CompiledUIBotSpec, options?: CreateRenderPlanOptions): RenderPlanNode;
19
+ renderSpec(spec: CompiledUIBotSpec, options?: RenderSpecOptions): unknown;
20
+ getCapabilities<TContribution = unknown>(type: CapabilityType): CapabilityDescriptor<TContribution>[];
21
+ getCapability<TContribution = unknown>(type: CapabilityType, id: string): CapabilityDescriptor<TContribution> | undefined;
22
+ }
23
+ export declare function createUIBotComposition(options: CreateUIBotCompositionOptions): UIBotComposition;
24
+ export declare function createEmptyUIBotComposition(catalog: Catalog): UIBotComposition;
@@ -0,0 +1,42 @@
1
+ import type { ContextFragment, ContextIndexStatus, ContextKind, ContextRunEvent, ListContextRunEventsOptions } from "@uibot/context";
2
+ import { JsonlContextRunStore } from "@uibot/context";
3
+ import { JsonCodeContextIndexStore, type CodeContextIndex, type ScanWorkspaceFilesOptions } from "@uibot/context-code";
4
+ export interface IndexCodebaseOptions {
5
+ rootDir?: string;
6
+ includeExtensions?: string[];
7
+ maxFileSizeBytes?: number;
8
+ maxFiles?: number;
9
+ respectGitignore?: boolean;
10
+ }
11
+ export interface SearchContextOptions {
12
+ query: string;
13
+ kinds?: ContextKind[];
14
+ maxFragments?: number;
15
+ maxTokens?: number;
16
+ }
17
+ export interface SearchContextResult {
18
+ fragments: ContextFragment[];
19
+ status: ContextIndexStatus;
20
+ }
21
+ export interface UIBotContextService {
22
+ indexCodebase(options?: IndexCodebaseOptions): Promise<ContextIndexStatus>;
23
+ searchContext(options: SearchContextOptions): Promise<SearchContextResult>;
24
+ clearContextIndex(): Promise<void>;
25
+ contextStatus(): Promise<ContextIndexStatus>;
26
+ recordRunEvent(event: ContextRunEvent): Promise<ContextRunEvent>;
27
+ listRunEvents(options?: ListContextRunEventsOptions): Promise<ContextRunEvent[]>;
28
+ }
29
+ export interface CreateUIBotContextServiceOptions {
30
+ rootDir: string;
31
+ store?: Pick<JsonCodeContextIndexStore, "save" | "load" | "clear">;
32
+ runStore?: Pick<JsonlContextRunStore, "append" | "list">;
33
+ buildIndex?: (options: ScanWorkspaceFilesOptions) => CodeContextIndex;
34
+ }
35
+ export declare function resolveContainedIndexRoot(authorityRoot: string, requestedRoot?: string): {
36
+ ok: true;
37
+ rootDir: string;
38
+ } | {
39
+ ok: false;
40
+ code: string;
41
+ };
42
+ export declare function createUIBotContextService(options: CreateUIBotContextServiceOptions): UIBotContextService;
@@ -0,0 +1,5 @@
1
+ import type { CreationAnnotation } from "@uibot/contracts";
2
+ /** Explicit source tags prevent fragments and tag-like script strings passing as documents. */
3
+ export declare function isCompleteAnnotationHtml(source: string): boolean;
4
+ /** Advisory only: an approximate source span cannot prove semantic locality. */
5
+ export declare function annotationChangeWarnings(before: string, after: string, annotations: CreationAnnotation[]): string[];
@@ -0,0 +1,15 @@
1
+ import type { CreationAssetHistory } from "@uibot/contracts";
2
+ type Stamped = {
3
+ id: string;
4
+ number: number;
5
+ createdAt: string;
6
+ };
7
+ /**
8
+ * Append one revision to a project asset history (brand, theme, …) under compare-and-swap:
9
+ * `expected` must equal the current revision id (or null for the first one).
10
+ */
11
+ export declare function appendAssetRevision<R extends Stamped>(history: CreationAssetHistory<R> | undefined, expected: unknown, conflict: {
12
+ code: string;
13
+ message: string;
14
+ }, value: Omit<R, keyof Stamped>, label: string): CreationAssetHistory<R>;
15
+ export {};
@@ -0,0 +1,9 @@
1
+ import type { CreationContent, UIBotSpec } from "@uibot/contracts";
2
+ import { type CreationBrandAssets } from "./creation-brand.js";
3
+ import { type CreationRepository } from "./creation-store.js";
4
+ export declare function createCreationBrandHandler(options: {
5
+ repository: CreationRepository;
6
+ assets?: CreationBrandAssets;
7
+ templates?: Readonly<Record<string, UIBotSpec>>;
8
+ validate(source: CreationContent, kind: string, strict?: boolean): Promise<void>;
9
+ }): (request: Request, projectId: string, resource: string, resourceId?: string, action?: string) => Promise<Response | null>;
@@ -0,0 +1,25 @@
1
+ import type { CreationBrandRevision, CreationContent, CreationProject, LogoAssetManifest, UIBotSpec } from "@uibot/contracts";
2
+ import type { LogoAssetExporter } from "./studio-logo.js";
3
+ export declare const BRAND_LOGO_URL = "uibot-logo://project";
4
+ export interface CreationBrandAssets {
5
+ read(id: string): Promise<{
6
+ manifest: LogoAssetManifest;
7
+ bytes: Uint8Array;
8
+ }>;
9
+ exporter: LogoAssetExporter;
10
+ /** Host-owned static rendering; no client driver or secret enters the export. */
11
+ renderSpec?(source: string, title: string, css: string, templates?: Readonly<Record<string, UIBotSpec>>): Array<{
12
+ path: string;
13
+ content: string;
14
+ }>;
15
+ }
16
+ export declare function brandRevision(project: CreationProject, id: string): CreationBrandRevision;
17
+ export declare function readBrandOptions(value: unknown): CreationBrandRevision["options"];
18
+ export declare function readBrandAsset(assets: CreationBrandAssets | undefined, id: string, hash?: string): Promise<{
19
+ manifest: LogoAssetManifest;
20
+ bytes: Uint8Array;
21
+ }>;
22
+ export declare function appendBrand(project: CreationProject, expected: unknown, value: Omit<CreationBrandRevision, "id" | "number" | "createdAt">): void;
23
+ export declare function bindBrandContent(source: CreationContent, title: string, insert: boolean): CreationContent;
24
+ export declare function materializeBrandHtml(html: string, logo: string, favicon: string, manifest?: string): string;
25
+ export declare function materializeBrandSpec(source: string, logo: string): string;
@@ -0,0 +1,11 @@
1
+ import type { CreationCopyBindingReceipt, CreationFactBindingReceipt, CreationFactSourcePin, CreationSource } from "@uibot/contracts";
2
+ export declare function pinCreationCopy(sources: CreationSource[]): CreationFactSourcePin[];
3
+ export declare function creationCopyPrompt(sources: CreationSource[], pins: CreationFactSourcePin[]): string;
4
+ /** Enforces provided-copy fidelity and trusted HTML channels, not source truth or placement. */
5
+ export declare function bindCreationCopyHtml(content: string, sources: CreationSource[], pins: CreationFactSourcePin[], options?: {
6
+ facts?: CreationFactBindingReceipt[];
7
+ brandTitle?: string;
8
+ }): {
9
+ content: string;
10
+ bindings: CreationCopyBindingReceipt[];
11
+ };
@@ -0,0 +1,25 @@
1
+ import type { Agent, CapabilityDescriptor, CreationDomain, UIBotPlugin, Skill, CreationSourceFormat, ArtifactExportFormat } from "@uibot/contracts";
2
+ /** Domain packs reuse the existing registry; no separate pack registry/runtime. */
3
+ export declare function createOfficialCreationPlugins(disabledKinds?: string[]): UIBotPlugin[];
4
+ export interface CreationDomainPluginOptions {
5
+ id: string;
6
+ version: string;
7
+ kind: string;
8
+ title: string;
9
+ formats: readonly CreationSourceFormat[];
10
+ outputFormat: CreationSourceFormat;
11
+ exports: readonly ArtifactExportFormat[];
12
+ instruction: string;
13
+ enabled?: boolean;
14
+ editors?: CreationDomain["editors"];
15
+ requiredHtmlElements?: readonly string[];
16
+ generationInstructions?: CreationDomain["generationInstructions"];
17
+ }
18
+ /** Composition helper for trusted definitions using the existing capabilities. */
19
+ export declare function createCreationDomainPlugin(definition: CreationDomainPluginOptions): UIBotPlugin;
20
+ export interface CreationDomainDefinition {
21
+ domain: CreationDomain;
22
+ agent: Agent;
23
+ skill: Skill;
24
+ }
25
+ export declare function creationDomainsFromCapabilities(capabilities: CapabilityDescriptor[]): CreationDomainDefinition[];
@@ -0,0 +1,8 @@
1
+ import type { CreationFactBindingReceipt, CreationFactSourcePin, CreationSource } from "@uibot/contracts";
2
+ export declare function pinCreationFacts(sources: CreationSource[]): CreationFactSourcePin[];
3
+ export declare function creationFactsPrompt(sources: CreationSource[], pins: CreationFactSourcePin[]): string;
4
+ /** Only explicit text fields are covered; free prose still requires quality review. */
5
+ export declare function bindCreationFactsHtml(content: string, sources: CreationSource[], pins: CreationFactSourcePin[]): {
6
+ content: string;
7
+ bindings: CreationFactBindingReceipt[];
8
+ };
@@ -0,0 +1,35 @@
1
+ import type { CreateCreationHandlerOptions, CreationGenerateInput } from "./creation-http.js";
2
+ import type { Catalog, CreationArtifact, CreationProject, CreationReference, CreationRun, CreationRunInput, CreationSourceFormat } from "@uibot/contracts";
3
+ import type { CreationDomainDefinition } from "./creation-domains.js";
4
+ import { CreationError } from "./creation-store.js";
5
+ export declare function reply(body: unknown, status?: number): Response;
6
+ export declare function normalizeGeneratedSource(content: string, format: CreationSourceFormat): string;
7
+ export declare function isRecord(value: unknown): value is Record<string, unknown>;
8
+ export declare function isBlockNode(value: unknown): value is Record<string, unknown> & {
9
+ type: string;
10
+ };
11
+ export declare function isBlockArray(value: unknown): value is Array<Record<string, unknown>>;
12
+ export declare function isSlotBlockMap(value: unknown): value is Record<string, Array<Record<string, unknown>>>;
13
+ export declare function assertSpecChildContainers(spec: unknown): void;
14
+ export declare function hoistMisplacedBlockFields(content: string, catalog: Catalog): string;
15
+ export declare function referenceFrom(value: unknown): CreationReference;
16
+ export declare function runInputFrom(value: unknown): CreationRunInput;
17
+ export declare function artifactForDomain(definition: CreationDomainDefinition, title: string): CreationArtifact;
18
+ export declare function findRun(project: CreationProject, id: string): CreationRun;
19
+ export declare function generateWithAbort(generate: NonNullable<CreateCreationHandlerOptions["generate"]>, input: CreationGenerateInput): Promise<string>;
20
+ export declare class StateBindingError extends CreationError {
21
+ readonly diagnostics: Array<{
22
+ code: "refs:state-declared";
23
+ path: string;
24
+ message: string;
25
+ }>;
26
+ constructor(message: string, diagnostics: Array<{
27
+ code: "refs:state-declared";
28
+ path: string;
29
+ message: string;
30
+ }>);
31
+ }
32
+ export declare class SpecJsonError extends CreationError {
33
+ readonly detail: string;
34
+ constructor(detail: string);
35
+ }