@mean-weasel/lineage 0.1.24 → 0.1.25

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/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 0.1.25
6
+
7
+ - Keep tagged release provenance clean after documentation builds so verified stable installations accept the published package.
8
+
5
9
  ## 0.1.24
6
10
 
7
11
  - Add persistent per-canvas Social marks across the UI and CLI, including agent-readable local media context, claim enforcement, and safe cleanup when a node leaves its canvas.
@@ -47,4 +47,4 @@ import{a as e,c as t,d as n,f as r,i,l as a,n as o,o as s,p as c,r as l,s as u,t
47
47
  "providerId": "codex-handoff",
48
48
  "providerLabel": "Codex handoff"
49
49
  }
50
- ]`);function ob(e,t){let n=ab.find(n=>n.adapterType===e&&n.providerId===t);if(!n)throw Error(`Missing public adapter catalog entry: ${e}/${t}`);return n}var sb={channel:`dev`,version:`0.1.24`},cb={cloud:D,image_generator:V,scheduler:ae},lb=Object.fromEntries(ab.map(e=>[e.adapterType,e.capabilityLabel])),ub=[{adapterType:`cloud`,ariaLabel:`Cloud storage settings`},{adapterType:`scheduler`,ariaLabel:`Social scheduling settings`},{adapterType:`image_generator`,ariaLabel:`Image generation settings`}];function db(e){return typeof e==`boolean`?e?`on`:`off`:typeof e==`number`?String(e):typeof e==`string`?e||`not set`:JSON.stringify(e)}function fb(e){return Object.entries(e.safe_config).filter(([e])=>![`secret`,`token`,`password`,`credential`,`apiKey`].includes(e))}function pb(e){return e.health_status===`configured`?`ok`:e.health_status===`missing_config`?`warn`:`muted`}function mb(e){return(0,X.jsx)(`button`,{"aria-checked":e.checked,"aria-label":e.label,className:`settings-switch ${e.checked?`on`:``}`,disabled:e.disabled,onClick:e.onClick,role:`switch`,type:`button`,children:(0,X.jsx)(`span`,{})})}function hb(e){let[t,n]=(0,p.useState)(null),[r,i]=(0,p.useState)(null),[a,s]=(0,p.useState)(!0),[c,l]=(0,p.useState)(``),[u,d]=(0,p.useState)(Cm);function f(){let t=!u;if(!wm(t)){e.onToast(`error`,`Browser storage is unavailable, so the hover preview preference could not be saved`);return}d(t),e.onToast(`ok`,`Lineage hover previews ${t?`enabled`:`disabled`}`)}async function m(){s(!0);try{let[t,r]=await Promise.all([g(`/api/adapters/settings?project=${encodeURIComponent(e.project)}`),g(`/api/runtime`)]);n(t),i(r.runtime)}catch(t){e.onToast(`error`,t instanceof Error?t.message:String(t))}finally{s(!1)}}async function h(t){let r=`${t.adapter_type}:${t.provider}`;l(r);try{let r=await g(`/api/adapters/settings/${t.adapter_type}/${t.provider}`,{body:JSON.stringify({confirmWrite:!0,enabled:!t.enabled,project:e.project,safeConfig:t.safe_config}),headers:{"Content-Type":`application/json`},method:`POST`});n(e=>e&&{...e,settings:e.settings.map(e=>e.adapter_type===r.setting.adapter_type&&e.provider===r.setting.provider?r.setting:e)}),e.onToast(`ok`,`${lb[t.adapter_type]} ${r.setting.enabled?`enabled`:`disabled`}`)}catch(t){e.onToast(`error`,t instanceof Error?t.message:String(t))}finally{l(``)}}return(0,p.useEffect)(()=>{m()},[e.project]),(0,X.jsxs)(`section`,{className:`settings-view`,children:[(0,X.jsxs)(`header`,{className:`settings-header`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h2`,{children:`Settings`}),(0,X.jsxs)(`p`,{children:[`Adapter switches, safe local preferences, and credential-source status for `,e.project,`.`]})]}),(0,X.jsxs)(`button`,{className:`secondary-button`,disabled:a,onClick:()=>void m(),type:`button`,children:[a?(0,X.jsx)(W,{className:`spin`,size:17}):(0,X.jsx)(o,{size:17}),`Refresh`]})]}),(0,X.jsxs)(`div`,{className:`settings-sections`,children:[(0,X.jsxs)(`section`,{"aria-label":`Release information`,className:`settings-section`,children:[(0,X.jsx)(`h3`,{children:`Release`}),(0,X.jsxs)(`dl`,{className:`settings-release`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:`Version`}),(0,X.jsx)(`dd`,{children:r?.version||sb.version})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:`Channel`}),(0,X.jsx)(`dd`,{children:r?.channel||sb.channel})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:`Profile`}),(0,X.jsx)(`dd`,{children:r?.profile.id||`loading`})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:`Environment`}),(0,X.jsx)(`dd`,{children:r?.profile.environment||`loading`})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:`Binding`}),(0,X.jsx)(`dd`,{children:r?r.profile.bound?`bound`:`legacy unbound`:`loading`})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:`Git`}),(0,X.jsx)(`dd`,{children:r?.git_sha||`not available`})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:`Assets`}),(0,X.jsx)(`dd`,{className:`settings-path`,children:r?.asset_root||`loading`})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:`SQLite`}),(0,X.jsx)(`dd`,{className:`settings-path`,children:r?.database.path||`loading`})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:`Database`}),(0,X.jsx)(`dd`,{children:r?.database.exists?`${r.database.projects??0} projects / ${r.database.workspaces??0} workspaces`:`not created yet`})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:`Schema`}),(0,X.jsx)(`dd`,{children:r?`${r.schema.migration_keys.length} migration marker(s)`:`loading`})]})]})]}),(0,X.jsxs)(`section`,{"aria-label":`Lineage experience settings`,className:`settings-section`,children:[(0,X.jsx)(`h3`,{children:`Lineage experience`}),(0,X.jsx)(`div`,{className:`settings-grid`,children:(0,X.jsx)(`article`,{className:`settings-card`,children:(0,X.jsxs)(`div`,{className:`settings-card-head`,children:[(0,X.jsx)(`span`,{className:`settings-icon`,children:(0,X.jsx)(N,{size:19})}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h4`,{children:`Hover previews`}),(0,X.jsx)(`p`,{children:`Show the full asset and quick Branch/Re-roll/Details actions when hovering over or focusing a lineage node. Double-click details remain available when this is off.`})]}),(0,X.jsx)(mb,{checked:u,label:`Enable lineage hover previews`,onClick:f})]})})})]}),ub.map(e=>(0,X.jsxs)(`section`,{"aria-label":e.ariaLabel,className:`settings-section`,children:[(0,X.jsx)(`h3`,{children:lb[e.adapterType]}),(0,X.jsx)(`div`,{className:`settings-grid`,children:(t?.settings||[]).filter(t=>t.adapter_type===e.adapterType).map(e=>{let t=cb[e.adapter_type],n=ob(e.adapter_type,e.provider),r=`Enable ${e.label===`Buffer`?`Buffer scheduling`:e.label}`,i=c===`${e.adapter_type}:${e.provider}`;return(0,X.jsxs)(`article`,{className:`settings-card`,children:[(0,X.jsxs)(`div`,{className:`settings-card-head`,children:[(0,X.jsx)(`span`,{className:`settings-icon`,children:(0,X.jsx)(t,{size:19})}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h4`,{children:e.label}),(0,X.jsx)(`p`,{children:e.description})]}),(0,X.jsx)(mb,{checked:e.enabled,disabled:i,label:r,onClick:()=>void h(e)})]}),(0,X.jsxs)(`dl`,{className:`settings-meta`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:`Status`}),(0,X.jsxs)(`dd`,{className:pb(e),children:[e.health_status===`configured`?(0,X.jsx)(w,{size:14}):(0,X.jsx)(C,{size:14}),e.health_status.replace(/_/g,` `)]})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:`Maturity`}),(0,X.jsx)(`dd`,{children:n.maturity})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:`Credential source`}),(0,X.jsx)(`dd`,{children:e.credential.label})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:`Secret ref`}),(0,X.jsx)(`dd`,{children:e.credential.secret_ref||`none`})]})]}),fb(e).length>0&&(0,X.jsx)(`div`,{className:`settings-config`,children:fb(e).map(([e,t])=>(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`strong`,{children:e}),db(t)]},e))})]},`${e.adapter_type}:${e.provider}`)})})]},e.adapterType)),a&&!t&&(0,X.jsx)(`div`,{className:`settings-loading`,children:`Loading settings...`})]})]})}var gb=`Lineage`,_b=`Local-first creative lineage workspace`;function vb(e){let{channel:t,channels:n,placementStatus:r,project:i,projects:a,setChannel:o,setPlacementStatus:s,setProject:c,setSource:l,setStatus:u,source:d,status:f}=e,[m,h]=(0,p.useState)(!1),[g,_]=(0,p.useState)(!0),v=a.length?a.map(e=>e.project):[i];return(0,X.jsxs)(`aside`,{className:`sidebar ${g?``:`collapsed`}`,children:[(0,X.jsx)(`button`,{"aria-label":g?`Collapse sidebar`:`Expand sidebar`,className:`sidebar-collapse-toggle`,onClick:()=>_(e=>!e),type:`button`,children:g?(0,X.jsx)(te,{size:16}):(0,X.jsx)(ne,{size:16})}),(0,X.jsxs)(`div`,{className:`brand`,children:[(0,X.jsx)(`div`,{className:`brand-mark`,"aria-label":_b,children:`L`}),(0,X.jsxs)(`div`,{className:`brand-copy`,children:[(0,X.jsx)(`h1`,{children:gb}),(0,X.jsxs)(`p`,{children:[(0,X.jsx)(`span`,{children:i}),(0,X.jsxs)(`span`,{"aria-label":`Lineage version ${sb.version}`,className:`brand-version`,title:`Lineage version ${sb.version}, ${sb.channel} channel`,children:[`v`,sb.version]})]})]})]}),(0,X.jsxs)(`button`,{"aria-controls":`mobile-sidebar-controls`,"aria-expanded":m,className:`mobile-filter-toggle`,onClick:()=>h(e=>!e),type:`button`,children:[(0,X.jsx)(K,{size:16}),`Filters`,(0,X.jsx)(S,{className:m?`open`:``,size:16})]}),(0,X.jsxs)(`div`,{className:`sidebar-mobile-collapse`,"data-open":m,id:`mobile-sidebar-controls`,children:[(0,X.jsxs)(`div`,{className:`side-section`,children:[(0,X.jsx)(`h2`,{children:`Project`}),(0,X.jsx)(yb,{id:`asset-project-filter`,label:`Project`,value:i,values:v,onChange:c})]}),(0,X.jsxs)(`section`,{className:`side-section`,children:[(0,X.jsx)(`h2`,{children:`Filters`}),(0,X.jsx)(yb,{id:`asset-source-filter`,label:`Source`,value:d,values:Y,onChange:e=>l(e)}),(0,X.jsx)(yb,{id:`asset-status-filter`,label:`Status`,value:f,values:J,onChange:e=>u(e)}),(0,X.jsx)(yb,{id:`asset-channel-filter`,label:`Channel`,value:t,values:n,onChange:o}),(0,X.jsx)(yb,{id:`asset-placement-filter`,label:`Placement`,value:r,values:he,onChange:e=>s(e)})]})]})]})}function yb({id:e,label:t,value:n,values:r,onChange:i}){return(0,X.jsxs)(`label`,{htmlFor:e,children:[t,(0,X.jsx)(`select`,{"aria-label":t,id:e,value:n,onChange:e=>i(e.target.value),children:r.map(e=>(0,X.jsx)(`option`,{value:e,children:e},e))})]})}var bb=[{label:`Lineage`,view:`lineage`},{label:`Review`,view:`review`},{label:`Assets`,view:`assets`},{label:`Agents`,view:`agents`},{label:`Settings`,view:`settings`}],xb=[{label:`Ledger`,view:`ledger`},{label:`Content batches`,view:`content`},{label:`Backup queue`,view:`backup`}];function Sb(e){let t=xb.some(t=>t.view===e.view);function n(t){e.setView(t),e.onMoreOpenChange(!1)}function r(t){e.setView(t),e.onMoreOpenChange(!1)}return(0,X.jsxs)(`header`,{className:`topbar`,children:[(0,X.jsxs)(`div`,{className:`view-tabs`,role:`tablist`,"aria-label":`${gb} views`,children:[bb.map(t=>(0,X.jsx)(`button`,{"aria-pressed":e.view===t.view,className:e.view===t.view?`active`:``,onClick:()=>n(t.view),type:`button`,children:t.label},t.view)),(0,X.jsxs)(`div`,{className:`more-menu`,children:[(0,X.jsxs)(`button`,{"aria-expanded":e.moreOpen,"aria-haspopup":`menu`,"aria-pressed":t,className:t?`active`:``,onClick:()=>e.onMoreOpenChange(!e.moreOpen),type:`button`,children:[(0,X.jsx)(j,{size:16}),` More `,(0,X.jsx)(S,{className:e.moreOpen?`open`:``,size:15})]}),e.moreOpen&&(0,X.jsx)(`div`,{className:`more-menu-popover`,role:`menu`,children:xb.map(t=>(0,X.jsx)(`button`,{"aria-pressed":e.view===t.view,onClick:()=>r(t.view),role:`menuitem`,type:`button`,children:t.label},t.view))})]})]}),(0,X.jsx)(Cb,{runtime:e.runtime,unavailable:e.runtimeIdentityUnavailable}),(0,X.jsxs)(`div`,{className:`searchbox`,children:[(0,X.jsx)(ie,{size:17}),(0,X.jsx)(`input`,{onChange:t=>e.setQuery(t.target.value),placeholder:`Search assets, campaigns, hooks`,value:e.query})]}),e.view!==`lineage`&&(0,X.jsxs)(`button`,{"aria-expanded":e.assetDetailsOpen,className:`secondary-button`,disabled:!e.canInspectAsset,onClick:()=>{e.onMoreOpenChange(!1),e.setAssetDetailsOpen(!e.assetDetailsOpen)},type:`button`,children:[(0,X.jsx)(I,{size:17}),`Details`]}),(0,X.jsx)(`button`,{className:`icon-button`,disabled:e.loading,onClick:()=>void e.refresh(),title:`Refresh current page`,children:e.loading?(0,X.jsx)(W,{className:`spin`,size:18}):(0,X.jsx)(o,{size:18})}),(0,X.jsxs)(`button`,{className:`primary-button`,onClick:()=>e.setUploadOpen(!0),children:[(0,X.jsx)(ue,{size:17}),`Upload`]})]})}function Cb(e){if(e.unavailable)return(0,X.jsx)(`div`,{"aria-label":`Lineage runtime identity unavailable`,className:`runtime-identity-badge unavailable`,children:`IDENTITY UNAVAILABLE`});if(!e.runtime)return(0,X.jsx)(`div`,{"aria-label":`Loading Lineage runtime identity`,className:`runtime-identity-badge loading`,children:`IDENTITY LOADING`});let{profile:t}=e.runtime,n=t.bound?``:` · UNBOUND`,r=[`${t.environment.toUpperCase()} profile ${t.id}${t.bound?``:` (unbound)`}`,`Channel ${e.runtime.channel}`,`Version ${e.runtime.version}`,t.warning].filter(Boolean).join(` · `);return(0,X.jsxs)(`div`,{"aria-label":`Lineage ${t.environment} profile ${t.id}${t.bound?``:` unbound`}`,className:`runtime-identity-badge ${t.environment} ${t.bound?`bound`:`unbound`}`,"data-profile-id":t.id,title:r,children:[(0,X.jsx)(`strong`,{children:t.environment.toUpperCase()}),(0,X.jsxs)(`span`,{children:[t.id,n]})]})}function wb({toast:e,onDismiss:t}){return(0,X.jsxs)(`div`,{className:`toast ${e.type}`,role:`status`,children:[e.type===`ok`?(0,X.jsx)(w,{size:16}):(0,X.jsx)(oe,{size:16}),(0,X.jsx)(`span`,{children:e.message}),(0,X.jsx)(`button`,{onClick:t,children:`Dismiss`})]})}var Tb=200*1024*1024;function Eb({channels:e,project:t,onClose:n,onUploaded:r,onError:i}){let[a,o]=(0,p.useState)({assetId:``,audience:`short-form-creators`,campaign:`2026-06-organic-traffic-test`,channel:e[0]||`meta`,cta:``,hook:``,status:`working`,title:``,type:`image`,utmContent:``}),[s,c]=(0,p.useState)(null),[l,u]=(0,p.useState)(!1),[d,f]=(0,p.useState)(!1);function m(e,t){o(n=>({...n,[e]:t}))}function h(e){o(t=>({...t,assetId:t.assetId||pe(`demo-${t.channel}-${e}`),title:e,utmContent:t.utmContent||pe(e).replaceAll(`-`,`_`)}))}function _(e){if(!e){c(null);return}if(e.size>Tb){i(`File is larger than ${q(Tb)}`);return}c(e)}async function v(e){if(e.preventDefault(),!s)return i(`Choose a file before uploading`);f(!0);try{let e=new FormData;Object.entries({project:t,...a,confirmWrite:String(l)}).forEach(([t,n])=>e.append(t,n)),e.append(`file`,s),await r((await g(`/api/assets/upload`,{method:`POST`,body:e})).message)}catch(e){i(e instanceof Error?e.message:String(e))}finally{f(!1)}}return(0,X.jsx)(`div`,{className:`drawer-backdrop`,children:(0,X.jsxs)(`form`,{className:`upload-drawer`,onSubmit:v,children:[(0,X.jsxs)(`header`,{children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h2`,{children:`Upload asset`}),(0,X.jsx)(`p`,{children:t})]}),(0,X.jsx)(`button`,{type:`button`,onClick:n,children:`Close`})]}),(0,X.jsxs)(`label`,{className:`file-drop`,children:[(0,X.jsx)(ue,{size:20}),(0,X.jsx)(`span`,{children:s?s.name:`Choose creative export up to ${q(Tb)}`}),(0,X.jsx)(`input`,{type:`file`,onChange:e=>_(e.target.files?.[0])})]}),(0,X.jsxs)(`div`,{className:`form-grid`,children:[(0,X.jsxs)(`label`,{children:[`Title`,(0,X.jsx)(`input`,{value:a.title,onChange:e=>h(e.target.value),required:!0})]}),(0,X.jsxs)(`label`,{children:[`Asset ID`,(0,X.jsx)(`input`,{value:a.assetId,onChange:e=>m(`assetId`,e.target.value),required:!0})]}),(0,X.jsxs)(`label`,{children:[`Campaign`,(0,X.jsx)(`input`,{value:a.campaign,onChange:e=>m(`campaign`,e.target.value),required:!0})]}),(0,X.jsxs)(`label`,{children:[`Channel`,(0,X.jsx)(`select`,{value:a.channel,onChange:e=>m(`channel`,e.target.value),children:e.map(e=>(0,X.jsx)(`option`,{children:e},e))})]}),(0,X.jsxs)(`label`,{children:[`Audience`,(0,X.jsx)(`input`,{value:a.audience,onChange:e=>m(`audience`,e.target.value),required:!0})]}),(0,X.jsxs)(`label`,{children:[`Status`,(0,X.jsxs)(`select`,{value:a.status,onChange:e=>m(`status`,e.target.value),children:[(0,X.jsx)(`option`,{children:`working`}),(0,X.jsx)(`option`,{children:`published`})]})]}),(0,X.jsxs)(`label`,{children:[`Type`,(0,X.jsx)(`select`,{value:a.type,onChange:e=>m(`type`,e.target.value),children:ge.map(e=>(0,X.jsx)(`option`,{children:e},e))})]}),(0,X.jsxs)(`label`,{children:[`UTM content`,(0,X.jsx)(`input`,{value:a.utmContent,onChange:e=>m(`utmContent`,e.target.value),required:!0})]}),(0,X.jsxs)(`label`,{className:`wide`,children:[`Hook`,(0,X.jsx)(`input`,{value:a.hook,onChange:e=>m(`hook`,e.target.value)})]}),(0,X.jsxs)(`label`,{className:`wide`,children:[`CTA`,(0,X.jsx)(`input`,{value:a.cta,onChange:e=>m(`cta`,e.target.value),required:!0})]})]}),(0,X.jsxs)(`label`,{className:`confirm-line`,children:[(0,X.jsx)(`input`,{type:`checkbox`,checked:l,onChange:e=>u(e.target.checked)}),(0,X.jsx)(`span`,{children:`Confirm write to the production asset bucket`})]}),(0,X.jsxs)(`footer`,{children:[(0,X.jsx)(`button`,{type:`button`,onClick:n,children:`Cancel`}),(0,X.jsxs)(`button`,{className:`primary-button`,disabled:d||!l,children:[d?(0,X.jsx)(W,{className:`spin`,size:16}):(0,X.jsx)(ue,{size:16}),`Upload`]})]})]})})}function Db(e,t){let n=`${e} ${t}`.toLowerCase();return n.includes(`agent`)||n.includes(`command`)||n.includes(`selection`)||n.includes(`next context`)}function Ob(){return typeof window>`u`?me:new URLSearchParams(window.location.search).get(`project`)||`demo-project`}function kb(){let[e,t]=(0,p.useState)(null),[n,r]=(0,p.useState)(null),[i,a]=(0,p.useState)(Ob),[o,s]=(0,p.useState)([]),[c,l]=(0,p.useState)(`all`),[u,d]=(0,p.useState)(`all`),[f,m]=(0,p.useState)(`local`),[h,y]=(0,p.useState)(`all`),[b,x]=(0,p.useState)(``),[S,C]=(0,p.useState)(1),[w,T]=(0,p.useState)(10),[E,D]=(0,p.useState)(!1),[O,k]=(0,p.useState)(!0),[A,j]=(0,p.useState)(null),[M,N]=(0,p.useState)(null),[P,F]=(0,p.useState)({}),[I,L]=(0,p.useState)({}),[R,z]=(0,p.useState)([]),[B,V]=(0,p.useState)([]),[ee,H]=(0,p.useState)(!1),[U,W]=(0,p.useState)(!1),[G,te]=(0,p.useState)(`lineage`),[ne,re]=(0,p.useState)(!1),[ie,ae]=(0,p.useState)(null),[oe,K]=(0,p.useState)(0),[se,ce]=(0,p.useState)(null),[le,ue]=(0,p.useState)(!1),[de,q]=(0,p.useState)(null),fe=(0,p.useCallback)(e=>{q(t=>e?`lineage-actions`:t===`lineage-actions`?null:t)},[]),pe=(0,p.useCallback)(e=>{q(t=>e?`topbar-more`:t===`topbar-more`?null:t)},[]),me=(0,p.useCallback)((e,t)=>{j({type:e,message:t})},[]),J=e?.catalog.project===i?e:null,he=J?.assets||[],Y=xe(he,n)||(ie?.project===i&&ie.asset_id===n?ie:void 0),ge=Y?.asset_id||``,_e=[...B.filter(e=>R.includes(e.asset_id)),...he.filter(e=>R.includes(e.asset_id)&&e.local?.relative_path)].filter((e,t,n)=>n.findIndex(t=>t.asset_id===e.asset_id)===t),ve=Y&&P[Y.asset_id]||null,ye=(0,p.useMemo)(()=>[`all`,...J?.facets.channels||[]],[J]),be=(0,p.useMemo)(()=>({assets:J?.catalog.asset_count||0,live:J?.liveObjects.length||0,orphan:J?.orphanObjects.length||0,size:J?.facets.totalSizeBytes||0}),[J]);async function Ce(){try{let e=await g(`/api/projects`);s(e.projects),a(t=>e.projects.some(e=>e.project===t)?t:e.projects[0]?.project||`demo-project`)}catch(e){j({type:`error`,message:e instanceof Error?e.message:String(e)})}}async function we(){try{let e=await g(`/api/runtime`);ce(e.runtime),ue(!1)}catch{ce(null),ue(!0)}}async function Te(){k(!0);try{let e=await g(`/api/assets?${Ee()}`);t(e),r(t=>xe(e.assets,t)?.asset_id||(t&&ie?.asset_id===t?t:null)),F({}),L({})}catch(e){j({type:`error`,message:e instanceof Error?e.message:String(e)})}finally{k(!1)}}function Ee(){let e=new URLSearchParams({project:i,page:String(S),pageSize:String(w),live:String(E),source:f});return c!==`all`&&e.set(`status`,c),u!==`all`&&e.set(`placementStatus`,u),h!==`all`&&e.set(`channel`,h),b.trim()&&e.set(`q`,b.trim()),e.toString()}async function De(e){try{let t=await e();j({type:`ok`,message:t.message}),F({}),await Te()}catch(e){j({type:`error`,message:e instanceof Error?e.message:String(e)})}}async function Oe(e,t={}){if(!Se(e))return null;let n=P[e.asset_id];if(n)return t.open&&window.open(n,`_blank`,`noopener,noreferrer`),n;if(e.local?.relative_path){let n=`/api/assets/local-preview?${new URLSearchParams({project:i,path:e.local.relative_path}).toString()}`;return F(t=>({...t,[e.asset_id]:n})),L(t=>({...t,[e.asset_id]:``})),t.open&&window.open(n,`_blank`,`noopener,noreferrer`),n}try{let n=await g(`/api/assets/presign`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({project:i,assetId:e.asset_id,expiresIn:900})});return F(t=>({...t,[e.asset_id]:n.url})),L(t=>({...t,[e.asset_id]:``})),t.open&&window.open(n.url,`_blank`,`noopener,noreferrer`),n.url}catch(n){let r=n instanceof Error?n.message:String(n);return L(t=>({...t,[e.asset_id]:r})),t.quiet||j({type:`error`,message:`Preview unavailable. Check S3 credentials or pull the asset locally.`}),null}}async function ke(e,t){try{let n=await Bm(e);j({type:`ok`,message:n.method===`fallback`?`Copied ${t} using browser fallback`:`Copied ${t}`}),N(Db(t,e)?{label:t,text:e}:null)}catch(n){N(Db(t,e)?{label:t,text:e}:null),j({type:`error`,message:n instanceof Error?n.message:String(n)})}}async function je(e){let t=await Oe(e,{quiet:!0});t&&await ke(t,`preview link`)}function Ne(e){e.local?.relative_path&&(z(t=>t.includes(e.asset_id)?t:[...t,e.asset_id]),V(t=>t.some(t=>t.asset_id===e.asset_id)?t:[...t,e]))}function Z(e){ae(e),r(e.asset_id),re(!0)}async function Pe(e){r(e),re(!0);let t=he.find(t=>t.asset_id===e);if(t){ae(t);return}try{let t=await g(`/api/assets/lookup`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({project:i,assetIds:[e]})});t.assets[0]&&ae(t.assets[0])}catch(e){j({type:`error`,message:e instanceof Error?e.message:String(e)})}}function Fe(){m(`local`),l(`all`),d(`all`),x(``),te(`backup`)}async function Ie(e){try{e.assetId&&r(e.assetId),e.view===`lineage`&&e.workspaceId&&await g(`/api/lineage-workspaces/${encodeURIComponent(e.workspaceId)}/activate`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({project:i,confirmWrite:!0})}),re(!1),te(e.view),j({type:`ok`,message:`Opened ${e.claim.target_title||e.claim.target_id}`})}catch(e){j({type:`error`,message:e instanceof Error?e.message:String(e)})}}function Le(e){e.local?.relative_path&&(z(t=>t.includes(e.asset_id)?t.filter(t=>t!==e.asset_id):[...t,e.asset_id]),V(t=>t.filter(t=>t.asset_id!==e.asset_id)))}return(0,p.useEffect)(()=>{Ce(),we()},[]),(0,p.useEffect)(()=>{let e=new URLSearchParams(window.location.search);e.get(`project`)!==i&&(e.set(`project`,i),window.history.replaceState(null,``,`${window.location.pathname}?${e.toString()}${window.location.hash}`))},[i]),(0,p.useEffect)(()=>{j(null),N(null),ae(null),re(!1)},[i]),(0,p.useEffect)(()=>{Te()},[S,w,i,c,u,f,h,b,E]),(0,p.useEffect)(()=>{C(1)},[i,c,u,f,h,b,w]),(0,p.useEffect)(()=>{!Se(Y)||P[Y.asset_id]||Oe(Y,{quiet:!0})},[Y?.asset_id,Y?.s3?.version_id,P]),(0,p.useEffect)(()=>{if(A?.type!==`ok`)return;let e=window.setTimeout(()=>j(null),2600);return()=>window.clearTimeout(e)},[A?.message,A?.type]),(0,p.useEffect)(()=>{G===`backup`&&(m(`local`),l(`all`),d(`all`))},[G]),(0,p.useEffect)(()=>{q(null)},[G]),(0,p.useEffect)(()=>{ge||re(!1)},[ge]),(0,X.jsx)(Me,{runtime:se,children:(0,X.jsxs)(`div`,{className:`app-shell ${G===`lineage`?`lineage-mode`:``}`,children:[(0,X.jsx)(vb,{channel:h,channels:ye,liveSync:E,placementStatus:u,project:i,projects:o,setChannel:y,setPlacementStatus:d,setProject:a,setSource:m,setStatus:l,setView:te,showBackupQueue:Fe,source:f,snapshot:J,status:c,totals:be}),(0,X.jsxs)(`main`,{className:`workspace`,children:[(0,X.jsx)(Sb,{assetDetailsOpen:ne,canInspectAsset:!!Y,loading:O,moreOpen:de===`topbar-more`,onMoreOpenChange:pe,query:b,refresh:Te,runtime:se,runtimeIdentityUnavailable:le,setAssetDetailsOpen:re,setQuery:x,setUploadOpen:W,setView:e=>e===`backup`?Fe():te(e),view:G}),A&&(0,X.jsx)(wb,{toast:A,onDismiss:()=>j(null)}),M&&(0,X.jsx)(Ct,{copiedText:M,onDismiss:()=>N(null)}),(0,X.jsx)(Ot,{onCopy:ke,project:i,refreshKey:oe,selectedAsset:Y,view:G}),G===`review`?(0,X.jsx)(Yy,{channel:h,onCopy:ke,onLocalReview:async(e,t)=>{await De(()=>_(`/api/local-review/${e.asset_id}`,i,{reviewState:t,confirmWrite:!0}))},onOpenBackup:e=>{Ne(e),H(!0)},onSelectAsset:e=>{Z(e)},project:i,selected:Y}):G===`ledger`?(0,X.jsx)(Vt,{project:i,query:b,onOpenAsset:Pe}):G===`content`?(0,X.jsx)(_t,{onCopy:ke,onOpenAsset:Pe,onToast:me,onWorkTargetsChanged:()=>K(e=>e+1),project:i,selectedAsset:Y}):G===`agents`?(0,X.jsx)(ze,{onCopy:ke,onOpenWork:Ie,project:i}):G===`backup`?(0,X.jsx)(zy,{assets:he,cli:se?.cli,onCopy:ke,onLocalReview:async(e,t)=>{await De(()=>_(`/api/local-review/${e.asset_id}`,i,{reviewState:t,confirmWrite:!0}))},onOpenBackup:()=>H(!0),onQueueBackup:Ne,onSelectAsset:e=>{Z(e)},page:S,pageSize:w,project:i,selected:Y,selectedBackupIds:R,setPage:C,setPageSize:T,snapshot:J}):G===`assets`?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Gy,{assets:_e,onClear:()=>{z([]),V([])},onOpen:()=>H(!0)}),(0,X.jsx)(Re,{assets:he,liveSync:E,onCopy:ke,onSelectionChanged:()=>K(e=>e+1),page:S,pageSize:w,previewUrls:P,project:i,selected:Y,setLiveSync:D,setPage:C,setPageSize:T,setSelectedId:r,snapshot:J,source:f,totals:be})]}):G===`settings`?(0,X.jsx)(hb,{onToast:me,project:i}):(0,X.jsx)(jy,{asset:Y,actionsOpen:de===`lineage-actions`,onAssetsChanged:Te,onActionsOpenChange:fe,onSelectedAsset:r,onToast:me,project:i})]}),G!==`lineage`&&ne&&(0,X.jsx)(Ae,{asset:Y,onArchive:e=>void De(()=>_(`/api/assets/archive`,i,{assetId:e.asset_id,confirmArchive:!0})),onClose:()=>re(!1),onCopy:(e,t)=>void ke(e,t),onCopyPreview:e=>void je(e),onDelete:(e,t)=>void De(()=>_(`/api/assets/delete-object`,i,{assetId:e.asset_id,confirmation:t})),onPlacement:(e,t,n)=>void De(()=>_(`/api/assets/placement`,i,{assetId:e.asset_id,channel:e.channel,...v(n),status:t,confirmWrite:!0})),onPresign:e=>void Oe(e,{open:!0}),onPromote:e=>void De(()=>_(`/api/assets/promote`,i,{assetId:e.asset_id,confirmWrite:!0})),onPull:e=>void De(()=>_(`/api/assets/pull`,i,{assetId:e.asset_id,out:`.asset-scratch`})),onToggleBackup:Le,previewError:Y&&I[Y.asset_id]||null,previewUrl:ve,selectedForBackup:Y?R.includes(Y.asset_id):!1}),U&&(0,X.jsx)(Eb,{channels:ye.filter(e=>e!==`all`),project:i,onClose:()=>W(!1),onError:e=>j({type:`error`,message:e}),onUploaded:async e=>{j({type:`ok`,message:e}),W(!1),await Te()}}),ee&&(0,X.jsx)(Py,{assets:_e,project:i,onClose:()=>H(!1),onError:e=>j({type:`error`,message:e}),onDone:async e=>{j({type:`ok`,message:e}),z([]),V([]),H(!1),await Te()}})]})})}(0,m.createRoot)(document.getElementById(`root`)).render((0,X.jsx)(p.StrictMode,{children:(0,X.jsx)(kb,{})}));
50
+ ]`);function ob(e,t){let n=ab.find(n=>n.adapterType===e&&n.providerId===t);if(!n)throw Error(`Missing public adapter catalog entry: ${e}/${t}`);return n}var sb={channel:`dev`,version:`0.1.25`},cb={cloud:D,image_generator:V,scheduler:ae},lb=Object.fromEntries(ab.map(e=>[e.adapterType,e.capabilityLabel])),ub=[{adapterType:`cloud`,ariaLabel:`Cloud storage settings`},{adapterType:`scheduler`,ariaLabel:`Social scheduling settings`},{adapterType:`image_generator`,ariaLabel:`Image generation settings`}];function db(e){return typeof e==`boolean`?e?`on`:`off`:typeof e==`number`?String(e):typeof e==`string`?e||`not set`:JSON.stringify(e)}function fb(e){return Object.entries(e.safe_config).filter(([e])=>![`secret`,`token`,`password`,`credential`,`apiKey`].includes(e))}function pb(e){return e.health_status===`configured`?`ok`:e.health_status===`missing_config`?`warn`:`muted`}function mb(e){return(0,X.jsx)(`button`,{"aria-checked":e.checked,"aria-label":e.label,className:`settings-switch ${e.checked?`on`:``}`,disabled:e.disabled,onClick:e.onClick,role:`switch`,type:`button`,children:(0,X.jsx)(`span`,{})})}function hb(e){let[t,n]=(0,p.useState)(null),[r,i]=(0,p.useState)(null),[a,s]=(0,p.useState)(!0),[c,l]=(0,p.useState)(``),[u,d]=(0,p.useState)(Cm);function f(){let t=!u;if(!wm(t)){e.onToast(`error`,`Browser storage is unavailable, so the hover preview preference could not be saved`);return}d(t),e.onToast(`ok`,`Lineage hover previews ${t?`enabled`:`disabled`}`)}async function m(){s(!0);try{let[t,r]=await Promise.all([g(`/api/adapters/settings?project=${encodeURIComponent(e.project)}`),g(`/api/runtime`)]);n(t),i(r.runtime)}catch(t){e.onToast(`error`,t instanceof Error?t.message:String(t))}finally{s(!1)}}async function h(t){let r=`${t.adapter_type}:${t.provider}`;l(r);try{let r=await g(`/api/adapters/settings/${t.adapter_type}/${t.provider}`,{body:JSON.stringify({confirmWrite:!0,enabled:!t.enabled,project:e.project,safeConfig:t.safe_config}),headers:{"Content-Type":`application/json`},method:`POST`});n(e=>e&&{...e,settings:e.settings.map(e=>e.adapter_type===r.setting.adapter_type&&e.provider===r.setting.provider?r.setting:e)}),e.onToast(`ok`,`${lb[t.adapter_type]} ${r.setting.enabled?`enabled`:`disabled`}`)}catch(t){e.onToast(`error`,t instanceof Error?t.message:String(t))}finally{l(``)}}return(0,p.useEffect)(()=>{m()},[e.project]),(0,X.jsxs)(`section`,{className:`settings-view`,children:[(0,X.jsxs)(`header`,{className:`settings-header`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h2`,{children:`Settings`}),(0,X.jsxs)(`p`,{children:[`Adapter switches, safe local preferences, and credential-source status for `,e.project,`.`]})]}),(0,X.jsxs)(`button`,{className:`secondary-button`,disabled:a,onClick:()=>void m(),type:`button`,children:[a?(0,X.jsx)(W,{className:`spin`,size:17}):(0,X.jsx)(o,{size:17}),`Refresh`]})]}),(0,X.jsxs)(`div`,{className:`settings-sections`,children:[(0,X.jsxs)(`section`,{"aria-label":`Release information`,className:`settings-section`,children:[(0,X.jsx)(`h3`,{children:`Release`}),(0,X.jsxs)(`dl`,{className:`settings-release`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:`Version`}),(0,X.jsx)(`dd`,{children:r?.version||sb.version})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:`Channel`}),(0,X.jsx)(`dd`,{children:r?.channel||sb.channel})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:`Profile`}),(0,X.jsx)(`dd`,{children:r?.profile.id||`loading`})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:`Environment`}),(0,X.jsx)(`dd`,{children:r?.profile.environment||`loading`})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:`Binding`}),(0,X.jsx)(`dd`,{children:r?r.profile.bound?`bound`:`legacy unbound`:`loading`})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:`Git`}),(0,X.jsx)(`dd`,{children:r?.git_sha||`not available`})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:`Assets`}),(0,X.jsx)(`dd`,{className:`settings-path`,children:r?.asset_root||`loading`})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:`SQLite`}),(0,X.jsx)(`dd`,{className:`settings-path`,children:r?.database.path||`loading`})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:`Database`}),(0,X.jsx)(`dd`,{children:r?.database.exists?`${r.database.projects??0} projects / ${r.database.workspaces??0} workspaces`:`not created yet`})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:`Schema`}),(0,X.jsx)(`dd`,{children:r?`${r.schema.migration_keys.length} migration marker(s)`:`loading`})]})]})]}),(0,X.jsxs)(`section`,{"aria-label":`Lineage experience settings`,className:`settings-section`,children:[(0,X.jsx)(`h3`,{children:`Lineage experience`}),(0,X.jsx)(`div`,{className:`settings-grid`,children:(0,X.jsx)(`article`,{className:`settings-card`,children:(0,X.jsxs)(`div`,{className:`settings-card-head`,children:[(0,X.jsx)(`span`,{className:`settings-icon`,children:(0,X.jsx)(N,{size:19})}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h4`,{children:`Hover previews`}),(0,X.jsx)(`p`,{children:`Show the full asset and quick Branch/Re-roll/Details actions when hovering over or focusing a lineage node. Double-click details remain available when this is off.`})]}),(0,X.jsx)(mb,{checked:u,label:`Enable lineage hover previews`,onClick:f})]})})})]}),ub.map(e=>(0,X.jsxs)(`section`,{"aria-label":e.ariaLabel,className:`settings-section`,children:[(0,X.jsx)(`h3`,{children:lb[e.adapterType]}),(0,X.jsx)(`div`,{className:`settings-grid`,children:(t?.settings||[]).filter(t=>t.adapter_type===e.adapterType).map(e=>{let t=cb[e.adapter_type],n=ob(e.adapter_type,e.provider),r=`Enable ${e.label===`Buffer`?`Buffer scheduling`:e.label}`,i=c===`${e.adapter_type}:${e.provider}`;return(0,X.jsxs)(`article`,{className:`settings-card`,children:[(0,X.jsxs)(`div`,{className:`settings-card-head`,children:[(0,X.jsx)(`span`,{className:`settings-icon`,children:(0,X.jsx)(t,{size:19})}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h4`,{children:e.label}),(0,X.jsx)(`p`,{children:e.description})]}),(0,X.jsx)(mb,{checked:e.enabled,disabled:i,label:r,onClick:()=>void h(e)})]}),(0,X.jsxs)(`dl`,{className:`settings-meta`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:`Status`}),(0,X.jsxs)(`dd`,{className:pb(e),children:[e.health_status===`configured`?(0,X.jsx)(w,{size:14}):(0,X.jsx)(C,{size:14}),e.health_status.replace(/_/g,` `)]})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:`Maturity`}),(0,X.jsx)(`dd`,{children:n.maturity})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:`Credential source`}),(0,X.jsx)(`dd`,{children:e.credential.label})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:`Secret ref`}),(0,X.jsx)(`dd`,{children:e.credential.secret_ref||`none`})]})]}),fb(e).length>0&&(0,X.jsx)(`div`,{className:`settings-config`,children:fb(e).map(([e,t])=>(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`strong`,{children:e}),db(t)]},e))})]},`${e.adapter_type}:${e.provider}`)})})]},e.adapterType)),a&&!t&&(0,X.jsx)(`div`,{className:`settings-loading`,children:`Loading settings...`})]})]})}var gb=`Lineage`,_b=`Local-first creative lineage workspace`;function vb(e){let{channel:t,channels:n,placementStatus:r,project:i,projects:a,setChannel:o,setPlacementStatus:s,setProject:c,setSource:l,setStatus:u,source:d,status:f}=e,[m,h]=(0,p.useState)(!1),[g,_]=(0,p.useState)(!0),v=a.length?a.map(e=>e.project):[i];return(0,X.jsxs)(`aside`,{className:`sidebar ${g?``:`collapsed`}`,children:[(0,X.jsx)(`button`,{"aria-label":g?`Collapse sidebar`:`Expand sidebar`,className:`sidebar-collapse-toggle`,onClick:()=>_(e=>!e),type:`button`,children:g?(0,X.jsx)(te,{size:16}):(0,X.jsx)(ne,{size:16})}),(0,X.jsxs)(`div`,{className:`brand`,children:[(0,X.jsx)(`div`,{className:`brand-mark`,"aria-label":_b,children:`L`}),(0,X.jsxs)(`div`,{className:`brand-copy`,children:[(0,X.jsx)(`h1`,{children:gb}),(0,X.jsxs)(`p`,{children:[(0,X.jsx)(`span`,{children:i}),(0,X.jsxs)(`span`,{"aria-label":`Lineage version ${sb.version}`,className:`brand-version`,title:`Lineage version ${sb.version}, ${sb.channel} channel`,children:[`v`,sb.version]})]})]})]}),(0,X.jsxs)(`button`,{"aria-controls":`mobile-sidebar-controls`,"aria-expanded":m,className:`mobile-filter-toggle`,onClick:()=>h(e=>!e),type:`button`,children:[(0,X.jsx)(K,{size:16}),`Filters`,(0,X.jsx)(S,{className:m?`open`:``,size:16})]}),(0,X.jsxs)(`div`,{className:`sidebar-mobile-collapse`,"data-open":m,id:`mobile-sidebar-controls`,children:[(0,X.jsxs)(`div`,{className:`side-section`,children:[(0,X.jsx)(`h2`,{children:`Project`}),(0,X.jsx)(yb,{id:`asset-project-filter`,label:`Project`,value:i,values:v,onChange:c})]}),(0,X.jsxs)(`section`,{className:`side-section`,children:[(0,X.jsx)(`h2`,{children:`Filters`}),(0,X.jsx)(yb,{id:`asset-source-filter`,label:`Source`,value:d,values:Y,onChange:e=>l(e)}),(0,X.jsx)(yb,{id:`asset-status-filter`,label:`Status`,value:f,values:J,onChange:e=>u(e)}),(0,X.jsx)(yb,{id:`asset-channel-filter`,label:`Channel`,value:t,values:n,onChange:o}),(0,X.jsx)(yb,{id:`asset-placement-filter`,label:`Placement`,value:r,values:he,onChange:e=>s(e)})]})]})]})}function yb({id:e,label:t,value:n,values:r,onChange:i}){return(0,X.jsxs)(`label`,{htmlFor:e,children:[t,(0,X.jsx)(`select`,{"aria-label":t,id:e,value:n,onChange:e=>i(e.target.value),children:r.map(e=>(0,X.jsx)(`option`,{value:e,children:e},e))})]})}var bb=[{label:`Lineage`,view:`lineage`},{label:`Review`,view:`review`},{label:`Assets`,view:`assets`},{label:`Agents`,view:`agents`},{label:`Settings`,view:`settings`}],xb=[{label:`Ledger`,view:`ledger`},{label:`Content batches`,view:`content`},{label:`Backup queue`,view:`backup`}];function Sb(e){let t=xb.some(t=>t.view===e.view);function n(t){e.setView(t),e.onMoreOpenChange(!1)}function r(t){e.setView(t),e.onMoreOpenChange(!1)}return(0,X.jsxs)(`header`,{className:`topbar`,children:[(0,X.jsxs)(`div`,{className:`view-tabs`,role:`tablist`,"aria-label":`${gb} views`,children:[bb.map(t=>(0,X.jsx)(`button`,{"aria-pressed":e.view===t.view,className:e.view===t.view?`active`:``,onClick:()=>n(t.view),type:`button`,children:t.label},t.view)),(0,X.jsxs)(`div`,{className:`more-menu`,children:[(0,X.jsxs)(`button`,{"aria-expanded":e.moreOpen,"aria-haspopup":`menu`,"aria-pressed":t,className:t?`active`:``,onClick:()=>e.onMoreOpenChange(!e.moreOpen),type:`button`,children:[(0,X.jsx)(j,{size:16}),` More `,(0,X.jsx)(S,{className:e.moreOpen?`open`:``,size:15})]}),e.moreOpen&&(0,X.jsx)(`div`,{className:`more-menu-popover`,role:`menu`,children:xb.map(t=>(0,X.jsx)(`button`,{"aria-pressed":e.view===t.view,onClick:()=>r(t.view),role:`menuitem`,type:`button`,children:t.label},t.view))})]})]}),(0,X.jsx)(Cb,{runtime:e.runtime,unavailable:e.runtimeIdentityUnavailable}),(0,X.jsxs)(`div`,{className:`searchbox`,children:[(0,X.jsx)(ie,{size:17}),(0,X.jsx)(`input`,{onChange:t=>e.setQuery(t.target.value),placeholder:`Search assets, campaigns, hooks`,value:e.query})]}),e.view!==`lineage`&&(0,X.jsxs)(`button`,{"aria-expanded":e.assetDetailsOpen,className:`secondary-button`,disabled:!e.canInspectAsset,onClick:()=>{e.onMoreOpenChange(!1),e.setAssetDetailsOpen(!e.assetDetailsOpen)},type:`button`,children:[(0,X.jsx)(I,{size:17}),`Details`]}),(0,X.jsx)(`button`,{className:`icon-button`,disabled:e.loading,onClick:()=>void e.refresh(),title:`Refresh current page`,children:e.loading?(0,X.jsx)(W,{className:`spin`,size:18}):(0,X.jsx)(o,{size:18})}),(0,X.jsxs)(`button`,{className:`primary-button`,onClick:()=>e.setUploadOpen(!0),children:[(0,X.jsx)(ue,{size:17}),`Upload`]})]})}function Cb(e){if(e.unavailable)return(0,X.jsx)(`div`,{"aria-label":`Lineage runtime identity unavailable`,className:`runtime-identity-badge unavailable`,children:`IDENTITY UNAVAILABLE`});if(!e.runtime)return(0,X.jsx)(`div`,{"aria-label":`Loading Lineage runtime identity`,className:`runtime-identity-badge loading`,children:`IDENTITY LOADING`});let{profile:t}=e.runtime,n=t.bound?``:` · UNBOUND`,r=[`${t.environment.toUpperCase()} profile ${t.id}${t.bound?``:` (unbound)`}`,`Channel ${e.runtime.channel}`,`Version ${e.runtime.version}`,t.warning].filter(Boolean).join(` · `);return(0,X.jsxs)(`div`,{"aria-label":`Lineage ${t.environment} profile ${t.id}${t.bound?``:` unbound`}`,className:`runtime-identity-badge ${t.environment} ${t.bound?`bound`:`unbound`}`,"data-profile-id":t.id,title:r,children:[(0,X.jsx)(`strong`,{children:t.environment.toUpperCase()}),(0,X.jsxs)(`span`,{children:[t.id,n]})]})}function wb({toast:e,onDismiss:t}){return(0,X.jsxs)(`div`,{className:`toast ${e.type}`,role:`status`,children:[e.type===`ok`?(0,X.jsx)(w,{size:16}):(0,X.jsx)(oe,{size:16}),(0,X.jsx)(`span`,{children:e.message}),(0,X.jsx)(`button`,{onClick:t,children:`Dismiss`})]})}var Tb=200*1024*1024;function Eb({channels:e,project:t,onClose:n,onUploaded:r,onError:i}){let[a,o]=(0,p.useState)({assetId:``,audience:`short-form-creators`,campaign:`2026-06-organic-traffic-test`,channel:e[0]||`meta`,cta:``,hook:``,status:`working`,title:``,type:`image`,utmContent:``}),[s,c]=(0,p.useState)(null),[l,u]=(0,p.useState)(!1),[d,f]=(0,p.useState)(!1);function m(e,t){o(n=>({...n,[e]:t}))}function h(e){o(t=>({...t,assetId:t.assetId||pe(`demo-${t.channel}-${e}`),title:e,utmContent:t.utmContent||pe(e).replaceAll(`-`,`_`)}))}function _(e){if(!e){c(null);return}if(e.size>Tb){i(`File is larger than ${q(Tb)}`);return}c(e)}async function v(e){if(e.preventDefault(),!s)return i(`Choose a file before uploading`);f(!0);try{let e=new FormData;Object.entries({project:t,...a,confirmWrite:String(l)}).forEach(([t,n])=>e.append(t,n)),e.append(`file`,s),await r((await g(`/api/assets/upload`,{method:`POST`,body:e})).message)}catch(e){i(e instanceof Error?e.message:String(e))}finally{f(!1)}}return(0,X.jsx)(`div`,{className:`drawer-backdrop`,children:(0,X.jsxs)(`form`,{className:`upload-drawer`,onSubmit:v,children:[(0,X.jsxs)(`header`,{children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h2`,{children:`Upload asset`}),(0,X.jsx)(`p`,{children:t})]}),(0,X.jsx)(`button`,{type:`button`,onClick:n,children:`Close`})]}),(0,X.jsxs)(`label`,{className:`file-drop`,children:[(0,X.jsx)(ue,{size:20}),(0,X.jsx)(`span`,{children:s?s.name:`Choose creative export up to ${q(Tb)}`}),(0,X.jsx)(`input`,{type:`file`,onChange:e=>_(e.target.files?.[0])})]}),(0,X.jsxs)(`div`,{className:`form-grid`,children:[(0,X.jsxs)(`label`,{children:[`Title`,(0,X.jsx)(`input`,{value:a.title,onChange:e=>h(e.target.value),required:!0})]}),(0,X.jsxs)(`label`,{children:[`Asset ID`,(0,X.jsx)(`input`,{value:a.assetId,onChange:e=>m(`assetId`,e.target.value),required:!0})]}),(0,X.jsxs)(`label`,{children:[`Campaign`,(0,X.jsx)(`input`,{value:a.campaign,onChange:e=>m(`campaign`,e.target.value),required:!0})]}),(0,X.jsxs)(`label`,{children:[`Channel`,(0,X.jsx)(`select`,{value:a.channel,onChange:e=>m(`channel`,e.target.value),children:e.map(e=>(0,X.jsx)(`option`,{children:e},e))})]}),(0,X.jsxs)(`label`,{children:[`Audience`,(0,X.jsx)(`input`,{value:a.audience,onChange:e=>m(`audience`,e.target.value),required:!0})]}),(0,X.jsxs)(`label`,{children:[`Status`,(0,X.jsxs)(`select`,{value:a.status,onChange:e=>m(`status`,e.target.value),children:[(0,X.jsx)(`option`,{children:`working`}),(0,X.jsx)(`option`,{children:`published`})]})]}),(0,X.jsxs)(`label`,{children:[`Type`,(0,X.jsx)(`select`,{value:a.type,onChange:e=>m(`type`,e.target.value),children:ge.map(e=>(0,X.jsx)(`option`,{children:e},e))})]}),(0,X.jsxs)(`label`,{children:[`UTM content`,(0,X.jsx)(`input`,{value:a.utmContent,onChange:e=>m(`utmContent`,e.target.value),required:!0})]}),(0,X.jsxs)(`label`,{className:`wide`,children:[`Hook`,(0,X.jsx)(`input`,{value:a.hook,onChange:e=>m(`hook`,e.target.value)})]}),(0,X.jsxs)(`label`,{className:`wide`,children:[`CTA`,(0,X.jsx)(`input`,{value:a.cta,onChange:e=>m(`cta`,e.target.value),required:!0})]})]}),(0,X.jsxs)(`label`,{className:`confirm-line`,children:[(0,X.jsx)(`input`,{type:`checkbox`,checked:l,onChange:e=>u(e.target.checked)}),(0,X.jsx)(`span`,{children:`Confirm write to the production asset bucket`})]}),(0,X.jsxs)(`footer`,{children:[(0,X.jsx)(`button`,{type:`button`,onClick:n,children:`Cancel`}),(0,X.jsxs)(`button`,{className:`primary-button`,disabled:d||!l,children:[d?(0,X.jsx)(W,{className:`spin`,size:16}):(0,X.jsx)(ue,{size:16}),`Upload`]})]})]})})}function Db(e,t){let n=`${e} ${t}`.toLowerCase();return n.includes(`agent`)||n.includes(`command`)||n.includes(`selection`)||n.includes(`next context`)}function Ob(){return typeof window>`u`?me:new URLSearchParams(window.location.search).get(`project`)||`demo-project`}function kb(){let[e,t]=(0,p.useState)(null),[n,r]=(0,p.useState)(null),[i,a]=(0,p.useState)(Ob),[o,s]=(0,p.useState)([]),[c,l]=(0,p.useState)(`all`),[u,d]=(0,p.useState)(`all`),[f,m]=(0,p.useState)(`local`),[h,y]=(0,p.useState)(`all`),[b,x]=(0,p.useState)(``),[S,C]=(0,p.useState)(1),[w,T]=(0,p.useState)(10),[E,D]=(0,p.useState)(!1),[O,k]=(0,p.useState)(!0),[A,j]=(0,p.useState)(null),[M,N]=(0,p.useState)(null),[P,F]=(0,p.useState)({}),[I,L]=(0,p.useState)({}),[R,z]=(0,p.useState)([]),[B,V]=(0,p.useState)([]),[ee,H]=(0,p.useState)(!1),[U,W]=(0,p.useState)(!1),[G,te]=(0,p.useState)(`lineage`),[ne,re]=(0,p.useState)(!1),[ie,ae]=(0,p.useState)(null),[oe,K]=(0,p.useState)(0),[se,ce]=(0,p.useState)(null),[le,ue]=(0,p.useState)(!1),[de,q]=(0,p.useState)(null),fe=(0,p.useCallback)(e=>{q(t=>e?`lineage-actions`:t===`lineage-actions`?null:t)},[]),pe=(0,p.useCallback)(e=>{q(t=>e?`topbar-more`:t===`topbar-more`?null:t)},[]),me=(0,p.useCallback)((e,t)=>{j({type:e,message:t})},[]),J=e?.catalog.project===i?e:null,he=J?.assets||[],Y=xe(he,n)||(ie?.project===i&&ie.asset_id===n?ie:void 0),ge=Y?.asset_id||``,_e=[...B.filter(e=>R.includes(e.asset_id)),...he.filter(e=>R.includes(e.asset_id)&&e.local?.relative_path)].filter((e,t,n)=>n.findIndex(t=>t.asset_id===e.asset_id)===t),ve=Y&&P[Y.asset_id]||null,ye=(0,p.useMemo)(()=>[`all`,...J?.facets.channels||[]],[J]),be=(0,p.useMemo)(()=>({assets:J?.catalog.asset_count||0,live:J?.liveObjects.length||0,orphan:J?.orphanObjects.length||0,size:J?.facets.totalSizeBytes||0}),[J]);async function Ce(){try{let e=await g(`/api/projects`);s(e.projects),a(t=>e.projects.some(e=>e.project===t)?t:e.projects[0]?.project||`demo-project`)}catch(e){j({type:`error`,message:e instanceof Error?e.message:String(e)})}}async function we(){try{let e=await g(`/api/runtime`);ce(e.runtime),ue(!1)}catch{ce(null),ue(!0)}}async function Te(){k(!0);try{let e=await g(`/api/assets?${Ee()}`);t(e),r(t=>xe(e.assets,t)?.asset_id||(t&&ie?.asset_id===t?t:null)),F({}),L({})}catch(e){j({type:`error`,message:e instanceof Error?e.message:String(e)})}finally{k(!1)}}function Ee(){let e=new URLSearchParams({project:i,page:String(S),pageSize:String(w),live:String(E),source:f});return c!==`all`&&e.set(`status`,c),u!==`all`&&e.set(`placementStatus`,u),h!==`all`&&e.set(`channel`,h),b.trim()&&e.set(`q`,b.trim()),e.toString()}async function De(e){try{let t=await e();j({type:`ok`,message:t.message}),F({}),await Te()}catch(e){j({type:`error`,message:e instanceof Error?e.message:String(e)})}}async function Oe(e,t={}){if(!Se(e))return null;let n=P[e.asset_id];if(n)return t.open&&window.open(n,`_blank`,`noopener,noreferrer`),n;if(e.local?.relative_path){let n=`/api/assets/local-preview?${new URLSearchParams({project:i,path:e.local.relative_path}).toString()}`;return F(t=>({...t,[e.asset_id]:n})),L(t=>({...t,[e.asset_id]:``})),t.open&&window.open(n,`_blank`,`noopener,noreferrer`),n}try{let n=await g(`/api/assets/presign`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({project:i,assetId:e.asset_id,expiresIn:900})});return F(t=>({...t,[e.asset_id]:n.url})),L(t=>({...t,[e.asset_id]:``})),t.open&&window.open(n.url,`_blank`,`noopener,noreferrer`),n.url}catch(n){let r=n instanceof Error?n.message:String(n);return L(t=>({...t,[e.asset_id]:r})),t.quiet||j({type:`error`,message:`Preview unavailable. Check S3 credentials or pull the asset locally.`}),null}}async function ke(e,t){try{let n=await Bm(e);j({type:`ok`,message:n.method===`fallback`?`Copied ${t} using browser fallback`:`Copied ${t}`}),N(Db(t,e)?{label:t,text:e}:null)}catch(n){N(Db(t,e)?{label:t,text:e}:null),j({type:`error`,message:n instanceof Error?n.message:String(n)})}}async function je(e){let t=await Oe(e,{quiet:!0});t&&await ke(t,`preview link`)}function Ne(e){e.local?.relative_path&&(z(t=>t.includes(e.asset_id)?t:[...t,e.asset_id]),V(t=>t.some(t=>t.asset_id===e.asset_id)?t:[...t,e]))}function Z(e){ae(e),r(e.asset_id),re(!0)}async function Pe(e){r(e),re(!0);let t=he.find(t=>t.asset_id===e);if(t){ae(t);return}try{let t=await g(`/api/assets/lookup`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({project:i,assetIds:[e]})});t.assets[0]&&ae(t.assets[0])}catch(e){j({type:`error`,message:e instanceof Error?e.message:String(e)})}}function Fe(){m(`local`),l(`all`),d(`all`),x(``),te(`backup`)}async function Ie(e){try{e.assetId&&r(e.assetId),e.view===`lineage`&&e.workspaceId&&await g(`/api/lineage-workspaces/${encodeURIComponent(e.workspaceId)}/activate`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({project:i,confirmWrite:!0})}),re(!1),te(e.view),j({type:`ok`,message:`Opened ${e.claim.target_title||e.claim.target_id}`})}catch(e){j({type:`error`,message:e instanceof Error?e.message:String(e)})}}function Le(e){e.local?.relative_path&&(z(t=>t.includes(e.asset_id)?t.filter(t=>t!==e.asset_id):[...t,e.asset_id]),V(t=>t.filter(t=>t.asset_id!==e.asset_id)))}return(0,p.useEffect)(()=>{Ce(),we()},[]),(0,p.useEffect)(()=>{let e=new URLSearchParams(window.location.search);e.get(`project`)!==i&&(e.set(`project`,i),window.history.replaceState(null,``,`${window.location.pathname}?${e.toString()}${window.location.hash}`))},[i]),(0,p.useEffect)(()=>{j(null),N(null),ae(null),re(!1)},[i]),(0,p.useEffect)(()=>{Te()},[S,w,i,c,u,f,h,b,E]),(0,p.useEffect)(()=>{C(1)},[i,c,u,f,h,b,w]),(0,p.useEffect)(()=>{!Se(Y)||P[Y.asset_id]||Oe(Y,{quiet:!0})},[Y?.asset_id,Y?.s3?.version_id,P]),(0,p.useEffect)(()=>{if(A?.type!==`ok`)return;let e=window.setTimeout(()=>j(null),2600);return()=>window.clearTimeout(e)},[A?.message,A?.type]),(0,p.useEffect)(()=>{G===`backup`&&(m(`local`),l(`all`),d(`all`))},[G]),(0,p.useEffect)(()=>{q(null)},[G]),(0,p.useEffect)(()=>{ge||re(!1)},[ge]),(0,X.jsx)(Me,{runtime:se,children:(0,X.jsxs)(`div`,{className:`app-shell ${G===`lineage`?`lineage-mode`:``}`,children:[(0,X.jsx)(vb,{channel:h,channels:ye,liveSync:E,placementStatus:u,project:i,projects:o,setChannel:y,setPlacementStatus:d,setProject:a,setSource:m,setStatus:l,setView:te,showBackupQueue:Fe,source:f,snapshot:J,status:c,totals:be}),(0,X.jsxs)(`main`,{className:`workspace`,children:[(0,X.jsx)(Sb,{assetDetailsOpen:ne,canInspectAsset:!!Y,loading:O,moreOpen:de===`topbar-more`,onMoreOpenChange:pe,query:b,refresh:Te,runtime:se,runtimeIdentityUnavailable:le,setAssetDetailsOpen:re,setQuery:x,setUploadOpen:W,setView:e=>e===`backup`?Fe():te(e),view:G}),A&&(0,X.jsx)(wb,{toast:A,onDismiss:()=>j(null)}),M&&(0,X.jsx)(Ct,{copiedText:M,onDismiss:()=>N(null)}),(0,X.jsx)(Ot,{onCopy:ke,project:i,refreshKey:oe,selectedAsset:Y,view:G}),G===`review`?(0,X.jsx)(Yy,{channel:h,onCopy:ke,onLocalReview:async(e,t)=>{await De(()=>_(`/api/local-review/${e.asset_id}`,i,{reviewState:t,confirmWrite:!0}))},onOpenBackup:e=>{Ne(e),H(!0)},onSelectAsset:e=>{Z(e)},project:i,selected:Y}):G===`ledger`?(0,X.jsx)(Vt,{project:i,query:b,onOpenAsset:Pe}):G===`content`?(0,X.jsx)(_t,{onCopy:ke,onOpenAsset:Pe,onToast:me,onWorkTargetsChanged:()=>K(e=>e+1),project:i,selectedAsset:Y}):G===`agents`?(0,X.jsx)(ze,{onCopy:ke,onOpenWork:Ie,project:i}):G===`backup`?(0,X.jsx)(zy,{assets:he,cli:se?.cli,onCopy:ke,onLocalReview:async(e,t)=>{await De(()=>_(`/api/local-review/${e.asset_id}`,i,{reviewState:t,confirmWrite:!0}))},onOpenBackup:()=>H(!0),onQueueBackup:Ne,onSelectAsset:e=>{Z(e)},page:S,pageSize:w,project:i,selected:Y,selectedBackupIds:R,setPage:C,setPageSize:T,snapshot:J}):G===`assets`?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Gy,{assets:_e,onClear:()=>{z([]),V([])},onOpen:()=>H(!0)}),(0,X.jsx)(Re,{assets:he,liveSync:E,onCopy:ke,onSelectionChanged:()=>K(e=>e+1),page:S,pageSize:w,previewUrls:P,project:i,selected:Y,setLiveSync:D,setPage:C,setPageSize:T,setSelectedId:r,snapshot:J,source:f,totals:be})]}):G===`settings`?(0,X.jsx)(hb,{onToast:me,project:i}):(0,X.jsx)(jy,{asset:Y,actionsOpen:de===`lineage-actions`,onAssetsChanged:Te,onActionsOpenChange:fe,onSelectedAsset:r,onToast:me,project:i})]}),G!==`lineage`&&ne&&(0,X.jsx)(Ae,{asset:Y,onArchive:e=>void De(()=>_(`/api/assets/archive`,i,{assetId:e.asset_id,confirmArchive:!0})),onClose:()=>re(!1),onCopy:(e,t)=>void ke(e,t),onCopyPreview:e=>void je(e),onDelete:(e,t)=>void De(()=>_(`/api/assets/delete-object`,i,{assetId:e.asset_id,confirmation:t})),onPlacement:(e,t,n)=>void De(()=>_(`/api/assets/placement`,i,{assetId:e.asset_id,channel:e.channel,...v(n),status:t,confirmWrite:!0})),onPresign:e=>void Oe(e,{open:!0}),onPromote:e=>void De(()=>_(`/api/assets/promote`,i,{assetId:e.asset_id,confirmWrite:!0})),onPull:e=>void De(()=>_(`/api/assets/pull`,i,{assetId:e.asset_id,out:`.asset-scratch`})),onToggleBackup:Le,previewError:Y&&I[Y.asset_id]||null,previewUrl:ve,selectedForBackup:Y?R.includes(Y.asset_id):!1}),U&&(0,X.jsx)(Eb,{channels:ye.filter(e=>e!==`all`),project:i,onClose:()=>W(!1),onError:e=>j({type:`error`,message:e}),onUploaded:async e=>{j({type:`ok`,message:e}),W(!1),await Te()}}),ee&&(0,X.jsx)(Py,{assets:_e,project:i,onClose:()=>H(!1),onError:e=>j({type:`error`,message:e}),onDone:async e=>{j({type:`ok`,message:e}),z([]),V([]),H(!1),await Te()}})]})})}(0,m.createRoot)(document.getElementById(`root`)).render((0,X.jsx)(p.StrictMode,{children:(0,X.jsx)(kb,{})}));
@@ -1,9 +1,9 @@
1
1
  {
2
- "build_fingerprint": "1de9a20d920379b657767e159916911a4e232357924c1ce80fff291f73de9c46",
2
+ "build_fingerprint": "f0ad90701d940e25b526628fe4dd8fdfb43f8e7ce4b2b9dc0592dcf5cd86e89f",
3
3
  "package_name": "@mean-weasel/lineage",
4
- "package_version": "0.1.24",
4
+ "package_version": "0.1.25",
5
5
  "schema_version": "lineage.runtime_build.v1",
6
- "source_dirty": true,
7
- "source_fingerprint": "bc512d2d50f082c272f6dda86a69aae05b6175f31344163206be59752a52cc2d",
8
- "source_git_sha": "d6299071a5a3d71b0c0c3c9ee28b6955ef1a7c7c"
6
+ "source_dirty": false,
7
+ "source_fingerprint": "4933a0fd9bc636d218f5fee827528c768636d0562fbf048ca7bba069598d218c",
8
+ "source_git_sha": "97033deeb3708cbe360a2ebd0fe74360cfe1b688"
9
9
  }
