1import{n as e}from"./rolldown-runtime-CMxvf4Kt.js";import{cr as t,sr as n}from"./agent-Dh3-_0ai.js";import{Sr as r,Tr as i,lr as a,pr as o,tr as s}from"../i18n/i18n-src-XaAKi_OQ.js";var c,l,u=e((()=>{c=function(e){return e.BusinessStrategy=`business-strategy`,e.ContentCreation=`content-creation`,e.CreatorEconomy=`creator-economy`,e.DesignCreative=`design-creative`,e.Engineering=`engineering`,e.FinanceLegal=`finance-legal`,e.LearningResearch=`learning-research`,e.Marketing=`marketing`,e.Operations=`operations`,e.PeopleHR=`people-hr`,e.PersonalLife=`personal-life`,e.ProductManagement=`product-management`,e.SalesCustomer=`sales-customer`,e}({}),l=Object.values(c)})),d,f,p,m,h,g,_,v,y=e((()=>{u(),d=new Set(l),f=(e,t)=>{if(!(!e.identifier||!e.name)&&d.has(t))return{avatar:e.avatar,category:t,description:e.description,id:e.identifier,title:e.name}},p=e=>`builtin-tool-web-onboarding/agent-marketplace/onboarding-templates/${e??`default`}`,m=async()=>{throw Error(`[AgentMarketplace] Agent templates fetcher is not configured. Call setAgentTemplatesFetcher in your app initialization.`)},h=m,g=e=>{h=e},_=e=>h(e),v=(e,t)=>{if(t.length===0)return e;let n=new Map(t.map((e,t)=>[e,t]));return[...e].sort((e,t)=>(n.get(e.category)??2**53-1)-(n.get(t.category)??2**53-1))}})),b,x,S,C,w=e((()=>{s(),u(),b=a(l),x=r({categoryHints:o(b).min(1),description:i().optional(),prompt:i().min(1),requestId:i().min(1)}),S=r({requestId:i().min(1),selectedTemplateIds:o(i().min(1)).min(1)}),C=class{picks=new Map;hooks;constructor(e={}){this.hooks=e}async showAgentMarketplace(e,t){let n=x.safeParse(e);if(!n.success)return{content:`Invalid showAgentMarketplace args:\n${n.error.issues.map(e=>`${e.path.join(`.`)}: ${e.message}`).join(` 2`)}\nPlease regenerate the tool call with the correct schema.`,success:!1};let{categoryHints:r,description:i,prompt:a,requestId:o}=n.data;if(t?.topicId){let e=[...this.picks.values()].find(e=>e.topicId===t.topicId);if(e)return{content:`A marketplace picker is already open in this conversation (status=${e.status}). Do NOT call showAgentMarketplace again. End this turn now and wait â when the user submits, the original tool result will be rewritten in place with the user's selection (\`selectedTemplateIds\`, \`installedAgentIds\`) and your runtime will resume from there with the full wrap-up checklist.`,state:e,success:!1}}let s={categoryHints:r,description:i,prompt:a,requestId:o,status:`pending`,topicId:t?.topicId??void 0};this.picks.set(o,s);try{this.hooks.onShown?.({categoryHints:r,requestId:o})}catch(e){console.error(`[AgentMarketplace] onShown telemetry failed`,e)}return{content:[`Marketplace picker is now visible to the user.`,`End this turn now: do NOT call any further tools (no finishOnboarding, no askUserQuestion, no other tools) and do NOT write any wrap-up text. The user has not picked yet â anything you say here is premature.`,"When the user submits in the picker UI, this very tool result will be rewritten in place with the userâs selection (`selectedTemplateIds`, `installedAgentIds`) and your runtime will resume reading the updated content. The rewritten result carries the full wrap-up checklist (acknowledge â updateDocument(persona) â finishOnboarding); follow it then."].join(` `),state:s,success:!0}}async submitAgentPick(e){let t=S.safeParse(e);if(!t.success)return{content:`Invalid submitAgentPick args:\n${t.error.issues.map(e=>`${e.path.join(`.`)}: ${e.message}`).join(` 3`)}\nPlease regenerate the tool call with the correct schema.`,success:!1};let{requestId:n,selectedTemplateIds:r}=t.data,i=this.picks.get(n);if(!i)return{content:`Pick request not found: ${n}`,success:!1};if(i.status!==`pending`)return{content:`Pick request ${n} is already ${i.status}, cannot submit.`,success:!1};i.status=`submitted`,i.selectedTemplateIds=r,this.picks.set(n,i);try{this.hooks.onPicked?.({categoryHints:i.categoryHints,requestId:n,selectedTemplateIds:r})}catch(e){console.error(`[AgentMarketplace] onPicked telemetry failed`,e)}return{content:`User picked ${r.length} template(s) for ${n}.`,state:i,success:!0}}}})),T,E,D=e((()=>{T=e=>{let t=[e.title??e.templateId];e.category&&t.push(`[${e.category}]`);let n=`- ${t.join(` `)}`;return e.description&&(n+=` â ${e.description}`),e.skipped&&(n+=` (already in library)`),n},E=e=>{let{selectedAgentIds:t,installedAgentIds:n,skippedAgentIds:r,summaries:i}=e,a=[`User has finished picking from the marketplace. They selected ${t.length} agent template(s); the agents are now forked into the user's library and ready to use. The user has already completed this step in the UI â do NOT thank them for opening the picker or claim you "opened the list" again.`];return i.length>0&&a.push(`Selected templates:`,...i.map(e=>T(e))),a.push(`selectedTemplateIds: ${JSON.stringify(t)}`,`installedAgentIds: ${JSON.stringify(n)}`),r.length>0&&a.push(`skippedAgentIds (already in library, not re-installed): ${JSON.stringify(r)}`),a.push(`THIS TURN â required actions to wrap up onboarding:`,`
31) Briefly acknowledge the picks in 1â2 sentences (you may reference assistants by title/category from the list above).`,`2) Call updateDocument(type="persona") to append a short note about the assistants the user picked (their categories/use cases) so future sessions remember.`,`3) Call finishOnboarding to complete onboarding.`,`Do NOT call showAgentMarketplace again. Do NOT ask the user to pick anything else.`),a.join(` 4`)}})),O=e((()=>{y(),w(),D(),u()})),k,A,j,M,N,P,F,I,L,R,z=e((()=>{t(),k={COMPLETED:`onboarding_completed`,MARKETPLACE_PICKED:`onboarding_marketplace_picked`,MARKETPLACE_SHOWN:`onboarding_marketplace_shown`,STEP_COMPLETED:`onboarding_step_completed`,STEP_VIEWED:`onboarding_step_viewed`},A={COMPLETED:`onboarding.completed`,MARKETPLACE_PICKED:`onboarding.marketplace.picked`,MARKETPLACE_SHOWN:`onboarding.marketplace.shown`,STEP_COMPLETED:`onboarding.step.completed`,STEP_VIEWED:`onboarding.step.viewed`},j=null,M=e=>{j=e},N=(e,t)=>{let r=j??n();if(r)try{r.track({name:e,properties:t})}catch(e){console.error(`[OnboardingMetrics] track failed`,e)}},P=e=>{N(k.STEP_VIEWED,{...e,spm:A.STEP_VIEWED})},F=e=>{N(k.STEP_COMPLETED,{...e,spm:A.STEP_COMPLETED})},I=e=>{N(k.COMPLETED,{...e,spm:A.COMPLETED})},L=e=>{N(k.MARKETPLACE_SHOWN,{...e,spm:A.MARKETPLACE_SHOWN})},R=e=>{N(k.MARKETPLACE_PICKED,{...e,spm:A.MARKETPLACE_PICKED})}}));export{f as _,L as a,c as b,O as c,C as d,w as f,y as g,v as h,R as i,E as l,p as m,M as n,F as o,_ as p,I as r,P as s,z as t,D as u,g as v,u as x,l as y};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.