@@ -47,4 +47,4 @@ import{a as e,c as t,d as n,f as r,i,l as a,n as o,o as s,p as c,r as l,s as u,t
47
47
  "providerId": "codex-handoff",
48
48
  "providerLabel": "Codex handoff"
49
49
  }
50
- ]`);function ob(e,t){let n=ab.find(n=>n.adapterType===e&&n.providerId===t);if(!n)throw Error(`Missing public adapter catalog entry: ${e}/${t}`);return n}var sb={channel:`dev`,version:`0.1.24`},cb={cloud:D,image_generator:V,scheduler:ae},lb=Object.fromEntries(ab.map(e=>[e.adapterType,e.capabilityLabel])),ub=[{adapterType:`cloud`,ariaLabel:`Cloud storage settings`},{adapterType:`scheduler`,ariaLabel:`Social scheduling settings`},{adapterType:`image_generator`,ariaLabel:`Image generation settings`}];function db(e){return typeof e==`boolean`?e?`on`:`off`:typeof e==`number`?String(e):typeof e==`string`?e||`not set`:JSON.stringify(e)}function fb(e){return Object.entries(e.safe_config).filter(([e])=>![`secret`,`token`,`password`,`credential`,`apiKey`].includes(e))}function pb(e){return e.health_status===`configured`?`ok`:e.health_status===`missing_config`?`warn`:`muted`}function mb(e){return(0,X.jsx)(`button`,{"aria-checked":e.checked,"aria-label":e.label,className:`settings-switch ${e.checked?`on`:``}`,disabled:e.disabled,onClick:e.onClick,role:`switch`,type:`button`,children:(0,X.jsx)(`span`,{})})}function hb(e){let[t,n]=(0,p.useState)(null),[r,i]=(0,p.useState)(null),[a,s]=(0,p.useState)(!0),[c,l]=(0,p.useState)(``),[u,d]=(0,p.useState)(Cm);function f(){let t=!u;if(!wm(t)){e.onToast(`error`,`Browser storage is unavailable, so the hover preview preference could not be saved`);return}d(t),e.onToast(`ok`,`Lineage hover previews ${t?`enabled`:`disabled`}`)}async function m(){s(!0);try{let[t,r]=await Promise.all([g(`/api/adapters/settings?project=${encodeURIComponent(e.project)}`),g(`/api/runtime`)]);n(t),i(r.runtime)}catch(t){e.onToast(`error`,t instanceof Error?t.message:String(t))}finally{s(!1)}}async function h(t){let r=`${t.adapter_type}:${t.provider}`;l(r);try{let r=await g(`/api/adapters/settings/${t.adapter_type}/${t.provider}`,{body:JSON.stringify({confirmWrite:!0,enabled:!t.enabled,project:e.project,safeConfig:t.safe_config}),headers:{"Content-Type":`application/json`},method:`POST`});n(e=>e&&{...e,settings:e.settings.map(e=>e.adapter_type===r.setting.adapter_type&&e.provider===r.setting.provider?r.setting:e)}),e.onToast(`ok`,`${lb[t.adapter_type]} ${r.setting.enabled?`enabled`:`disabled`}`)}catch(t){e.onToast(`error`,t instanceof Error?t.message:String(t))}finally{l(``)}}return(0,p.useEffect)(()=>{m()},[e.project]),(0,X.jsxs)(`section`,{className:`settings-view`,children:[(0,X.jsxs)(`header`,{className:`settings-header`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h2`,{children:`Settings`}),(0,X.jsxs)(`p`,{children:[`Adapter switches, safe local preferences, and credential-source status for `,e.project,`.`]})]}),(0,X.jsxs)(`button`,{className:`secondary-button`,disabled:a,onClick:()=>void m(),type:`button`,children:[a?(0,X.jsx)(W,{className:`spin`,size:17}):(0,X.jsx)(o,{size:17}),`Refresh`]})]}),(0,X.jsxs)(`div`,{className:`settings-sections`,children:[(0,X.jsxs)(`section`,{"aria-label":`Release information`,className:`settings-section`,children:[(0,X.jsx)(`h3`,{children:`Release`}),(0,X.jsxs)(`dl`,{className:`settings-release`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:`Version`}),(0,X.jsx)(`dd`,{children:r?.version||sb.version})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:`Channel`}),(0,X.jsx)(`dd`,{children:r?.channel||sb.channel})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:`Profile`}),(0,X.jsx)(`dd`,{children:r?.profile.id||`loading`})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:`Environment`}),(0,X.jsx)(`dd`,{children:r?.profile.environment||`loading`})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:`Binding`}),(0,X.jsx)(`dd`,{children:r?r.profile.bound?`bound`:`legacy unbound`:`loading`})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:`Git`}),(0,X.jsx)(`dd`,{children:r?.git_sha||`not available`})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:`Assets`}),(0,X.jsx)(`dd`,{className:`settings-path`,children:r?.asset_root||`loading`})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:`SQLite`}),(0,X.jsx)(`dd`,{className:`settings-path`,children:r?.database.path||`loading`})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:`Database`}),(0,X.jsx)(`dd`,{children:r?.database.exists?`${r.database.projects??0} projects / ${r.database.workspaces??0} workspaces`:`not created yet`})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:`Schema`}),(0,X.jsx)(`dd`,{children:r?`${r.schema.migration_keys.length} migration marker(s)`:`loading`})]})]})]}),(0,X.jsxs)(`section`,{"aria-label":`Lineage experience settings`,className:`settings-section`,children:[(0,X.jsx)(`h3`,{children:`Lineage experience`}),(0,X.jsx)(`div`,{className:`settings-grid`,children:(0,X.jsx)(`article`,{className:`settings-card`,children:(0,X.jsxs)(`div`,{className:`settings-card-head`,children:[(0,X.jsx)(`span`,{className:`settings-icon`,children:(0,X.jsx)(N,{size:19})}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h4`,{children:`Hover previews`}),(0,X.jsx)(`p`,{children:`Show the full asset and quick Branch/Re-roll/Details actions when hovering over or focusing a lineage node. Double-click details remain available when this is off.`})]}),(0,X.jsx)(mb,{checked:u,label:`Enable lineage hover previews`,onClick:f})]})})})]}),ub.map(e=>(0,X.jsxs)(`section`,{"aria-label":e.ariaLabel,className:`settings-section`,children:[(0,X.jsx)(`h3`,{children:lb[e.adapterType]}),(0,X.jsx)(`div`,{className:`settings-grid`,children:(t?.settings||[]).filter(t=>t.adapter_type===e.adapterType).map(e=>{let t=cb[e.adapter_type],n=ob(e.adapter_type,e.provider),r=`Enable ${e.label===`Buffer`?`Buffer scheduling`:e.label}`,i=c===`${e.adapter_type}:${e.provider}`;return(0,X.jsxs)(`article`,{className:`settings-card`,children:[(0,X.jsxs)(`div`,{className:`settings-card-head`,children:[(0,X.jsx)(`span`,{className:`settings-icon`,children:(0,X.jsx)(t,{size:19})}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h4`,{children:e.label}),(0,X.jsx)(`p`,{children:e.description})]}),(0,X.jsx)(mb,{checked:e.enabled,disabled:i,label:r,onClick:()=>void h(e)})]}),(0,X.jsxs)(`dl`,{className:`settings-meta`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:`Status`}),(0,X.jsxs)(`dd`,{className:pb(e),children:[e.health_status===`configured`?(0,X.jsx)(w,{size:14}):(0,X.jsx)(C,{size:14}),e.health_status.replace(/_/g,` `)]})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:`Maturity`}),(0,X.jsx)(`dd`,{children:n.maturity})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:`Credential source`}),(0,X.jsx)(`dd`,{children:e.credential.label})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:`Secret ref`}),(0,X.jsx)(`dd`,{children:e.credential.secret_ref||`none`})]})]}),fb(e).length>0&&(0,X.jsx)(`div`,{className:`settings-config`,children:fb(e).map(([e,t])=>(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`strong`,{children:e}),db(t)]},e))})]},`${e.adapter_type}:${e.provider}`)})})]},e.adapterType)),a&&!t&&(0,X.jsx)(`div`,{className:`settings-loading`,children:`Loading settings...`})]})]})}var gb=`Lineage`,_b=`Local-first creative lineage workspace`;function vb(e){let{channel:t,channels:n,placementStatus:r,project:i,projects:a,setChannel:o,setPlacementStatus:s,setProject:c,setSource:l,setStatus:u,source:d,status:f}=e,[m,h]=(0,p.useState)(!1),[g,_]=(0,p.useState)(!0),v=a.length?a.map(e=>e.project):[i];return(0,X.jsxs)(`aside`,{className:`sidebar ${g?``:`collapsed`}`,children:[(0,X.jsx)(`button`,{"aria-label":g?`Collapse sidebar`:`Expand sidebar`,className:`sidebar-collapse-toggle`,onClick:()=>_(e=>!e),type:`button`,children:g?(0,X.jsx)(te,{size:16}):(0,X.jsx)(ne,{size:16})}),(0,X.jsxs)(`div`,{className:`brand`,children:[(0,X.jsx)(`div`,{className:`brand-mark`,"aria-label":_b,children:`L`}),(0,X.jsxs)(`div`,{className:`brand-copy`,children:[(0,X.jsx)(`h1`,{children:gb}),(0,X.jsxs)(`p`,{children:[(0,X.jsx)(`span`,{children:i}),(0,X.jsxs)(`span`,{"aria-label":`Lineage version ${sb.version}`,className:`brand-version`,title:`Lineage version ${sb.version}, ${sb.channel} channel`,children:[`v`,sb.version]})]})]})]}),(0,X.jsxs)(`button`,{"aria-controls":`mobile-sidebar-controls`,"aria-expanded":m,className:`mobile-filter-toggle`,onClick:()=>h(e=>!e),type:`button`,children:[(0,X.jsx)(K,{size:16}),`Filters`,(0,X.jsx)(S,{className:m?`open`:``,size:16})]}),(0,X.jsxs)(`div`,{className:`sidebar-mobile-collapse`,"data-open":m,id:`mobile-sidebar-controls`,children:[(0,X.jsxs)(`div`,{className:`side-section`,children:[(0,X.jsx)(`h2`,{children:`Project`}),(0,X.jsx)(yb,{id:`asset-project-filter`,label:`Project`,value:i,values:v,onChange:c})]}),(0,X.jsxs)(`section`,{className:`side-section`,children:[(0,X.jsx)(`h2`,{children:`Filters`}),(0,X.jsx)(yb,{id:`asset-source-filter`,label:`Source`,value:d,values:Y,onChange:e=>l(e)}),(0,X.jsx)(yb,{id:`asset-status-filter`,label:`Status`,value:f,values:J,onChange:e=>u(e)}),(0,X.jsx)(yb,{id:`asset-channel-filter`,label:`Channel`,value:t,values:n,onChange:o}),(0,X.jsx)(yb,{id:`asset-placement-filter`,label:`Placement`,value:r,values:he,onChange:e=>s(e)})]})]})]})}function yb({id:e,label:t,value:n,values:r,onChange:i}){return(0,X.jsxs)(`label`,{htmlFor:e,children:[t,(0,X.jsx)(`select`,{"aria-label":t,id:e,value:n,onChange:e=>i(e.target.value),children:r.map(e=>(0,X.jsx)(`option`,{value:e,children:e},e))})]})}var bb=[{label:`Lineage`,view:`lineage`},{label:`Review`,view:`review`},{label:`Assets`,view:`assets`},{label:`Agents`,view:`agents`},{label:`Settings`,view:`settings`}],xb=[{label:`Ledger`,view:`ledger`},{label:`Content batches`,view:`content`},{label:`Backup queue`,view:`backup`}];function Sb(e){let t=xb.some(t=>t.view===e.view);function n(t){e.setView(t),e.onMoreOpenChange(!1)}function r(t){e.setView(t),e.onMoreOpenChange(!1)}return(0,X.jsxs)(`header`,{className:`topbar`,children:[(0,X.jsxs)(`div`,{className:`view-tabs`,role:`tablist`,"aria-label":`${gb} views`,children:[bb.map(t=>(0,X.jsx)(`button`,{"aria-pressed":e.view===t.view,className:e.view===t.view?`active`:``,onClick:()=>n(t.view),type:`button`,children:t.label},t.view)),(0,X.jsxs)(`div`,{className:`more-menu`,children:[(0,X.jsxs)(`button`,{"aria-expanded":e.moreOpen,"aria-haspopup":`menu`,"aria-pressed":t,className:t?`active`:``,onClick:()=>e.onMoreOpenChange(!e.moreOpen),type:`button`,children:[(0,X.jsx)(j,{size:16}),` More `,(0,X.jsx)(S,{className:e.moreOpen?`open`:``,size:15})]}),e.moreOpen&&(0,X.jsx)(`div`,{className:`more-menu-popover`,role:`menu`,children:xb.map(t=>(0,X.jsx)(`button`,{"aria-pressed":e.view===t.view,onClick:()=>r(t.view),role:`menuitem`,type:`button`,children:t.label},t.view))})]})]}),(0,X.jsx)(Cb,{runtime:e.runtime,unavailable:e.runtimeIdentityUnavailable}),(0,X.jsxs)(`div`,{className:`searchbox`,children:[(0,X.jsx)(ie,{size:17}),(0,X.jsx)(`input`,{onChange:t=>e.setQuery(t.target.value),placeholder:`Search assets, campaigns, hooks`,value:e.query})]}),e.view!==`lineage`&&(0,X.jsxs)(`button`,{"aria-expanded":e.assetDetailsOpen,className:`secondary-button`,disabled:!e.canInspectAsset,onClick:()=>{e.onMoreOpenChange(!1),e.setAssetDetailsOpen(!e.assetDetailsOpen)},type:`button`,children:[(0,X.jsx)(I,{size:17}),`Details`]}),(0,X.jsx)(`button`,{className:`icon-button`,disabled:e.loading,onClick:()=>void e.refresh(),title:`Refresh current page`,children:e.loading?(0,X.jsx)(W,{className:`spin`,size:18}):(0,X.jsx)(o,{size:18})}),(0,X.jsxs)(`button`,{className:`primary-button`,onClick:()=>e.setUploadOpen(!0),children:[(0,X.jsx)(ue,{size:17}),`Upload`]})]})}function Cb(e){if(e.unavailable)return(0,X.jsx)(`div`,{"aria-label":`Lineage runtime identity unavailable`,className:`runtime-identity-badge unavailable`,children:`IDENTITY UNAVAILABLE`});if(!e.runtime)return(0,X.jsx)(`div`,{"aria-label":`Loading Lineage runtime identity`,className:`runtime-identity-badge loading`,children:`IDENTITY LOADING`});let{profile:t}=e.runtime,n=t.bound?``:` · UNBOUND`,r=[`${t.environment.toUpperCase()} profile ${t.id}${t.bound?``:` (unbound)`}`,`Channel ${e.runtime.channel}`,`Version ${e.runtime.version}`,t.warning].filter(Boolean).join(` · `);return(0,X.jsxs)(`div`,{"aria-label":`Lineage ${t.environment} profile ${t.id}${t.bound?``:` unbound`}`,className:`runtime-identity-badge ${t.environment} ${t.bound?`bound`:`unbound`}`,"data-profile-id":t.id,title:r,children:[(0,X.jsx)(`strong`,{children:t.environment.toUpperCase()}),(0,X.jsxs)(`span`,{children:[t.id,n]})]})}function wb({toast:e,onDismiss:t}){return(0,X.jsxs)(`div`,{className:`toast ${e.type}`,role:`status`,children:[e.type===`ok`?(0,X.jsx)(w,{size:16}):(0,X.jsx)(oe,{size:16}),(0,X.jsx)(`span`,{children:e.message}),(0,X.jsx)(`button`,{onClick:t,children:`Dismiss`})]})}var Tb=200*1024*1024;function Eb({channels:e,project:t,onClose:n,onUploaded:r,onError:i}){let[a,o]=(0,p.useState)({assetId:``,audience:`short-form-creators`,campaign:`2026-06-organic-traffic-test`,channel:e[0]||`meta`,cta:``,hook:``,status:`working`,title:``,type:`image`,utmContent:``}),[s,c]=(0,p.useState)(null),[l,u]=(0,p.useState)(!1),[d,f]=(0,p.useState)(!1);function m(e,t){o(n=>({...n,[e]:t}))}function h(e){o(t=>({...t,assetId:t.assetId||pe(`demo-${t.channel}-${e}`),title:e,utmContent:t.utmContent||pe(e).replaceAll(`-`,`_`)}))}function _(e){if(!e){c(null);return}if(e.size>Tb){i(`File is larger than ${q(Tb)}`);return}c(e)}async function v(e){if(e.preventDefault(),!s)return i(`Choose a file before uploading`);f(!0);try{let e=new FormData;Object.entries({project:t,...a,confirmWrite:String(l)}).forEach(([t,n])=>e.append(t,n)),e.append(`file`,s),await r((await g(`/api/assets/upload`,{method:`POST`,body:e})).message)}catch(e){i(e instanceof Error?e.message:String(e))}finally{f(!1)}}return(0,X.jsx)(`div`,{className:`drawer-backdrop`,children:(0,X.jsxs)(`form`,{className:`upload-drawer`,onSubmit:v,children:[(0,X.jsxs)(`header`,{children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h2`,{children:`Upload asset`}),(0,X.jsx)(`p`,{children:t})]}),(0,X.jsx)(`button`,{type:`button`,onClick:n,children:`Close`})]}),(0,X.jsxs)(`label`,{className:`file-drop`,children:[(0,X.jsx)(ue,{size:20}),(0,X.jsx)(`span`,{children:s?s.name:`Choose creative export up to ${q(Tb)}`}),(0,X.jsx)(`input`,{type:`file`,onChange:e=>_(e.target.files?.[0])})]}),(0,X.jsxs)(`div`,{className:`form-grid`,children:[(0,X.jsxs)(`label`,{children:[`Title`,(0,X.jsx)(`input`,{value:a.title,onChange:e=>h(e.target.value),required:!0})]}),(0,X.jsxs)(`label`,{children:[`Asset ID`,(0,X.jsx)(`input`,{value:a.assetId,onChange:e=>m(`assetId`,e.target.value),required:!0})]}),(0,X.jsxs)(`label`,{children:[`Campaign`,(0,X.jsx)(`input`,{value:a.campaign,onChange:e=>m(`campaign`,e.target.value),required:!0})]}),(0,X.jsxs)(`label`,{children:[`Channel`,(0,X.jsx)(`select`,{value:a.channel,onChange:e=>m(`channel`,e.target.value),children:e.map(e=>(0,X.jsx)(`option`,{children:e},e))})]}),(0,X.jsxs)(`label`,{children:[`Audience`,(0,X.jsx)(`input`,{value:a.audience,onChange:e=>m(`audience`,e.target.value),required:!0})]}),(0,X.jsxs)(`label`,{children:[`Status`,(0,X.jsxs)(`select`,{value:a.status,onChange:e=>m(`status`,e.target.value),children:[(0,X.jsx)(`option`,{children:`working`}),(0,X.jsx)(`option`,{children:`published`})]})]}),(0,X.jsxs)(`label`,{children:[`Type`,(0,X.jsx)(`select`,{value:a.type,onChange:e=>m(`type`,e.target.value),children:ge.map(e=>(0,X.jsx)(`option`,{children:e},e))})]}),(0,X.jsxs)(`label`,{children:[`UTM content`,(0,X.jsx)(`input`,{value:a.utmContent,onChange:e=>m(`utmContent`,e.target.value),required:!0})]}),(0,X.jsxs)(`label`,{className:`wide`,children:[`Hook`,(0,X.jsx)(`input`,{value:a.hook,onChange:e=>m(`hook`,e.target.value)})]}),(0,X.jsxs)(`label`,{className:`wide`,children:[`CTA`,(0,X.jsx)(`input`,{value:a.cta,onChange:e=>m(`cta`,e.target.value),required:!0})]})]}),(0,X.jsxs)(`label`,{className:`confirm-line`,children:[(0,X.jsx)(`input`,{type:`checkbox`,checked:l,onChange:e=>u(e.target.checked)}),(0,X.jsx)(`span`,{children:`Confirm write to the production asset bucket`})]}),(0,X.jsxs)(`footer`,{children:[(0,X.jsx)(`button`,{type:`button`,onClick:n,children:`Cancel`}),(0,X.jsxs)(`button`,{className:`primary-button`,disabled:d||!l,children:[d?(0,X.jsx)(W,{className:`spin`,size:16}):(0,X.jsx)(ue,{size:16}),`Upload`]})]})]})})}function Db(e,t){let n=`${e} ${t}`.toLowerCase();return n.includes(`agent`)||n.includes(`command`)||n.includes(`selection`)||n.includes(`next context`)}function Ob(){return typeof window>`u`?me:new URLSearchParams(window.location.search).get(`project`)||`demo-project`}function kb(){let[e,t]=(0,p.useState)(null),[n,r]=(0,p.useState)(null),[i,a]=(0,p.useState)(Ob),[o,s]=(0,p.useState)([]),[c,l]=(0,p.useState)(`all`),[u,d]=(0,p.useState)(`all`),[f,m]=(0,p.useState)(`local`),[h,y]=(0,p.useState)(`all`),[b,x]=(0,p.useState)(``),[S,C]=(0,p.useState)(1),[w,T]=(0,p.useState)(10),[E,D]=(0,p.useState)(!1),[O,k]=(0,p.useState)(!0),[A,j]=(0,p.useState)(null),[M,N]=(0,p.useState)(null),[P,F]=(0,p.useState)({}),[I,L]=(0,p.useState)({}),[R,z]=(0,p.useState)([]),[B,V]=(0,p.useState)([]),[ee,H]=(0,p.useState)(!1),[U,W]=(0,p.useState)(!1),[G,te]=(0,p.useState)(`lineage`),[ne,re]=(0,p.useState)(!1),[ie,ae]=(0,p.useState)(null),[oe,K]=(0,p.useState)(0),[se,ce]=(0,p.useState)(null),[le,ue]=(0,p.useState)(!1),[de,q]=(0,p.useState)(null),fe=(0,p.useCallback)(e=>{q(t=>e?`lineage-actions`:t===`lineage-actions`?null:t)},[]),pe=(0,p.useCallback)(e=>{q(t=>e?`topbar-more`:t===`topbar-more`?null:t)},[]),me=(0,p.useCallback)((e,t)=>{j({type:e,message:t})},[]),J=e?.catalog.project===i?e:null,he=J?.assets||[],Y=xe(he,n)||(ie?.project===i&&ie.asset_id===n?ie:void 0),ge=Y?.asset_id||``,_e=[...B.filter(e=>R.includes(e.asset_id)),...he.filter(e=>R.includes(e.asset_id)&&e.local?.relative_path)].filter((e,t,n)=>n.findIndex(t=>t.asset_id===e.asset_id)===t),ve=Y&&P[Y.asset_id]||null,ye=(0,p.useMemo)(()=>[`all`,...J?.facets.channels||[]],[J]),be=(0,p.useMemo)(()=>({assets:J?.catalog.asset_count||0,live:J?.liveObjects.length||0,orphan:J?.orphanObjects.length||0,size:J?.facets.totalSizeBytes||0}),[J]);async function Ce(){try{let e=await g(`/api/projects`);s(e.projects),a(t=>e.projects.some(e=>e.project===t)?t:e.projects[0]?.project||`demo-project`)}catch(e){j({type:`error`,message:e instanceof Error?e.message:String(e)})}}async function we(){try{let e=await g(`/api/runtime`);ce(e.runtime),ue(!1)}catch{ce(null),ue(!0)}}async function Te(){k(!0);try{let e=await g(`/api/assets?${Ee()}`);t(e),r(t=>xe(e.assets,t)?.asset_id||(t&&ie?.asset_id===t?t:null)),F({}),L({})}catch(e){j({type:`error`,message:e instanceof Error?e.message:String(e)})}finally{k(!1)}}function Ee(){let e=new URLSearchParams({project:i,page:String(S),pageSize:String(w),live:String(E),source:f});return c!==`all`&&e.set(`status`,c),u!==`all`&&e.set(`placementStatus`,u),h!==`all`&&e.set(`channel`,h),b.trim()&&e.set(`q`,b.trim()),e.toString()}async function De(e){try{let t=await e();j({type:`ok`,message:t.message}),F({}),await Te()}catch(e){j({type:`error`,message:e instanceof Error?e.message:String(e)})}}async function Oe(e,t={}){if(!Se(e))return null;let n=P[e.asset_id];if(n)return t.open&&window.open(n,`_blank`,`noopener,noreferrer`),n;if(e.local?.relative_path){let n=`/api/assets/local-preview?${new URLSearchParams({project:i,path:e.local.relative_path}).toString()}`;return F(t=>({...t,[e.asset_id]:n})),L(t=>({...t,[e.asset_id]:``})),t.open&&window.open(n,`_blank`,`noopener,noreferrer`),n}try{let n=await g(`/api/assets/presign`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({project:i,assetId:e.asset_id,expiresIn:900})});return F(t=>({...t,[e.asset_id]:n.url})),L(t=>({...t,[e.asset_id]:``})),t.open&&window.open(n.url,`_blank`,`noopener,noreferrer`),n.url}catch(n){let r=n instanceof Error?n.message:String(n);return L(t=>({...t,[e.asset_id]:r})),t.quiet||j({type:`error`,message:`Preview unavailable. Check S3 credentials or pull the asset locally.`}),null}}async function ke(e,t){try{let n=await Bm(e);j({type:`ok`,message:n.method===`fallback`?`Copied ${t} using browser fallback`:`Copied ${t}`}),N(Db(t,e)?{label:t,text:e}:null)}catch(n){N(Db(t,e)?{label:t,text:e}:null),j({type:`error`,message:n instanceof Error?n.message:String(n)})}}async function je(e){let t=await Oe(e,{quiet:!0});t&&await ke(t,`preview link`)}function Ne(e){e.local?.relative_path&&(z(t=>t.includes(e.asset_id)?t:[...t,e.asset_id]),V(t=>t.some(t=>t.asset_id===e.asset_id)?t:[...t,e]))}function Z(e){ae(e),r(e.asset_id),re(!0)}async function Pe(e){r(e),re(!0);let t=he.find(t=>t.asset_id===e);if(t){ae(t);return}try{let t=await g(`/api/assets/lookup`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({project:i,assetIds:[e]})});t.assets[0]&&ae(t.assets[0])}catch(e){j({type:`error`,message:e instanceof Error?e.message:String(e)})}}function Fe(){m(`local`),l(`all`),d(`all`),x(``),te(`backup`)}async function Ie(e){try{e.assetId&&r(e.assetId),e.view===`lineage`&&e.workspaceId&&await g(`/api/lineage-workspaces/${encodeURIComponent(e.workspaceId)}/activate`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({project:i,confirmWrite:!0})}),re(!1),te(e.view),j({type:`ok`,message:`Opened ${e.claim.target_title||e.claim.target_id}`})}catch(e){j({type:`error`,message:e instanceof Error?e.message:String(e)})}}function Le(e){e.local?.relative_path&&(z(t=>t.includes(e.asset_id)?t.filter(t=>t!==e.asset_id):[...t,e.asset_id]),V(t=>t.filter(t=>t.asset_id!==e.asset_id)))}return(0,p.useEffect)(()=>{Ce(),we()},[]),(0,p.useEffect)(()=>{let e=new URLSearchParams(window.location.search);e.get(`project`)!==i&&(e.set(`project`,i),window.history.replaceState(null,``,`${window.location.pathname}?${e.toString()}${window.location.hash}`))},[i]),(0,p.useEffect)(()=>{j(null),N(null),ae(null),re(!1)},[i]),(0,p.useEffect)(()=>{Te()},[S,w,i,c,u,f,h,b,E]),(0,p.useEffect)(()=>{C(1)},[i,c,u,f,h,b,w]),(0,p.useEffect)(()=>{!Se(Y)||P[Y.asset_id]||Oe(Y,{quiet:!0})},[Y?.asset_id,Y?.s3?.version_id,P]),(0,p.useEffect)(()=>{if(A?.type!==`ok`)return;let e=window.setTimeout(()=>j(null),2600);return()=>window.clearTimeout(e)},[A?.message,A?.type]),(0,p.useEffect)(()=>{G===`backup`&&(m(`local`),l(`all`),d(`all`))},[G]),(0,p.useEffect)(()=>{q(null)},[G]),(0,p.useEffect)(()=>{ge||re(!1)},[ge]),(0,X.jsx)(Me,{runtime:se,children:(0,X.jsxs)(`div`,{className:`app-shell ${G===`lineage`?`lineage-mode`:``}`,children:[(0,X.jsx)(vb,{channel:h,channels:ye,liveSync:E,placementStatus:u,project:i,projects:o,setChannel:y,setPlacementStatus:d,setProject:a,setSource:m,setStatus:l,setView:te,showBackupQueue:Fe,source:f,snapshot:J,status:c,totals:be}),(0,X.jsxs)(`main`,{className:`workspace`,children:[(0,X.jsx)(Sb,{assetDetailsOpen:ne,canInspectAsset:!!Y,loading:O,moreOpen:de===`topbar-more`,onMoreOpenChange:pe,query:b,refresh:Te,runtime:se,runtimeIdentityUnavailable:le,setAssetDetailsOpen:re,setQuery:x,setUploadOpen:W,setView:e=>e===`backup`?Fe():te(e),view:G}),A&&(0,X.jsx)(wb,{toast:A,onDismiss:()=>j(null)}),M&&(0,X.jsx)(Ct,{copiedText:M,onDismiss:()=>N(null)}),(0,X.jsx)(Ot,{onCopy:ke,project:i,refreshKey:oe,selectedAsset:Y,view:G}),G===`review`?(0,X.jsx)(Yy,{channel:h,onCopy:ke,onLocalReview:async(e,t)=>{await De(()=>_(`/api/local-review/${e.asset_id}`,i,{reviewState:t,confirmWrite:!0}))},onOpenBackup:e=>{Ne(e),H(!0)},onSelectAsset:e=>{Z(e)},project:i,selected:Y}):G===`ledger`?(0,X.jsx)(Vt,{project:i,query:b,onOpenAsset:Pe}):G===`content`?(0,X.jsx)(_t,{onCopy:ke,onOpenAsset:Pe,onToast:me,onWorkTargetsChanged:()=>K(e=>e+1),project:i,selectedAsset:Y}):G===`agents`?(0,X.jsx)(ze,{onCopy:ke,onOpenWork:Ie,project:i}):G===`backup`?(0,X.jsx)(zy,{assets:he,cli:se?.cli,onCopy:ke,onLocalReview:async(e,t)=>{await De(()=>_(`/api/local-review/${e.asset_id}`,i,{reviewState:t,confirmWrite:!0}))},onOpenBackup:()=>H(!0),onQueueBackup:Ne,onSelectAsset:e=>{Z(e)},page:S,pageSize:w,project:i,selected:Y,selectedBackupIds:R,setPage:C,setPageSize:T,snapshot:J}):G===`assets`?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Gy,{assets:_e,onClear:()=>{z([]),V([])},onOpen:()=>H(!0)}),(0,X.jsx)(Re,{assets:he,liveSync:E,onCopy:ke,onSelectionChanged:()=>K(e=>e+1),page:S,pageSize:w,previewUrls:P,project:i,selected:Y,setLiveSync:D,setPage:C,setPageSize:T,setSelectedId:r,snapshot:J,source:f,totals:be})]}):G===`settings`?(0,X.jsx)(hb,{onToast:me,project:i}):(0,X.jsx)(jy,{asset:Y,actionsOpen:de===`lineage-actions`,onAssetsChanged:Te,onActionsOpenChange:fe,onSelectedAsset:r,onToast:me,project:i})]}),G!==`lineage`&&ne&&(0,X.jsx)(Ae,{asset:Y,onArchive:e=>void De(()=>_(`/api/assets/archive`,i,{assetId:e.asset_id,confirmArchive:!0})),onClose:()=>re(!1),onCopy:(e,t)=>void ke(e,t),onCopyPreview:e=>void je(e),onDelete:(e,t)=>void De(()=>_(`/api/assets/delete-object`,i,{assetId:e.asset_id,confirmation:t})),onPlacement:(e,t,n)=>void De(()=>_(`/api/assets/placement`,i,{assetId:e.asset_id,channel:e.channel,...v(n),status:t,confirmWrite:!0})),onPresign:e=>void Oe(e,{open:!0}),onPromote:e=>void De(()=>_(`/api/assets/promote`,i,{assetId:e.asset_id,confirmWrite:!0})),onPull:e=>void De(()=>_(`/api/assets/pull`,i,{assetId:e.asset_id,out:`.asset-scratch`})),onToggleBackup:Le,previewError:Y&&I[Y.asset_id]||null,previewUrl:ve,selectedForBackup:Y?R.includes(Y.asset_id):!1}),U&&(0,X.jsx)(Eb,{channels:ye.filter(e=>e!==`all`),project:i,onClose:()=>W(!1),onError:e=>j({type:`error`,message:e}),onUploaded:async e=>{j({type:`ok`,message:e}),W(!1),await Te()}}),ee&&(0,X.jsx)(Py,{assets:_e,project:i,onClose:()=>H(!1),onError:e=>j({type:`error`,message:e}),onDone:async e=>{j({type:`ok`,message:e}),z([]),V([]),H(!1),await Te()}})]})})}(0,m.createRoot)(document.getElementById(`root`)).render((0,X.jsx)(p.StrictMode,{children:(0,X.jsx)(kb,{})}));
50
+ ]`);function ob(e,t){let n=ab.find(n=>n.adapterType===e&&n.providerId===t);if(!n)throw Error(`Missing public adapter catalog entry: ${e}/${t}`);return n}var sb={channel:`dev`,version:`0.1.25`},cb={cloud:D,image_generator:V,scheduler:ae},lb=Object.fromEntries(ab.map(e=>[e.adapterType,e.capabilityLabel])),ub=[{adapterType:`cloud`,ariaLabel:`Cloud storage settings`},{adapterType:`scheduler`,ariaLabel:`Social scheduling settings`},{adapterType:`image_generator`,ariaLabel:`Image generation settings`}];function db(e){return typeof e==`boolean`?e?`on`:`off`:typeof e==`number`?String(e):typeof e==`string`?e||`not set`:JSON.stringify(e)}function fb(e){return Object.entries(e.safe_config).filter(([e])=>![`secret`,`token`,`password`,`credential`,`apiKey`].includes(e))}function pb(e){return e.health_status===`configured`?`ok`:e.health_status===`missing_config`?`warn`:`muted`}function mb(e){return(0,X.jsx)(`button`,{"aria-checked":e.checked,"aria-label":e.label,className:`settings-switch ${e.checked?`on`:``}`,disabled:e.disabled,onClick:e.onClick,role:`switch`,type:`button`,children:(0,X.jsx)(`span`,{})})}function hb(e){let[t,n]=(0,p.useState)(null),[r,i]=(0,p.useState)(null),[a,s]=(0,p.useState)(!0),[c,l]=(0,p.useState)(``),[u,d]=(0,p.useState)(Cm);function f(){let t=!u;if(!wm(t)){e.onToast(`error`,`Browser storage is unavailable, so the hover preview preference could not be saved`);return}d(t),e.onToast(`ok`,`Lineage hover previews ${t?`enabled`:`disabled`}`)}async function m(){s(!0);try{let[t,r]=await Promise.all([g(`/api/adapters/settings?project=${encodeURIComponent(e.project)}`),g(`/api/runtime`)]);n(t),i(r.runtime)}catch(t){e.onToast(`error`,t instanceof Error?t.message:String(t))}finally{s(!1)}}async function h(t){let r=`${t.adapter_type}:${t.provider}`;l(r);try{let r=await g(`/api/adapters/settings/${t.adapter_type}/${t.provider}`,{body:JSON.stringify({confirmWrite:!0,enabled:!t.enabled,project:e.project,safeConfig:t.safe_config}),headers:{"Content-Type":`application/json`},method:`POST`});n(e=>e&&{...e,settings:e.settings.map(e=>e.adapter_type===r.setting.adapter_type&&e.provider===r.setting.provider?r.setting:e)}),e.onToast(`ok`,`${lb[t.adapter_type]} ${r.setting.enabled?`enabled`:`disabled`}`)}catch(t){e.onToast(`error`,t instanceof Error?t.message:String(t))}finally{l(``)}}return(0,p.useEffect)(()=>{m()},[e.project]),(0,X.jsxs)(`section`,{className:`settings-view`,children:[(0,X.jsxs)(`header`,{className:`settings-header`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h2`,{children:`Settings`}),(0,X.jsxs)(`p`,{children:[`Adapter switches, safe local preferences, and credential-source status for `,e.project,`.`]})]}),(0,X.jsxs)(`button`,{className:`secondary-button`,disabled:a,onClick:()=>void m(),type:`button`,children:[a?(0,X.jsx)(W,{className:`spin`,size:17}):(0,X.jsx)(o,{size:17}),`Refresh`]})]}),(0,X.jsxs)(`div`,{className:`settings-sections`,children:[(0,X.jsxs)(`section`,{"aria-label":`Release information`,className:`settings-section`,children:[(0,X.jsx)(`h3`,{children:`Release`}),(0,X.jsxs)(`dl`,{className:`settings-release`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:`Version`}),(0,X.jsx)(`dd`,{children:r?.version||sb.version})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:`Channel`}),(0,X.jsx)(`dd`,{children:r?.channel||sb.channel})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:`Profile`}),(0,X.jsx)(`dd`,{children:r?.profile.id||`loading`})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:`Environment`}),(0,X.jsx)(`dd`,{children:r?.profile.environment||`loading`})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:`Binding`}),(0,X.jsx)(`dd`,{children:r?r.profile.bound?`bound`:`legacy unbound`:`loading`})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:`Git`}),(0,X.jsx)(`dd`,{children:r?.git_sha||`not available`})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:`Assets`}),(0,X.jsx)(`dd`,{className:`settings-path`,children:r?.asset_root||`loading`})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:`SQLite`}),(0,X.jsx)(`dd`,{className:`settings-path`,children:r?.database.path||`loading`})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:`Database`}),(0,X.jsx)(`dd`,{children:r?.database.exists?`${r.database.projects??0} projects / ${r.database.workspaces??0} workspaces`:`not created yet`})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:`Schema`}),(0,X.jsx)(`dd`,{children:r?`${r.schema.migration_keys.length} migration marker(s)`:`loading`})]})]})]}),(0,X.jsxs)(`section`,{"aria-label":`Lineage experience settings`,className:`settings-section`,children:[(0,X.jsx)(`h3`,{children:`Lineage experience`}),(0,X.jsx)(`div`,{className:`settings-grid`,children:(0,X.jsx)(`article`,{className:`settings-card`,children:(0,X.jsxs)(`div`,{className:`settings-card-head`,children:[(0,X.jsx)(`span`,{className:`settings-icon`,children:(0,X.jsx)(N,{size:19})}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h4`,{children:`Hover previews`}),(0,X.jsx)(`p`,{children:`Show the full asset and quick Branch/Re-roll/Details actions when hovering over or focusing a lineage node. Double-click details remain available when this is off.`})]}),(0,X.jsx)(mb,{checked:u,label:`Enable lineage hover previews`,onClick:f})]})})})]}),ub.map(e=>(0,X.jsxs)(`section`,{"aria-label":e.ariaLabel,className:`settings-section`,children:[(0,X.jsx)(`h3`,{children:lb[e.adapterType]}),(0,X.jsx)(`div`,{className:`settings-grid`,children:(t?.settings||[]).filter(t=>t.adapter_type===e.adapterType).map(e=>{let t=cb[e.adapter_type],n=ob(e.adapter_type,e.provider),r=`Enable ${e.label===`Buffer`?`Buffer scheduling`:e.label}`,i=c===`${e.adapter_type}:${e.provider}`;return(0,X.jsxs)(`article`,{className:`settings-card`,children:[(0,X.jsxs)(`div`,{className:`settings-card-head`,children:[(0,X.jsx)(`span`,{className:`settings-icon`,children:(0,X.jsx)(t,{size:19})}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h4`,{children:e.label}),(0,X.jsx)(`p`,{children:e.description})]}),(0,X.jsx)(mb,{checked:e.enabled,disabled:i,label:r,onClick:()=>void h(e)})]}),(0,X.jsxs)(`dl`,{className:`settings-meta`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:`Status`}),(0,X.jsxs)(`dd`,{className:pb(e),children:[e.health_status===`configured`?(0,X.jsx)(w,{size:14}):(0,X.jsx)(C,{size:14}),e.health_status.replace(/_/g,` `)]})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:`Maturity`}),(0,X.jsx)(`dd`,{children:n.maturity})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:`Credential source`}),(0,X.jsx)(`dd`,{children:e.credential.label})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:`Secret ref`}),(0,X.jsx)(`dd`,{children:e.credential.secret_ref||`none`})]})]}),fb(e).length>0&&(0,X.jsx)(`div`,{className:`settings-config`,children:fb(e).map(([e,t])=>(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`strong`,{children:e}),db(t)]},e))})]},`${e.adapter_type}:${e.provider}`)})})]},e.adapterType)),a&&!t&&(0,X.jsx)(`div`,{className:`settings-loading`,children:`Loading settings...`})]})]})}var gb=`Lineage`,_b=`Local-first creative lineage workspace`;function vb(e){let{channel:t,channels:n,placementStatus:r,project:i,projects:a,setChannel:o,setPlacementStatus:s,setProject:c,setSource:l,setStatus:u,source:d,status:f}=e,[m,h]=(0,p.useState)(!1),[g,_]=(0,p.useState)(!0),v=a.length?a.map(e=>e.project):[i];return(0,X.jsxs)(`aside`,{className:`sidebar ${g?``:`collapsed`}`,children:[(0,X.jsx)(`button`,{"aria-label":g?`Collapse sidebar`:`Expand sidebar`,className:`sidebar-collapse-toggle`,onClick:()=>_(e=>!e),type:`button`,children:g?(0,X.jsx)(te,{size:16}):(0,X.jsx)(ne,{size:16})}),(0,X.jsxs)(`div`,{className:`brand`,children:[(0,X.jsx)(`div`,{className:`brand-mark`,"aria-label":_b,children:`L`}),(0,X.jsxs)(`div`,{className:`brand-copy`,children:[(0,X.jsx)(`h1`,{children:gb}),(0,X.jsxs)(`p`,{children:[(0,X.jsx)(`span`,{children:i}),(0,X.jsxs)(`span`,{"aria-label":`Lineage version ${sb.version}`,className:`brand-version`,title:`Lineage version ${sb.version}, ${sb.channel} channel`,children:[`v`,sb.version]})]})]})]}),(0,X.jsxs)(`button`,{"aria-controls":`mobile-sidebar-controls`,"aria-expanded":m,className:`mobile-filter-toggle`,onClick:()=>h(e=>!e),type:`button`,children:[(0,X.jsx)(K,{size:16}),`Filters`,(0,X.jsx)(S,{className:m?`open`:``,size:16})]}),(0,X.jsxs)(`div`,{className:`sidebar-mobile-collapse`,"data-open":m,id:`mobile-sidebar-controls`,children:[(0,X.jsxs)(`div`,{className:`side-section`,children:[(0,X.jsx)(`h2`,{children:`Project`}),(0,X.jsx)(yb,{id:`asset-project-filter`,label:`Project`,value:i,values:v,onChange:c})]}),(0,X.jsxs)(`section`,{className:`side-section`,children:[(0,X.jsx)(`h2`,{children:`Filters`}),(0,X.jsx)(yb,{id:`asset-source-filter`,label:`Source`,value:d,values:Y,onChange:e=>l(e)}),(0,X.jsx)(yb,{id:`asset-status-filter`,label:`Status`,value:f,values:J,onChange:e=>u(e)}),(0,X.jsx)(yb,{id:`asset-channel-filter`,label:`Channel`,value:t,values:n,onChange:o}),(0,X.jsx)(yb,{id:`asset-placement-filter`,label:`Placement`,value:r,values:he,onChange:e=>s(e)})]})]})]})}function yb({id:e,label:t,value:n,values:r,onChange:i}){return(0,X.jsxs)(`label`,{htmlFor:e,children:[t,(0,X.jsx)(`select`,{"aria-label":t,id:e,value:n,onChange:e=>i(e.target.value),children:r.map(e=>(0,X.jsx)(`option`,{value:e,children:e},e))})]})}var bb=[{label:`Lineage`,view:`lineage`},{label:`Review`,view:`review`},{label:`Assets`,view:`assets`},{label:`Agents`,view:`agents`},{label:`Settings`,view:`settings`}],xb=[{label:`Ledger`,view:`ledger`},{label:`Content batches`,view:`content`},{label:`Backup queue`,view:`backup`}];function Sb(e){let t=xb.some(t=>t.view===e.view);function n(t){e.setView(t),e.onMoreOpenChange(!1)}function r(t){e.setView(t),e.onMoreOpenChange(!1)}return(0,X.jsxs)(`header`,{className:`topbar`,children:[(0,X.jsxs)(`div`,{className:`view-tabs`,role:`tablist`,"aria-label":`${gb} views`,children:[bb.map(t=>(0,X.jsx)(`button`,{"aria-pressed":e.view===t.view,className:e.view===t.view?`active`:``,onClick:()=>n(t.view),type:`button`,children:t.label},t.view)),(0,X.jsxs)(`div`,{className:`more-menu`,children:[(0,X.jsxs)(`button`,{"aria-expanded":e.moreOpen,"aria-haspopup":`menu`,"aria-pressed":t,className:t?`active`:``,onClick:()=>e.onMoreOpenChange(!e.moreOpen),type:`button`,children:[(0,X.jsx)(j,{size:16}),` More `,(0,X.jsx)(S,{className:e.moreOpen?`open`:``,size:15})]}),e.moreOpen&&(0,X.jsx)(`div`,{className:`more-menu-popover`,role:`menu`,children:xb.map(t=>(0,X.jsx)(`button`,{"aria-pressed":e.view===t.view,onClick:()=>r(t.view),role:`menuitem`,type:`button`,children:t.label},t.view))})]})]}),(0,X.jsx)(Cb,{runtime:e.runtime,unavailable:e.runtimeIdentityUnavailable}),(0,X.jsxs)(`div`,{className:`searchbox`,children:[(0,X.jsx)(ie,{size:17}),(0,X.jsx)(`input`,{onChange:t=>e.setQuery(t.target.value),placeholder:`Search assets, campaigns, hooks`,value:e.query})]}),e.view!==`lineage`&&(0,X.jsxs)(`button`,{"aria-expanded":e.assetDetailsOpen,className:`secondary-button`,disabled:!e.canInspectAsset,onClick:()=>{e.onMoreOpenChange(!1),e.setAssetDetailsOpen(!e.assetDetailsOpen)},type:`button`,children:[(0,X.jsx)(I,{size:17}),`Details`]}),(0,X.jsx)(`button`,{className:`icon-button`,disabled:e.loading,onClick:()=>void e.refresh(),title:`Refresh current page`,children:e.loading?(0,X.jsx)(W,{className:`spin`,size:18}):(0,X.jsx)(o,{size:18})}),(0,X.jsxs)(`button`,{className:`primary-button`,onClick:()=>e.setUploadOpen(!0),children:[(0,X.jsx)(ue,{size:17}),`Upload`]})]})}function Cb(e){if(e.unavailable)return(0,X.jsx)(`div`,{"aria-label":`Lineage runtime identity unavailable`,className:`runtime-identity-badge unavailable`,children:`IDENTITY UNAVAILABLE`});if(!e.runtime)return(0,X.jsx)(`div`,{"aria-label":`Loading Lineage runtime identity`,className:`runtime-identity-badge loading`,children:`IDENTITY LOADING`});let{profile:t}=e.runtime,n=t.bound?``:` · UNBOUND`,r=[`${t.environment.toUpperCase()} profile ${t.id}${t.bound?``:` (unbound)`}`,`Channel ${e.runtime.channel}`,`Version ${e.runtime.version}`,t.warning].filter(Boolean).join(` · `);return(0,X.jsxs)(`div`,{"aria-label":`Lineage ${t.environment} profile ${t.id}${t.bound?``:` unbound`}`,className:`runtime-identity-badge ${t.environment} ${t.bound?`bound`:`unbound`}`,"data-profile-id":t.id,title:r,children:[(0,X.jsx)(`strong`,{children:t.environment.toUpperCase()}),(0,X.jsxs)(`span`,{children:[t.id,n]})]})}function wb({toast:e,onDismiss:t}){return(0,X.jsxs)(`div`,{className:`toast ${e.type}`,role:`status`,children:[e.type===`ok`?(0,X.jsx)(w,{size:16}):(0,X.jsx)(oe,{size:16}),(0,X.jsx)(`span`,{children:e.message}),(0,X.jsx)(`button`,{onClick:t,children:`Dismiss`})]})}var Tb=200*1024*1024;function Eb({channels:e,project:t,onClose:n,onUploaded:r,onError:i}){let[a,o]=(0,p.useState)({assetId:``,audience:`short-form-creators`,campaign:`2026-06-organic-traffic-test`,channel:e[0]||`meta`,cta:``,hook:``,status:`working`,title:``,type:`image`,utmContent:``}),[s,c]=(0,p.useState)(null),[l,u]=(0,p.useState)(!1),[d,f]=(0,p.useState)(!1);function m(e,t){o(n=>({...n,[e]:t}))}function h(e){o(t=>({...t,assetId:t.assetId||pe(`demo-${t.channel}-${e}`),title:e,utmContent:t.utmContent||pe(e).replaceAll(`-`,`_`)}))}function _(e){if(!e){c(null);return}if(e.size>Tb){i(`File is larger than ${q(Tb)}`);return}c(e)}async function v(e){if(e.preventDefault(),!s)return i(`Choose a file before uploading`);f(!0);try{let e=new FormData;Object.entries({project:t,...a,confirmWrite:String(l)}).forEach(([t,n])=>e.append(t,n)),e.append(`file`,s),await r((await g(`/api/assets/upload`,{method:`POST`,body:e})).message)}catch(e){i(e instanceof Error?e.message:String(e))}finally{f(!1)}}return(0,X.jsx)(`div`,{className:`drawer-backdrop`,children:(0,X.jsxs)(`form`,{className:`upload-drawer`,onSubmit:v,children:[(0,X.jsxs)(`header`,{children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h2`,{children:`Upload asset`}),(0,X.jsx)(`p`,{children:t})]}),(0,X.jsx)(`button`,{type:`button`,onClick:n,children:`Close`})]}),(0,X.jsxs)(`label`,{className:`file-drop`,children:[(0,X.jsx)(ue,{size:20}),(0,X.jsx)(`span`,{children:s?s.name:`Choose creative export up to ${q(Tb)}`}),(0,X.jsx)(`input`,{type:`file`,onChange:e=>_(e.target.files?.[0])})]}),(0,X.jsxs)(`div`,{className:`form-grid`,children:[(0,X.jsxs)(`label`,{children:[`Title`,(0,X.jsx)(`input`,{value:a.title,onChange:e=>h(e.target.value),required:!0})]}),(0,X.jsxs)(`label`,{children:[`Asset ID`,(0,X.jsx)(`input`,{value:a.assetId,onChange:e=>m(`assetId`,e.target.value),required:!0})]}),(0,X.jsxs)(`label`,{children:[`Campaign`,(0,X.jsx)(`input`,{value:a.campaign,onChange:e=>m(`campaign`,e.target.value),required:!0})]}),(0,X.jsxs)(`label`,{children:[`Channel`,(0,X.jsx)(`select`,{value:a.channel,onChange:e=>m(`channel`,e.target.value),children:e.map(e=>(0,X.jsx)(`option`,{children:e},e))})]}),(0,X.jsxs)(`label`,{children:[`Audience`,(0,X.jsx)(`input`,{value:a.audience,onChange:e=>m(`audience`,e.target.value),required:!0})]}),(0,X.jsxs)(`label`,{children:[`Status`,(0,X.jsxs)(`select`,{value:a.status,onChange:e=>m(`status`,e.target.value),children:[(0,X.jsx)(`option`,{children:`working`}),(0,X.jsx)(`option`,{children:`published`})]})]}),(0,X.jsxs)(`label`,{children:[`Type`,(0,X.jsx)(`select`,{value:a.type,onChange:e=>m(`type`,e.target.value),children:ge.map(e=>(0,X.jsx)(`option`,{children:e},e))})]}),(0,X.jsxs)(`label`,{children:[`UTM content`,(0,X.jsx)(`input`,{value:a.utmContent,onChange:e=>m(`utmContent`,e.target.value),required:!0})]}),(0,X.jsxs)(`label`,{className:`wide`,children:[`Hook`,(0,X.jsx)(`input`,{value:a.hook,onChange:e=>m(`hook`,e.target.value)})]}),(0,X.jsxs)(`label`,{className:`wide`,children:[`CTA`,(0,X.jsx)(`input`,{value:a.cta,onChange:e=>m(`cta`,e.target.value),required:!0})]})]}),(0,X.jsxs)(`label`,{className:`confirm-line`,children:[(0,X.jsx)(`input`,{type:`checkbox`,checked:l,onChange:e=>u(e.target.checked)}),(0,X.jsx)(`span`,{children:`Confirm write to the production asset bucket`})]}),(0,X.jsxs)(`footer`,{children:[(0,X.jsx)(`button`,{type:`button`,onClick:n,children:`Cancel`}),(0,X.jsxs)(`button`,{className:`primary-button`,disabled:d||!l,children:[d?(0,X.jsx)(W,{className:`spin`,size:16}):(0,X.jsx)(ue,{size:16}),`Upload`]})]})]})})}function Db(e,t){let n=`${e} ${t}`.toLowerCase();return n.includes(`agent`)||n.includes(`command`)||n.includes(`selection`)||n.includes(`next context`)}function Ob(){return typeof window>`u`?me:new URLSearchParams(window.location.search).get(`project`)||`demo-project`}function kb(){let[e,t]=(0,p.useState)(null),[n,r]=(0,p.useState)(null),[i,a]=(0,p.useState)(Ob),[o,s]=(0,p.useState)([]),[c,l]=(0,p.useState)(`all`),[u,d]=(0,p.useState)(`all`),[f,m]=(0,p.useState)(`local`),[h,y]=(0,p.useState)(`all`),[b,x]=(0,p.useState)(``),[S,C]=(0,p.useState)(1),[w,T]=(0,p.useState)(10),[E,D]=(0,p.useState)(!1),[O,k]=(0,p.useState)(!0),[A,j]=(0,p.useState)(null),[M,N]=(0,p.useState)(null),[P,F]=(0,p.useState)({}),[I,L]=(0,p.useState)({}),[R,z]=(0,p.useState)([]),[B,V]=(0,p.useState)([]),[ee,H]=(0,p.useState)(!1),[U,W]=(0,p.useState)(!1),[G,te]=(0,p.useState)(`lineage`),[ne,re]=(0,p.useState)(!1),[ie,ae]=(0,p.useState)(null),[oe,K]=(0,p.useState)(0),[se,ce]=(0,p.useState)(null),[le,ue]=(0,p.useState)(!1),[de,q]=(0,p.useState)(null),fe=(0,p.useCallback)(e=>{q(t=>e?`lineage-actions`:t===`lineage-actions`?null:t)},[]),pe=(0,p.useCallback)(e=>{q(t=>e?`topbar-more`:t===`topbar-more`?null:t)},[]),me=(0,p.useCallback)((e,t)=>{j({type:e,message:t})},[]),J=e?.catalog.project===i?e:null,he=J?.assets||[],Y=xe(he,n)||(ie?.project===i&&ie.asset_id===n?ie:void 0),ge=Y?.asset_id||``,_e=[...B.filter(e=>R.includes(e.asset_id)),...he.filter(e=>R.includes(e.asset_id)&&e.local?.relative_path)].filter((e,t,n)=>n.findIndex(t=>t.asset_id===e.asset_id)===t),ve=Y&&P[Y.asset_id]||null,ye=(0,p.useMemo)(()=>[`all`,...J?.facets.channels||[]],[J]),be=(0,p.useMemo)(()=>({assets:J?.catalog.asset_count||0,live:J?.liveObjects.length||0,orphan:J?.orphanObjects.length||0,size:J?.facets.totalSizeBytes||0}),[J]);async function Ce(){try{let e=await g(`/api/projects`);s(e.projects),a(t=>e.projects.some(e=>e.project===t)?t:e.projects[0]?.project||`demo-project`)}catch(e){j({type:`error`,message:e instanceof Error?e.message:String(e)})}}async function we(){try{let e=await g(`/api/runtime`);ce(e.runtime),ue(!1)}catch{ce(null),ue(!0)}}async function Te(){k(!0);try{let e=await g(`/api/assets?${Ee()}`);t(e),r(t=>xe(e.assets,t)?.asset_id||(t&&ie?.asset_id===t?t:null)),F({}),L({})}catch(e){j({type:`error`,message:e instanceof Error?e.message:String(e)})}finally{k(!1)}}function Ee(){let e=new URLSearchParams({project:i,page:String(S),pageSize:String(w),live:String(E),source:f});return c!==`all`&&e.set(`status`,c),u!==`all`&&e.set(`placementStatus`,u),h!==`all`&&e.set(`channel`,h),b.trim()&&e.set(`q`,b.trim()),e.toString()}async function De(e){try{let t=await e();j({type:`ok`,message:t.message}),F({}),await Te()}catch(e){j({type:`error`,message:e instanceof Error?e.message:String(e)})}}async function Oe(e,t={}){if(!Se(e))return null;let n=P[e.asset_id];if(n)return t.open&&window.open(n,`_blank`,`noopener,noreferrer`),n;if(e.local?.relative_path){let n=`/api/assets/local-preview?${new URLSearchParams({project:i,path:e.local.relative_path}).toString()}`;return F(t=>({...t,[e.asset_id]:n})),L(t=>({...t,[e.asset_id]:``})),t.open&&window.open(n,`_blank`,`noopener,noreferrer`),n}try{let n=await g(`/api/assets/presign`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({project:i,assetId:e.asset_id,expiresIn:900})});return F(t=>({...t,[e.asset_id]:n.url})),L(t=>({...t,[e.asset_id]:``})),t.open&&window.open(n.url,`_blank`,`noopener,noreferrer`),n.url}catch(n){let r=n instanceof Error?n.message:String(n);return L(t=>({...t,[e.asset_id]:r})),t.quiet||j({type:`error`,message:`Preview unavailable. Check S3 credentials or pull the asset locally.`}),null}}async function ke(e,t){try{let n=await Bm(e);j({type:`ok`,message:n.method===`fallback`?`Copied ${t} using browser fallback`:`Copied ${t}`}),N(Db(t,e)?{label:t,text:e}:null)}catch(n){N(Db(t,e)?{label:t,text:e}:null),j({type:`error`,message:n instanceof Error?n.message:String(n)})}}async function je(e){let t=await Oe(e,{quiet:!0});t&&await ke(t,`preview link`)}function Ne(e){e.local?.relative_path&&(z(t=>t.includes(e.asset_id)?t:[...t,e.asset_id]),V(t=>t.some(t=>t.asset_id===e.asset_id)?t:[...t,e]))}function Z(e){ae(e),r(e.asset_id),re(!0)}async function Pe(e){r(e),re(!0);let t=he.find(t=>t.asset_id===e);if(t){ae(t);return}try{let t=await g(`/api/assets/lookup`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({project:i,assetIds:[e]})});t.assets[0]&&ae(t.assets[0])}catch(e){j({type:`error`,message:e instanceof Error?e.message:String(e)})}}function Fe(){m(`local`),l(`all`),d(`all`),x(``),te(`backup`)}async function Ie(e){try{e.assetId&&r(e.assetId),e.view===`lineage`&&e.workspaceId&&await g(`/api/lineage-workspaces/${encodeURIComponent(e.workspaceId)}/activate`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({project:i,confirmWrite:!0})}),re(!1),te(e.view),j({type:`ok`,message:`Opened ${e.claim.target_title||e.claim.target_id}`})}catch(e){j({type:`error`,message:e instanceof Error?e.message:String(e)})}}function Le(e){e.local?.relative_path&&(z(t=>t.includes(e.asset_id)?t.filter(t=>t!==e.asset_id):[...t,e.asset_id]),V(t=>t.filter(t=>t.asset_id!==e.asset_id)))}return(0,p.useEffect)(()=>{Ce(),we()},[]),(0,p.useEffect)(()=>{let e=new URLSearchParams(window.location.search);e.get(`project`)!==i&&(e.set(`project`,i),window.history.replaceState(null,``,`${window.location.pathname}?${e.toString()}${window.location.hash}`))},[i]),(0,p.useEffect)(()=>{j(null),N(null),ae(null),re(!1)},[i]),(0,p.useEffect)(()=>{Te()},[S,w,i,c,u,f,h,b,E]),(0,p.useEffect)(()=>{C(1)},[i,c,u,f,h,b,w]),(0,p.useEffect)(()=>{!Se(Y)||P[Y.asset_id]||Oe(Y,{quiet:!0})},[Y?.asset_id,Y?.s3?.version_id,P]),(0,p.useEffect)(()=>{if(A?.type!==`ok`)return;let e=window.setTimeout(()=>j(null),2600);return()=>window.clearTimeout(e)},[A?.message,A?.type]),(0,p.useEffect)(()=>{G===`backup`&&(m(`local`),l(`all`),d(`all`))},[G]),(0,p.useEffect)(()=>{q(null)},[G]),(0,p.useEffect)(()=>{ge||re(!1)},[ge]),(0,X.jsx)(Me,{runtime:se,children:(0,X.jsxs)(`div`,{className:`app-shell ${G===`lineage`?`lineage-mode`:``}`,children:[(0,X.jsx)(vb,{channel:h,channels:ye,liveSync:E,placementStatus:u,project:i,projects:o,setChannel:y,setPlacementStatus:d,setProject:a,setSource:m,setStatus:l,setView:te,showBackupQueue:Fe,source:f,snapshot:J,status:c,totals:be}),(0,X.jsxs)(`main`,{className:`workspace`,children:[(0,X.jsx)(Sb,{assetDetailsOpen:ne,canInspectAsset:!!Y,loading:O,moreOpen:de===`topbar-more`,onMoreOpenChange:pe,query:b,refresh:Te,runtime:se,runtimeIdentityUnavailable:le,setAssetDetailsOpen:re,setQuery:x,setUploadOpen:W,setView:e=>e===`backup`?Fe():te(e),view:G}),A&&(0,X.jsx)(wb,{toast:A,onDismiss:()=>j(null)}),M&&(0,X.jsx)(Ct,{copiedText:M,onDismiss:()=>N(null)}),(0,X.jsx)(Ot,{onCopy:ke,project:i,refreshKey:oe,selectedAsset:Y,view:G}),G===`review`?(0,X.jsx)(Yy,{channel:h,onCopy:ke,onLocalReview:async(e,t)=>{await De(()=>_(`/api/local-review/${e.asset_id}`,i,{reviewState:t,confirmWrite:!0}))},onOpenBackup:e=>{Ne(e),H(!0)},onSelectAsset:e=>{Z(e)},project:i,selected:Y}):G===`ledger`?(0,X.jsx)(Vt,{project:i,query:b,onOpenAsset:Pe}):G===`content`?(0,X.jsx)(_t,{onCopy:ke,onOpenAsset:Pe,onToast:me,onWorkTargetsChanged:()=>K(e=>e+1),project:i,selectedAsset:Y}):G===`agents`?(0,X.jsx)(ze,{onCopy:ke,onOpenWork:Ie,project:i}):G===`backup`?(0,X.jsx)(zy,{assets:he,cli:se?.cli,onCopy:ke,onLocalReview:async(e,t)=>{await De(()=>_(`/api/local-review/${e.asset_id}`,i,{reviewState:t,confirmWrite:!0}))},onOpenBackup:()=>H(!0),onQueueBackup:Ne,onSelectAsset:e=>{Z(e)},page:S,pageSize:w,project:i,selected:Y,selectedBackupIds:R,setPage:C,setPageSize:T,snapshot:J}):G===`assets`?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Gy,{assets:_e,onClear:()=>{z([]),V([])},onOpen:()=>H(!0)}),(0,X.jsx)(Re,{assets:he,liveSync:E,onCopy:ke,onSelectionChanged:()=>K(e=>e+1),page:S,pageSize:w,previewUrls:P,project:i,selected:Y,setLiveSync:D,setPage:C,setPageSize:T,setSelectedId:r,snapshot:J,source:f,totals:be})]}):G===`settings`?(0,X.jsx)(hb,{onToast:me,project:i}):(0,X.jsx)(jy,{asset:Y,actionsOpen:de===`lineage-actions`,onAssetsChanged:Te,onActionsOpenChange:fe,onSelectedAsset:r,onToast:me,project:i})]}),G!==`lineage`&&ne&&(0,X.jsx)(Ae,{asset:Y,onArchive:e=>void De(()=>_(`/api/assets/archive`,i,{assetId:e.asset_id,confirmArchive:!0})),onClose:()=>re(!1),onCopy:(e,t)=>void ke(e,t),onCopyPreview:e=>void je(e),onDelete:(e,t)=>void De(()=>_(`/api/assets/delete-object`,i,{assetId:e.asset_id,confirmation:t})),onPlacement:(e,t,n)=>void De(()=>_(`/api/assets/placement`,i,{assetId:e.asset_id,channel:e.channel,...v(n),status:t,confirmWrite:!0})),onPresign:e=>void Oe(e,{open:!0}),onPromote:e=>void De(()=>_(`/api/assets/promote`,i,{assetId:e.asset_id,confirmWrite:!0})),onPull:e=>void De(()=>_(`/api/assets/pull`,i,{assetId:e.asset_id,out:`.asset-scratch`})),onToggleBackup:Le,previewError:Y&&I[Y.asset_id]||null,previewUrl:ve,selectedForBackup:Y?R.includes(Y.asset_id):!1}),U&&(0,X.jsx)(Eb,{channels:ye.filter(e=>e!==`all`),project:i,onClose:()=>W(!1),onError:e=>j({type:`error`,message:e}),onUploaded:async e=>{j({type:`ok`,message:e}),W(!1),await Te()}}),ee&&(0,X.jsx)(Py,{assets:_e,project:i,onClose:()=>H(!1),onError:e=>j({type:`error`,message:e}),onDone:async e=>{j({type:`ok`,message:e}),z([]),V([]),H(!1),await Te()}})]})})}(0,m.createRoot)(document.getElementById(`root`)).render((0,X.jsx)(p.StrictMode,{children:(0,X.jsx)(kb,{})}));
@@ -4,7 +4,7 @@
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <title>Lineage</title>
7
- <script type="module" crossorigin src="/lineage/assets/app-TEMX-pOn.js"></script>
7
+ <script type="module" crossorigin src="/lineage/assets/app-BfxPwDL1.js"></script>
8
8
  <link rel="modulepreload" crossorigin href="/lineage/assets/jsx-runtime-DAFSxiwi.js">
9
9
  <link rel="stylesheet" crossorigin href="/lineage/assets/app-CuBsKrS-.css">
10
10
  </head>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mean-weasel/lineage",
3
- "version": "0.1.24",
3
+ "version": "0.1.25",
4
4
  "description": "Local-first creative lineage workspace",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -57,7 +57,7 @@
57
57
  "prepare-release": "node scripts/prepare-release.mjs",
58
58
  "release": "node scripts/release.mjs",
59
59
  "release:dry-run": "node scripts/release.mjs --dry-run",
60
- "release:policy:test": "node --test scripts/tag-release-plan.test.mjs",
60
+ "release:policy:test": "node --test scripts/tag-release-plan.test.mjs scripts/release-provenance.test.mjs",
61
61
  "release:github": "node scripts/sync-github-release.mjs --channel latest",
62
62
  "release:github:next": "node scripts/sync-github-release.mjs --channel next",
63
63
  "release:github:dry-run": "node scripts/sync-github-release.mjs --channel latest --dry-run",