@sapienx/agentos 0.4.7 → 0.5.2
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/README.md +6 -0
- package/bin/agentos.js +86 -16
- package/bundle/.next/BUILD_ID +1 -1
- package/bundle/.next/app-path-routes-manifest.json +10 -10
- package/bundle/.next/build-manifest.json +2 -2
- package/bundle/.next/required-server-files.json +7 -0
- package/bundle/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/bundle/.next/server/app/_global-error.html +1 -1
- package/bundle/.next/server/app/_global-error.rsc +1 -1
- package/bundle/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/bundle/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/bundle/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/bundle/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/bundle/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/bundle/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/bundle/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/bundle/.next/server/app/_not-found.html +1 -1
- package/bundle/.next/server/app/_not-found.rsc +2 -2
- package/bundle/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
- package/bundle/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/bundle/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
- package/bundle/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/bundle/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/bundle/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/bundle/.next/server/app/api/agents/[agentId]/chat/route.js +5 -5
- package/bundle/.next/server/app/api/agents/[agentId]/chat/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/agents/route.js +1 -1
- package/bundle/.next/server/app/api/agents/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/diagnostics/route.js +1 -1
- package/bundle/.next/server/app/api/diagnostics/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/files/reveal/route.js +1 -1
- package/bundle/.next/server/app/api/gateway/control/route.js +1 -1
- package/bundle/.next/server/app/api/gateway/control/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/mission/route.js +1 -1
- package/bundle/.next/server/app/api/mission/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/models/catalog/route.js +1 -2
- package/bundle/.next/server/app/api/models/catalog/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/models/providers/route.js +1 -2
- package/bundle/.next/server/app/api/models/providers/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/onboarding/models/route.js +8 -10
- package/bundle/.next/server/app/api/onboarding/models/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/onboarding/route.js +6 -7
- package/bundle/.next/server/app/api/onboarding/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/planner/[planId]/deploy/route.js +1 -1
- package/bundle/.next/server/app/api/planner/[planId]/deploy/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/planner/[planId]/document-rewrite/route.js +1 -1
- package/bundle/.next/server/app/api/planner/[planId]/document-rewrite/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/planner/[planId]/route.js +1 -1
- package/bundle/.next/server/app/api/planner/[planId]/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/planner/[planId]/simulate/route.js +1 -1
- package/bundle/.next/server/app/api/planner/[planId]/simulate/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/planner/[planId]/turn/route.js +1 -1
- package/bundle/.next/server/app/api/planner/[planId]/turn/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/planner/route.js +1 -1
- package/bundle/.next/server/app/api/planner/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/reset/route.js +2 -2
- package/bundle/.next/server/app/api/reset/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/runtimes/[runtimeId]/route.js +1 -1
- package/bundle/.next/server/app/api/runtimes/[runtimeId]/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/settings/gateway/route.js +1 -1
- package/bundle/.next/server/app/api/settings/gateway/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/settings/openclaw-binary/route.js +1 -1
- package/bundle/.next/server/app/api/settings/openclaw-binary/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/settings/workspace-root/route.js +1 -1
- package/bundle/.next/server/app/api/settings/workspace-root/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/snapshot/route.js +1 -1
- package/bundle/.next/server/app/api/snapshot/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/stream/route.js +2 -2
- package/bundle/.next/server/app/api/stream/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/system/open-terminal/route.js +1 -1
- package/bundle/.next/server/app/api/tasks/[taskId]/abort/route.js +1 -1
- package/bundle/.next/server/app/api/tasks/[taskId]/abort/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/tasks/[taskId]/control/route.js +1 -1
- package/bundle/.next/server/app/api/tasks/[taskId]/control/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/tasks/[taskId]/stream/route.js +2 -2
- package/bundle/.next/server/app/api/tasks/[taskId]/stream/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/update/route.js +2 -2
- package/bundle/.next/server/app/api/update/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/workspaces/[workspaceId]/channels/discovered-groups/route.js +1 -1
- package/bundle/.next/server/app/api/workspaces/[workspaceId]/channels/discovered-groups/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/workspaces/[workspaceId]/channels/route.js +1 -1
- package/bundle/.next/server/app/api/workspaces/[workspaceId]/channels/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/workspaces/[workspaceId]/edit-draft/route.js +1 -1
- package/bundle/.next/server/app/api/workspaces/[workspaceId]/edit-draft/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/workspaces/[workspaceId]/files/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/workspaces/[workspaceId]/surfaces/discovery/route.js +1 -1
- package/bundle/.next/server/app/api/workspaces/[workspaceId]/surfaces/discovery/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/workspaces/route.js +2 -2
- package/bundle/.next/server/app/api/workspaces/route.js.nft.json +1 -1
- package/bundle/.next/server/app/page.js +1 -1
- package/bundle/.next/server/app/page.js.nft.json +1 -1
- package/bundle/.next/server/app/page_client-reference-manifest.js +1 -1
- package/bundle/.next/server/app/settings/page.js +1 -1
- package/bundle/.next/server/app/settings/page.js.nft.json +1 -1
- package/bundle/.next/server/app/settings/page_client-reference-manifest.js +1 -1
- package/bundle/.next/server/app-paths-manifest.json +10 -10
- package/bundle/.next/server/chunks/4767.js +281 -0
- package/bundle/.next/server/chunks/5151.js +3 -3
- package/bundle/.next/server/chunks/5831.js +2 -0
- package/bundle/.next/server/chunks/6639.js +7 -7
- package/bundle/.next/server/chunks/7125.js +35 -35
- package/bundle/.next/server/chunks/7639.js +1 -1
- package/bundle/.next/server/middleware-build-manifest.js +1 -1
- package/bundle/.next/server/middleware.js +1 -1
- package/bundle/.next/server/pages/404.html +1 -1
- package/bundle/.next/server/pages/500.html +1 -1
- package/bundle/.next/static/chunks/7442-f5f805e43da2c5b6.js +188 -0
- package/bundle/.next/static/css/7b10ac9fa66d7c17.css +3 -0
- package/bundle/server.js +1 -1
- package/package.json +1 -1
- package/bundle/.next/server/chunks/3816.js +0 -280
- package/bundle/.next/static/chunks/7442-edd29c3664c12f82.js +0 -188
- package/bundle/.next/static/css/91a0269a0b865189.css +0 -3
- /package/bundle/.next/static/{iPRBqdKl76C39456l6e-i → uAxTxVvm7tdXyEJ7SnLpD}/_buildManifest.js +0 -0
- /package/bundle/.next/static/{iPRBqdKl76C39456l6e-i → uAxTxVvm7tdXyEJ7SnLpD}/_ssgManifest.js +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";exports.id=7639,exports.ids=[7639],exports.modules={9738:(a,b,c)=>{c.d(b,{ET:()=>x,Ey:()=>z,Fq:()=>r,Hc:()=>s,K$:()=>G,Lw:()=>p,MV:()=>j,Ni:()=>L,OG:()=>y,PJ:()=>u,Pz:()=>q,W5:()=>A,XE:()=>t,YM:()=>B,Yr:()=>H,bQ:()=>D,eR:()=>E,fK:()=>n,hN:()=>M,kI:()=>m,qN:()=>w,x7:()=>C,xP:()=>F});var d=c(15612),e=c(14853),f=c(93628);let g={founder:"Founder",product:"Product Lead",architect:"System Architect",ops:"Operations",growth:"Growth",reviewer:"Reviewer"},h={small:{label:"Small",agentCount:1,workflowCount:1,automationCount:0,externalChannelCount:0,confirmationLimit:1,suggestedReplyLimit:2},medium:{label:"Medium",agentCount:3,workflowCount:3,automationCount:1,externalChannelCount:0,confirmationLimit:2,suggestedReplyLimit:3},large:{label:"Large",agentCount:5,workflowCount:4,automationCount:2,externalChannelCount:1,confirmationLimit:3,suggestedReplyLimit:4}},i={workspaceOnly:!0,generateStarterDocs:!1,generateMemory:!1,kickoffMission:!1};function j(a){return h[a]??h.medium}let k={internal:{label:"Internal",requiresCredentials:!1,credentials:[]},slack:{label:"Slack",requiresCredentials:!0,credentials:[{key:"botToken",label:"Bot token",placeholder:"xoxb-...",secret:!0}]},telegram:{label:"Telegram",requiresCredentials:!0,credentials:[{key:"token",label:"Bot token",placeholder:"123456:ABC...",secret:!0}]},discord:{label:"Discord",requiresCredentials:!0,credentials:[{key:"token",label:"Bot token",placeholder:"Discord bot token",secret:!0}]},googlechat:{label:"Google Chat",requiresCredentials:!0,credentials:[{key:"webhookUrl",label:"Webhook URL",placeholder:"https://chat.googleapis.com/...",secret:!0}]}};function l(){return globalThis.crypto?.randomUUID?.()??`plan-${Date.now()}`}function m(a,b,c){return{id:l(),role:a,author:b,text:c,createdAt:new Date().toISOString()}}function n(a){return{id:a.id?.trim()||l(),kind:a.kind,label:a.label.trim(),summary:a.summary.trim(),details:$(a.details),status:a.status??"ready",createdAt:a.createdAt??new Date().toISOString(),confidence:"number"==typeof a.confidence?Math.max(0,Math.min(100,Math.round(a.confidence))):void 0,url:Z(a.url),error:Z(a.error)}}function o(a){return{id:a.id?.trim()||l(),section:a.section,label:a.label.trim(),value:a.value.trim(),confidence:Math.max(0,Math.min(100,Math.round(a.confidence??72))),status:a.status??"inferred",rationale:Y(a.rationale??""),sourceLabels:$(a.sourceLabels)}}function p(a){let b=ac(a?.id||a?.name||"operator")||"operator",c=a?.role?.trim()||"Operator",d=a?.name?.trim()||ad(b);return{id:b,role:c,name:d,purpose:a?.purpose?.trim()||`${d} owns ${c.toLowerCase()} execution and handoffs.`,enabled:a?.enabled!==!1,isPrimary:!!a?.isPrimary,emoji:a?.emoji?.trim(),theme:a?.theme?.trim(),skillId:a?.skillId?.trim(),modelId:a?.modelId?.trim(),policy:a?.policy??(0,f.g0)("worker"),heartbeat:a?.heartbeat??{enabled:!1},responsibilities:$(a?.responsibilities),outputs:$(a?.outputs),channelIds:$(a?.channelIds)}}function q(a){return{id:ac(a?.id||a?.name||`workflow-${Date.now()}`)||`workflow-${Date.now()}`,name:a?.name?.trim()||"New workflow",goal:a?.goal?.trim()||"",trigger:a?.trigger??"manual",ownerAgentId:a?.ownerAgentId?.trim(),collaboratorAgentIds:$(a?.collaboratorAgentIds),successDefinition:a?.successDefinition?.trim()||"",outputs:$(a?.outputs),channelIds:$(a?.channelIds),enabled:a?.enabled!==!1}}function r(a="internal",b){let c=k[a];return{id:ac(b?.id||b?.name||`${a}-${Date.now()}`)||`${a}-${Date.now()}`,type:a,name:b?.name?.trim()||c.label,purpose:b?.purpose?.trim()||"",target:b?.target?.trim(),enabled:b?.enabled!==!1,announce:!!b?.announce,requiresCredentials:c.requiresCredentials,accountId:b?.accountId?.trim(),primaryAgentId:b?.primaryAgentId?.trim()??null,allowedChatIds:$(b?.allowedChatIds),groupAssignments:Array.isArray(b?.groupAssignments)?b.groupAssignments.map(a=>({chatId:"string"==typeof a.chatId?a.chatId.trim():"",agentId:"string"==typeof a.agentId?a.agentId.trim():null,title:"string"==typeof a.title?a.title.trim():null,enabled:!1!==a.enabled})).filter(a=>!!a.chatId):[],credentials:b?.credentials?.map(a=>({...a,value:a.value??""}))??c.credentials.map(a=>({...a,value:""}))}}function s(a){return{id:ac(a?.id||a?.name||`automation-${Date.now()}`)||`automation-${Date.now()}`,name:a?.name?.trim()||"New automation",description:a?.description?.trim()||"",enabled:a?.enabled!==!1,scheduleKind:a?.scheduleKind??"every",scheduleValue:a?.scheduleValue?.trim()||"24h",agentId:a?.agentId?.trim(),mission:a?.mission?.trim()||"",thinking:a?.thinking??"medium",announce:!!a?.announce,channelId:a?.channelId?.trim()}}function t(a){return{id:ac(a?.id||a?.name||`hook-${Date.now()}`)||`hook-${Date.now()}`,name:a?.name?.trim()||"New hook",source:a?.source?.trim()||"",enabled:a?.enabled!==!1,notes:a?.notes?.trim()||""}}function u(a){return{workspaceOnly:a?.workspaceOnly??!0,mode:a?.mode??"default",notes:$(a?.notes)}}function v(a){return{started:!!a?.started,initialPrompt:Y(a?.initialPrompt??""),latestPrompt:Y(a?.latestPrompt??""),sources:(a?.sources??[]).map(a=>n(a)),confirmations:$(a?.confirmations).map(a=>a.trim()).filter(Boolean).slice(0,3),mode:a?.mode==="advanced"?"advanced":"guided",size:a?.size==="small"||a?.size==="large"?a.size:"medium",reviewRequested:!!a?.reviewRequested,turnCount:Math.max(0,Math.floor(a?.turnCount??0)),inferences:(a?.inferences??[]).map(a=>o(a)),suggestedReplies:$(a?.suggestedReplies).slice(0,4)}}function w(a,b){let c=b?.architectSessionId?.trim()||`planner-${a}-architect`,d=Object.fromEntries(Object.entries(b?.advisorAgentIds??{}).filter(([,a])=>"string"==typeof a&&a.trim())),e=Object.fromEntries(Object.entries(g).map(([c])=>[c,b?.advisorSessionIds?.[c]?.trim()||`planner-${a}-${c}`]));return{mode:b?.mode==="fallback"?"fallback":"agent",status:b?.status==="error"?"error":b?.status==="ready"?"ready":"pending",workspaceId:Z(b?.workspaceId),workspacePath:Z(b?.workspacePath),architectAgentId:Z(b?.architectAgentId),architectSessionId:c,advisorAgentIds:d,advisorSessionIds:e,lastArchitectRunId:Z(b?.lastArchitectRunId),lastAdvisorRunIds:$(b?.lastAdvisorRunIds),lastError:Z(b?.lastError)}}function x(a,b){return(0,d.P0)(a,"core",b).map(b=>{var c,d,e,g,h,i,j;return p({id:b.id,role:b.role,name:b.name,purpose:(c=b.id,d=b.role,e=a,/review/i.test(c)||/review/i.test(d)?`Pressure-test ${e} work for correctness, regression risk, and missing validation.`:/test/i.test(c)||/test/i.test(d)?`Validate behavior, environment assumptions, and release confidence for this ${e} workspace.`:/learn/i.test(c)||/learn/i.test(d)?"Keep the workspace memory, conventions, and durable decisions coherent over time.":/browser/i.test(c)||/browser/i.test(d)?"Exercise real UI flows and collect evidence for browser-facing work.":`Own hands-on delivery and keep the ${e} workspace moving.`),enabled:b.enabled,isPrimary:b.isPrimary,emoji:b.emoji,theme:b.theme,skillId:b.skillId,modelId:b.modelId,policy:b.policy??(0,f.g0)("worker"),heartbeat:b.heartbeat??{enabled:!1},responsibilities:(g=b.id,h=a,/review/i.test(g)?["Review active work","Call out regressions","Protect launch quality"]:/test/i.test(g)?["Run verification loops","Capture evidence","Surface failing assumptions"]:/learn/i.test(g)?["Update durable memory","Track decisions","Reduce restart friction"]:/browser/i.test(g)?["Exercise flows","Capture screenshots","Validate responsive states"]:"content"===h?["Drive content production","Coordinate handoffs","Prepare launch artifacts"]:["Implement the next increment","Coordinate specialists","Keep execution momentum"]),outputs:(i=b.id,j=a,/review/i.test(i)?["review notes","risk checklist"]:/test/i.test(i)?["verification report","repro steps"]:/learn/i.test(i)?["memory updates","decision log entries"]:/browser/i.test(i)?["screenshots","browser validation notes"]:"research"===j?["research summary","evidence log"]:["implementation artifacts","handoff summary"])})})}function y(a,b){let c=b.find(a=>a.enabled&&a.isPrimary)?.id,d=W(b,"review"),e=W(b,"test"),f=W(b,"learn"),g=W(b,"browser");if("research"===a)return[q({id:"research-loop",name:"Research loop",goal:"Turn the main question into evidence-backed findings and explicit unknowns.",trigger:"manual",ownerAgentId:c,collaboratorAgentIds:[f,d].filter(Boolean),successDefinition:"Question, evidence, synthesis, and next-step recommendations are documented.",outputs:["docs/research-plan.md","deliverables/<run>/research-summary.md"]}),q({id:"finding-review",name:"Finding review",goal:"Pressure-test claims before publishing or acting on them.",trigger:"manual",ownerAgentId:d??c,collaboratorAgentIds:[c].filter(Boolean),successDefinition:"Assumptions, risks, and evidence gaps are explicit.",outputs:["deliverables/<run>/review-notes.md"]})];if("content"===a)return[q({id:"strategy",name:"Strategy and briefing",goal:"Clarify audience, offer, channels, and campaign bets before production.",trigger:"manual",ownerAgentId:c,collaboratorAgentIds:[d,f].filter(Boolean),successDefinition:"The team agrees on brief, priorities, and success signals.",outputs:["docs/content-brief.md","deliverables/<run>/campaign-brief.md"]}),q({id:"production",name:"Production and QA",goal:"Create assets, review them, and prepare a launch package.",trigger:"manual",ownerAgentId:c,collaboratorAgentIds:[d].filter(Boolean),successDefinition:"Assets are approved and delivery-ready.",outputs:["deliverables/<run>/drafts/","deliverables/<run>/launch-package.md"]}),q({id:"performance-loop",name:"Performance loop",goal:"Review outcomes, learn from results, and feed the next iteration.",trigger:"cron",ownerAgentId:f??d??c,collaboratorAgentIds:[c].filter(Boolean),successDefinition:"Measured results and next changes are documented.",outputs:["deliverables/<run>/performance-review.md"]})];let h=g&&"frontend"===a?g:c;return[q({id:"scope-v1",name:"V1 shaping",goal:"Turn the product goal into a constrained first delivery batch.",trigger:"manual",ownerAgentId:c,collaboratorAgentIds:[f,d].filter(Boolean),successDefinition:"Scope, non-goals, and critical path are documented.",outputs:["docs/brief.md","memory/blueprint.md"]}),q({id:"delivery",name:"Delivery loop",goal:"Implement, validate, and hand off the next meaningful increment.",trigger:"manual",ownerAgentId:h,collaboratorAgentIds:[e,d].filter(Boolean),successDefinition:"A tested increment ships with review notes and clear handoff.",outputs:["deliverables/<run>/release-notes.md","deliverables/<run>/verification.md"]}),q({id:"launch-readiness",name:"Launch readiness",goal:"Check blockers, rollback posture, and communication before launch.",trigger:"launch",ownerAgentId:d??c,collaboratorAgentIds:[e,f].filter(Boolean),successDefinition:"Launch risks, open blockers, and go/no-go signal are explicit.",outputs:["deliverables/<run>/launch-checklist.md"]})]}function z(){return[r("internal",{id:"internal-ops",name:"Internal ops",purpose:"Default internal coordination surface for planner outputs and deploy notes.",announce:!1})]}function A(a,b,c){let d=W(b,"review")??b.find(a=>a.enabled)?.id,e=W(b,"learn")??d,f=c[0]?.id;return[s({id:"daily-triage",name:"Daily triage",description:"Review drift, blockers, and next handoffs every day.",scheduleKind:"every",scheduleValue:"24h",agentId:d,mission:"content"===a?"Review active campaigns, blockers, and next content handoffs. Leave a concise operator brief.":"Inspect the workspace, surface blockers, and leave a concise next-step handoff for the team.",thinking:"medium",channelId:f}),s({id:"weekly-review",name:"Weekly review",description:"Capture progress, decisions, and next bets once per week.",scheduleKind:"every",scheduleValue:"168h",agentId:e,mission:"research"===a?"Summarize evidence gathered this week, open questions, and the next investigation batch.":"Summarize progress, major decisions, and the next delivery batch for this workspace.",thinking:"high",channelId:f})].filter(a=>a.agentId)}function B(){return[t({id:"handoff-audit",name:"Handoff audit",source:"workspace manifest",enabled:!0,notes:"Keep delivery artifacts and handoffs durable enough for other agents to continue."})]}function C(a=l()){let b=new Date().toISOString(),c="software",e=x(c),f=z();return E({id:a,status:"draft",stage:"intake",createdAt:b,updatedAt:b,autopilot:!0,readinessScore:0,architectSummary:"",runtime:w(a),intake:v(),company:{name:"",type:"saas",mission:"",targetCustomer:"",constraints:[],successSignals:[]},product:{offer:"",scopeV1:[],nonGoals:[],revenueModel:"",launchPriority:[]},workspace:{name:"",sourceMode:"empty",template:c,modelProfile:"balanced",stackDecisions:[],docs:(0,d.GH)(c,i),docOverrides:[],rules:{...i}},team:{persistentAgents:e,allowEphemeralSubagents:!0,maxParallelRuns:4,escalationRules:["Escalate ambiguous product decisions to the architect before implementation.","Escalate missing tooling or blocked environments before the delivery workflow starts.","Escalate launch blockers when review or verification fails."]},operations:{workflows:y(c,e),channels:f,automations:A(c,e,f),hooks:B(),sandbox:u({workspaceOnly:!0,mode:"default",notes:["Keep file work grounded in the target workspace by default."]})},deploy:{blockers:[],warnings:[],firstMissions:[],createdAgentIds:[],provisionedChannels:[],provisionedAutomations:[],kickoffRunIds:[]},conversation:[m("assistant","Workspace Architect","Tell me the project in one prompt. I will infer the workspace shape, draft a full first pass, and you can revise anything as many times as you want.")],advisorNotes:[]})}function D(a,b){let c=ab(a),e=x(b,c.workspace.name),f=c.operations.channels.length?c.operations.channels:z();return c.workspace.template=b,c.workspace.docs=(0,d.GH)(b,c.workspace.rules),c.team.persistentAgents=e,c.operations.workflows=y(b,e),c.operations.automations=A(b,e,f),E(c)}function E(a){var b,c,f,g,h,i,k,l,m,n,B,C,D,E,F,G,H,M,Q,R,S,T,_,ac,ae,af,ag;let ah,ai,aj,ak,al,am,an,ao,ap,aq,ar,as,at,au,av,aw,ax,ay=ab(a),az=ay.intake.sources.some(a=>"workspace-edit-source"===a.id);if(ay.runtime=w(ay.id,ay.runtime),ay.intake=v({...ay.intake,started:!!ay.intake?.started||ay.conversation.some(a=>"user"===a.role)}),ay.company.name=Y(ay.company.name),ay.company.mission=Y(ay.company.mission),ay.company.targetCustomer=Y(ay.company.targetCustomer),ay.company.constraints=$(ay.company.constraints),ay.company.successSignals=$(ay.company.successSignals),ay.product.offer=Y(ay.product.offer),ay.product.scopeV1=$(ay.product.scopeV1),ay.product.nonGoals=$(ay.product.nonGoals),ay.product.revenueModel=Y(ay.product.revenueModel),ay.product.launchPriority=$(ay.product.launchPriority),ay.workspace.name=Y(ay.workspace.name),ay.workspace.directory=Z(ay.workspace.directory),ay.workspace.repoUrl=Z(ay.workspace.repoUrl),ay.workspace.existingPath=Z(ay.workspace.existingPath),ay.workspace.stackDecisions=$(ay.workspace.stackDecisions),ay.workspace.docs=aa($(ay.workspace.docs).concat((0,d.GH)(ay.workspace.template,ay.workspace.rules))),ay.workspace.docOverrides=(0,e.Iy)(ay.workspace.docOverrides),ay.team.persistentAgents=ay.team.persistentAgents.map(a=>p({...a,id:a.id,role:a.role,name:a.name,purpose:a.purpose,enabled:a.enabled,isPrimary:a.isPrimary,emoji:a.emoji,theme:a.theme,skillId:a.skillId,modelId:a.modelId,policy:a.policy,heartbeat:a.heartbeat,responsibilities:a.responsibilities,outputs:a.outputs})).filter((a,b,c)=>c.findIndex(b=>b.id===a.id)===b),az){if(!ay.team.persistentAgents.some(a=>a.enabled&&a.isPrimary)){let a=ay.team.persistentAgents.find(a=>a.enabled);a&&(a.isPrimary=!0)}}else{let a,b;if(0===ay.team.persistentAgents.length&&(ay.team.persistentAgents=x(ay.workspace.template,ay.workspace.name)),!ay.team.persistentAgents.some(a=>a.enabled&&a.isPrimary)){let a=ay.team.persistentAgents.find(a=>a.enabled);a&&(a.isPrimary=!0)}let e=ay.team.persistentAgents.find(a=>a.enabled&&a.isPrimary);e&&ay.workspace.name&&(c=e.name,f=e.role,a=c.trim().toLowerCase(),b=f.trim().toLowerCase(),!a||"default agent"===a||a===b||"primary agent"===a||"workspace agent"===a)&&(e.name=(0,d.sg)(ay.workspace.name,e.role,e.name))}ay.operations.channels=ay.operations.channels.map(a=>r(a.type,a)).filter((a,b,c)=>c.findIndex(b=>b.id===a.id)===b),az||0!==ay.operations.channels.length||(ay.operations.channels=z()),ay.operations.workflows=ay.operations.workflows.map(a=>q(a)).filter((a,b,c)=>c.findIndex(b=>b.id===a.id)===b),az||0!==ay.operations.workflows.length||(ay.operations.workflows=y(ay.workspace.template,ay.team.persistentAgents)),ay.operations.automations=ay.operations.automations.map(a=>s(a)).filter((a,b,c)=>c.findIndex(b=>b.id===a.id)===b),az||(aw=j((av=ab(ay)).intake.size),av.team.persistentAgents=function(a,b,c){var d;let e,f;if(c<=0)return[];return X((f=(d=[...b,...x(a),...(e=p({id:"ops-lead",role:"Operations Lead",name:"Operations Lead",purpose:"Own automations, reporting cadence, and cross-agent handoffs for the workspace.",responsibilities:["Maintain the operating cadence","Wire recurring automations","Keep handoffs durable"],outputs:["ops brief","automation notes"]}),"research"===a?[p({id:"analyst",role:"Analyst",name:"Analyst",purpose:"Turn gathered evidence into patterns, themes, and decision-ready summaries.",responsibilities:["Cluster findings","Spot repeated signals","Prepare concise summaries"],outputs:["insight summary","theme map"]}),e]:[e])]).find(a=>a.isPrimary)??d[0])?[f,...d.filter(a=>a.id!==f.id)]:d).slice(0,c).map((a,b)=>p({...a,enabled:!0,isPrimary:a.isPrimary||0===b}))}(av.workspace.template,av.team.persistentAgents,aw.agentCount),av.operations.channels=function(a,b,c){let d=b.find(a=>"internal"===a.type)??z()[0],e=[...b.filter(a=>"internal"!==a.type),...("content"===a?["telegram","discord","slack"]:["slack","discord","telegram"]).map(b=>r(b,{id:`${b}-ops`,purpose:"content"===a?"Optional distribution or community surface for a larger operating setup.":"Optional external operating surface for a larger workspace.",enabled:!1,announce:!0}))].filter((a,b,c)=>c.findIndex(b=>b.type===a.type)===b);return[r("internal",{...d,enabled:!0}),...e.slice(0,c)]}(av.workspace.template,av.operations.channels,aw.externalChannelCount),av.operations.workflows=function(a,b,c,d){let e,f,g,h;return d<=0?[]:X([...b,...y(a,c),...(e=c.find(a=>a.enabled&&a.isPrimary)?.id,f=W(c,"review"),g=W(c,"learn"),h=W(c,"ops"),[q({id:"context-sync",name:"research"===a?"Evidence sync":"Context sync",goal:"Pull new context from linked sources and keep the blueprint aligned with reality.",trigger:"manual",ownerAgentId:g??e,collaboratorAgentIds:[e,f].filter(Boolean),successDefinition:"New context is reflected in durable docs, scope, and decision notes.",outputs:["memory/blueprint.md","deliverables/<run>/context-sync.md"]}),q({id:"ops-rhythm",name:"Operating rhythm",goal:"Review handoffs, automations, and next-step ownership on a repeatable cadence.",trigger:"cron",ownerAgentId:h??f??g??e,collaboratorAgentIds:[e].filter(Boolean),successDefinition:"The workspace has a fresh operator brief and an explicit next batch of work.",outputs:["deliverables/<run>/ops-rhythm.md"]})])]).slice(0,d).map(a=>{var b,d;let e,f,g,h,i;return b=a,e=new Set((d=c).filter(a=>a.enabled).map(a=>a.id)),f=d.find(a=>a.enabled&&a.isPrimary)?.id,g=W(d,"review"),h=W(d,"learn"),i=b.ownerAgentId&&e.has(b.ownerAgentId)?b.ownerAgentId:g??h??f,q({...b,ownerAgentId:i,collaboratorAgentIds:b.collaboratorAgentIds.filter(a=>e.has(a)&&a!==i),enabled:!0})})}(av.workspace.template,av.operations.workflows,av.team.persistentAgents,aw.workflowCount),av.operations.automations=(g=av.workspace.template,h=av.operations.automations,i=av.team.persistentAgents,k=av.operations.channels,(l=aw.automationCount)<=0?[]:X([...h,...A(g,i,k)]).slice(0,l).map(a=>{var b,c,d;let e,f,g,h,j;return b=a,c=i,d=k,e=new Set(c.filter(a=>a.enabled).map(a=>a.id)),f=new Set(d.map(a=>a.id)),g=c.find(a=>a.enabled&&a.isPrimary)?.id,h=W(c,"review"),j=W(c,"learn"),s({...b,agentId:b.agentId&&e.has(b.agentId)?b.agentId:h??j??g,channelId:b.channelId&&f.has(b.channelId)?b.channelId:d[0]?.id,enabled:!0})})),ay=av),ay.operations.hooks=ay.operations.hooks.map(a=>t(a)).filter((a,b,c)=>c.findIndex(b=>b.id===a.id)===b),ay.operations.sandbox=u(ay.operations.sandbox),az||(ay.deploy.firstMissions=(ax=(b=ay).team.persistentAgents.find(a=>a.enabled&&a.isPrimary),aa([ax?"Inspect the new workspace, refine docs to match the blueprint, and break the first delivery batch into concrete tasks.":"",b.team.persistentAgents.find(a=>/review/i.test(a.role)&&a.enabled)?"Review the blueprint against the created workspace, call out execution risks, and leave a launch-readiness checklist.":"",b.team.persistentAgents.find(a=>/learn/i.test(a.role)&&a.enabled)?"Capture durable facts, decisions, and conventions in memory files so the team can continue without drift.":""].filter(Boolean))));let aA=U(ay.company.name),aB=U(ay.workspace.name);if((!ay.company.name||aA)&&ay.workspace.name&&!aB&&(ay.company.name=ay.workspace.name),(!ay.workspace.name||aB)&&ay.company.name&&!aA&&(ay.workspace.name=ay.company.name),!ay.intake.started)return ay.deploy.blockers=[],ay.deploy.warnings=[],ay.intake.confirmations=[],ay.intake.inferences=[],ay.intake.suggestedReplies=[],ay.readinessScore=0,ay.architectSummary="Start with one prompt. Paste the project goal, website URL, repo, or existing folder and the architect will draft the workspace for you.",ay.stage="intake",ay.status="draft",ay.updatedAt=new Date().toISOString(),ay;let aC=function(a){let b=[],c=j(a.intake.size);for(let c of a.intake.sources.filter(a=>"error"===a.status))b.push("tr"===L(a)?`${c.label} kaynağını inceleyemedim. Bu kaynak \xf6nemliyse şirket bağlamını manuel olarak doğrula.`:`I could not inspect ${c.label}. Confirm the company context manually if this source matters.`);return aa(b).slice(0,c.confirmationLimit)}(ay),aD=function(a){let b=[];for(let c of(a.company.name||b.push("Company or workspace name is missing."),a.company.mission||b.push("Mission is missing."),a.company.targetCustomer||b.push("Target customer is missing."),a.workspace.name||b.push("Workspace name is missing."),"clone"!==a.workspace.sourceMode||a.workspace.repoUrl||b.push("Clone mode needs a repository URL."),"existing"!==a.workspace.sourceMode||a.workspace.existingPath||b.push("Existing-folder mode needs a folder path."),a.team.persistentAgents.some(a=>a.enabled)||b.push("At least one persistent agent must be enabled."),a.team.persistentAgents.some(a=>a.enabled&&a.isPrimary)||b.push("One enabled agent must be marked as primary."),a.operations.workflows.some(a=>a.enabled)||b.push("At least one enabled workflow is required."),a.operations.workflows.filter(a=>a.enabled)))c.name&&c.goal&&c.successDefinition||b.push(`Workflow "${c.name||c.id}" is incomplete.`),c.ownerAgentId&&!a.team.persistentAgents.some(a=>a.id===c.ownerAgentId&&a.enabled)&&b.push(`Workflow "${c.name}" points to a missing or disabled owner agent.`);for(let c of a.operations.automations.filter(a=>a.enabled))c.mission&&c.scheduleValue||b.push(`Automation "${c.name}" is incomplete.`),c.agentId&&!a.team.persistentAgents.some(a=>a.id===c.agentId&&a.enabled)&&b.push(`Automation "${c.name}" points to a missing or disabled agent.`);for(let c of a.operations.channels.filter(a=>a.enabled&&a.requiresCredentials))c.credentials.filter(a=>!a.value.trim()).length>0&&b.push(`Channel "${c.name}" is missing required credentials.`);return aa(b)}(ay),aE=(ah=[],ai=j((m=ay).intake.size),0===m.product.nonGoals.length&&ah.push("No non-goals are defined for V1."),0===m.product.launchPriority.length&&ah.push("Launch priorities are not ordered yet."),0===m.company.successSignals.length&&ah.push("Success signals are still empty."),0===m.workspace.stackDecisions.length&&"content"!==m.workspace.template&&ah.push("Critical stack decisions are not captured yet."),ai.automationCount>0&&!m.operations.automations.some(a=>a.enabled)&&ah.push("No automation loops are enabled."),ai.externalChannelCount>0&&!m.operations.channels.some(a=>"internal"!==a.type)&&ah.push("Only internal channels are configured."),ai.agentCount>=3&&m.team.maxParallelRuns<2&&ah.push("Parallel run limit is conservative for a multi-agent workspace."),aa(ah)),aF=I(ay);return ay.intake.confirmations=aC,ay.intake.inferences=(aj=[],ak=(n=ay).intake.sources.filter(a=>"ready"===a.status).map(a=>a.label),al=n.intake.confirmations.join(" ").toLowerCase(),n.company.name&&aj.push(o({section:"company",label:"Company",value:n.company.name,confidence:O(n,"company-name"),status:P(al,"company"),rationale:ak.length>0?"Derived from linked context and the current brief.":"Derived from the current brief.",sourceLabels:ak})),n.company.mission&&aj.push(o({section:"company",label:"Mission",value:n.company.mission,confidence:O(n,"mission"),status:P(al,"outcome"),rationale:"Architect condensed the first business outcome from the request.",sourceLabels:ak})),n.company.targetCustomer&&aj.push(o({section:"company",label:"First audience",value:n.company.targetCustomer,confidence:O(n,"target-customer"),status:P(al,"audience"),rationale:"This is the current best guess for the first user or buyer segment.",sourceLabels:ak})),aj.push(o({section:"workspace",label:"Workspace type",value:ad(n.workspace.template),confidence:O(n,"template"),status:"inferred",rationale:"Template is inferred from the requested operating model and linked context.",sourceLabels:ak})),aj.push(o({section:"workspace",label:"Starting point",value:"clone"===n.workspace.sourceMode?n.workspace.repoUrl||"Clone an existing repository":"existing"===n.workspace.sourceMode?n.workspace.existingPath||"Attach an existing folder":"Start from scratch",confidence:O(n,"source-mode"),status:P(al,"start"),rationale:"This is how the workspace will be materialized when you deploy.",sourceLabels:ak})),n.product.offer&&aj.push(o({section:"product",label:"Offer",value:n.product.offer,confidence:O(n,"offer"),status:"inferred",rationale:"Architect turned the brief into a concrete operator-facing offer.",sourceLabels:ak})),(am=n.operations.channels.filter(a=>a.enabled&&"internal"!==a.type)).length>0&&aj.push(o({section:"operations",label:"External channels",value:am.map(a=>a.name).join(", "),confidence:O(n,"channels"),status:"inferred",rationale:"The request implies these operating channels should exist after deploy.",sourceLabels:ak})),(an=n.team.persistentAgents.find(a=>a.enabled&&a.isPrimary))&&aj.push(o({section:"team",label:"Primary operator",value:`${an.name} (${an.role})`,confidence:O(n,"team"),status:"inferred",rationale:"Architect drafted a primary agent to own the first delivery loop.",sourceLabels:ak})),(ao=n.operations.workflows.find(a=>a.enabled))&&aj.push(o({section:"operations",label:"First workflow",value:ao.name,confidence:O(n,"workflow"),status:"inferred",rationale:"This is the first operational loop the company would run after deploy.",sourceLabels:ak})),aj.slice(0,8)),ay.intake.suggestedReplies=(B=ay,C=aC,ap=L(B),aq=[],ar=j(B.intake.size),as=function(a){let b=a.intake.sources.filter(a=>"ready"===a.status).flatMap(a=>[a.label,a.summary,...a.details]).join(" ").toLowerCase();if(!b)return;let c=/\bweb3|onchain|crypto|blockchain|token\b/.test(b),d=/\bstartup|startups|founder|founders|business(?:es)?\b/.test(b),e=/\bcommunity|communities|member|members|holder|holders|nft|dao|governance\b/.test(b),f=/\bdeveloper|developers|builder|builders|engineer|engineers\b/.test(b),g=/\boperator|operators|moderator|moderators|admin|admins|ops\b/.test(b);return d&&e?c?"Web3 startups and token-led communities":"startups and their communities":d?c?"Web3 startups and founders":"startups and founders":e?c?"DAO, NFT, and Web3 communities":"community leads and members":f&&g?"developers and internal operators":f?"developers and technical teams":g?"internal operators and moderators":void 0}(B),at=J(B),B.company.targetCustomer||(as&&aq.push("tr"===ap?`İlk hedef kitle ${V(as)} gibi g\xf6r\xfcn\xfcyor.`:`The first audience looks like ${V(as)}.`),"content"===B.workspace.template?(aq.push("tr"===ap?"İlk kullanıcılar topluluk y\xf6neticileri ve moderat\xf6rler.":"The first users are community managers and moderators."),aq.push("tr"===ap?"İlk kullanıcılar daha hızlı moderasyon ve onboarding isteyen Telegram \xfcyeleri.":"The first users are Telegram members who need faster moderation and onboarding.")):aq.push("tr"===ap?"İlk kullanıcılar bu iş akışını her g\xfcn y\xfcr\xfcten operat\xf6rler.":"The first users are the operators running this workflow every day.")),B.company.mission||aq.push("tr"===ap?"İlk hedef, hacmi en y\xfcksek manuel iş akışını otomatikleştirmek.":"The first outcome is automating the highest-volume manual workflow."),!B.product.scopeV1.length&&B.company.mission&&B.company.targetCustomer&&aq.push("tr"===ap?"V1, genişlemeden \xf6nce en dar ama faydalı d\xf6ng\xfcy\xfc u\xe7tan uca \xe7\xf6zmeli.":"V1 should handle the narrowest useful loop end to end before we expand."),B.workspace.repoUrl||B.workspace.existingPath||N(B.intake.latestPrompt||B.intake.initialPrompt)||(aq.push("tr"===ap?"Şimdilik varsayılan bir başlangı\xe7la ilerleyelim; kaynak t\xfcr\xfcn\xfc daha sonra istediğin gibi revize edebiliriz.":"We can proceed with a default starting point and revise the source later if you want."),aq.push("tr"===ap?"Eğer bir repo ya da mevcut klas\xf6r istiyorsan sonraki mesajda sadece onu s\xf6ylemen yeterli.":"If you want a repo or existing folder, just say so in the next edit.")),0===B.company.successSignals.length&&B.intake.turnCount>=2&&aq.push("tr"===ap?"Başarı; daha az manuel iş, daha hızlı yanıt s\xfcreleri ve daha net bir operasyon ritmi demek.":"Success means less manual work, faster response times, and a clearer operating cadence."),0!==C.length||at||(aq.push("tr"===ap?"İstersen bu taslağı şimdi daha keskin hale getirebiliriz.":"If you want, we can tighten this draft right now."),aq.push("tr"===ap?"Gelişmiş edit\xf6r\xfc a\xe7.":"Open the advanced editor.")),aa(aq).slice(0,ar.suggestedReplyLimit)),ay.deploy.blockers=aF?aD:[],ay.deploy.warnings=aF?aE:[],ay.readinessScore=(D=ay,E=aD,F=aE,G=aF,au=14,D.company.name&&(au+=10),D.company.mission&&(au+=15),D.company.targetCustomer&&(au+=15),D.product.offer&&(au+=10),D.product.scopeV1.length>0&&(au+=10),D.workspace.name&&(au+=10),D.intake.sources.length>0&&(au+=6),D.team.persistentAgents.some(a=>a.enabled&&a.isPrimary)&&(au+=10),D.operations.workflows.some(a=>a.enabled)&&(au+=10),D.operations.automations.some(a=>a.enabled)&&(au+=5),G?(au-=12*E.length,au-=3*F.length):au-=4*Math.max(0,D.intake.confirmations.length-1),Math.max(0,Math.min(100,au))),ay.architectSummary=function(a,b,c,d){let e=L(a),f=J(a),g=K(a),h=a.team.persistentAgents.filter(a=>a.enabled).length,i=a.operations.workflows.filter(a=>a.enabled).length,j=a.operations.automations.filter(a=>a.enabled).length,k=a.intake.confirmations.length;if(!a.intake.started)return"tr"===e?"Tek mesajla başla.":"Start with one prompt.";if(!d&&f){let b=a.company.mission||a.product.offer||a.company.name||a.workspace.name,c="clone"===a.workspace.sourceMode?"tr"===e?"klon repo":"a cloned repo":"existing"===a.workspace.sourceMode?"tr"===e?"mevcut klas\xf6r":"an existing folder":"tr"===e?"sıfırdan":"scratch",d=!g||a.company.name||a.workspace.name?"":"tr"===e?`Site adı i\xe7in ${g.label} varsayımını kullandım.`:`I used ${g.label} as the site name.`;return"tr"===e?[d,b?`İlk taslak ${b} etrafında hazır.`:`İlk taslak ${c} başlangıcıyla hazır.`].filter(Boolean).join(" "):[d,b?`First pass ready around ${b}.`:`First pass ready from ${c}.`].filter(Boolean).join(" ")}return d?"tr"===e?[a.company.mission?`Odak: ${a.company.mission}.`:"Misyon kısa bir c\xfcmle istiyor.",a.company.targetCustomer?`Kitle: ${a.company.targetCustomer}.`:"Kitle a\xe7ık.",`${h} agent, ${i} g\xf6rev, ${j} automation.`,k>0?`${k} revizyon kaldı.`:b.length>0?`${b.length} blocker kaldı.`:c.length>0?`${c.length} warning var.`:"Deploy'a hazır."].join(" "):[a.company.mission?`Focus: ${a.company.mission}.`:"Mission still needs a short sentence.",a.company.targetCustomer?`Audience: ${a.company.targetCustomer}.`:"Audience open.",`${h} agents, ${i} workflows, ${j} automations.`,k>0?`${k} revision${1===k?"":"s"} left.`:b.length>0?`${b.length} blocker${1===b.length?"":"s"} remain.`:c.length>0?`${c.length} warning${1===c.length?"":"s"} remain.`:"Ready to deploy."].join(" "):"tr"===e?[a.company.mission?`Odak: ${a.company.mission}.`:a.company.name||a.workspace.name?`İlk \xe7ıktı: ${a.company.name||a.workspace.name}.`:"İlk \xe7ıktı netleşiyor.",a.company.targetCustomer?`Kitle: ${a.company.targetCustomer}.`:"Kitle a\xe7ık.",a.intake.sources.length>0?`${a.intake.sources.length} kaynak topladım.`:"URL, repo ya da kısa brief yeterli.",`${h} agent, ${i} g\xf6rev, ${j} automation.`,k>0?`${k} revizyon kaldı.`:"Revizyona hazır."].join(" "):[a.company.mission?`Focus: ${a.company.mission}.`:`First outcome: ${a.company.name||a.workspace.name||"this workspace"}.`,a.company.targetCustomer?`Audience: ${a.company.targetCustomer}.`:"Audience open.",a.intake.sources.length>0?`I have ${a.intake.sources.length} source${1===a.intake.sources.length?"":"s"}.`:"Add a URL, repo, or short brief.",`${h} agents, ${i} workflows, ${j} automations.`,k>0?`${k} revision${1===k?"":"s"} left.`:"Ready to revise."].join(" ")}(ay,aD,aE,aF),ay.stage=(H=ay,M=aD,Q=aE,R=aC,S=aF,H.intake.started?!S&&J(H)?H.intake.sources.length>0?"context-harvest":"intake":"deploying"===H.status?"deploying":"deployed"===H.status?"deployed":(T=H).company.mission||T.product.offer||T.workspace.name||T.intake.sources.length>0?((_=H).company.name||_.workspace.name)&&_.company.mission&&_.team.persistentAgents.some(a=>a.enabled)&&_.operations.workflows.some(a=>a.enabled)?S?M.length>0?"pressure-test":Q.length>0||H.readinessScore<90?"decision-lock":"ready":R.length>0?"team-synthesis":"decision-lock":"team-synthesis":H.intake.turnCount>1?"context-harvest":"intake":"intake"),ay.status=(ac=ay,ae=aD,af=aC,ag=aF,ac.intake.started?"deploying"===ac.status||"deployed"===ac.status?ac.status:ag?"blocked"===ac.status&&ae.length>0||ae.length>0?"blocked":ac.readinessScore>=90?"ready":"review":J(ac)||af.length>0?"draft":"review":"draft"),ay.updatedAt=new Date().toISOString(),ay}function F(a,b){var c,d,e,f,g,h,i,j,l;let m,n,o,q,t=ab(a),u=b.trim(),v=u.toLowerCase(),w=Array.from(new Set([...(c=u).match(/https?:\/\/[^\s)]+/g)??[],...c.match(/\b(?:www\.)?[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)+(?:\/[^\s)]*)?/gi)??[]].map(a=>(function(a){if(a.includes("@"))return null;let b=a.replace(/[),.;!?]+$/g,""),c=/^https?:\/\//i.test(b)?b:`https://${b}`;try{let a=new URL(c);return a.hostname.includes(".")?a.toString():null}catch{return null}})(a)).filter(a=>!!a))),x=w.find(a=>R(a)),y=w.find(a=>!R(a));t.intake.started=!0,t.intake.initialPrompt||(t.intake.initialPrompt=u),t.intake.latestPrompt=u,t.intake.turnCount+=1,/\b(advanced|detailed|full editor|geli[sş]mi[sş]|detayl[ıi]|ileri seviye)\b/.test(v)&&(t.intake.mode="advanced"),/\b(simple|keep it simple|guided|basit|sade|y[öo]nlendir)\b/.test(v)&&(t.intake.mode="guided"),/\b(review|deploy review|launch review|final review|go to deploy|deploye ge[cç]|reviewe ge[cç]|son kontrol)\b/.test(v)&&(t.intake.reviewRequested=!0),x&&(t.workspace.sourceMode="clone",t.workspace.repoUrl=x),/\b(existing folder|existing workspace|existing repo|mevcut klas[oö]r|mevcut workspace|mevcut repo)\b/.test(v)&&(t.workspace.sourceMode="existing"),/\b(empty workspace|from scratch|greenfield|s[ıi]f[ıi]rdan|bo[sş] workspace|bo[sş] proje)\b/.test(v)&&(t.workspace.sourceMode="empty");let z=(d=v,/\b(telegram|discord|community|topluluk|grup|channel automation|community ops)\b/.test(d)?"content":/\bfrontend\b|\bui\b|\bwebsite\b|\blanding page\b|\bdesign system\b/.test(d)?"frontend":/\bbackend\b|\bapi\b|\bservice\b|\bmicroservice\b/.test(d)?"backend":/\bresearch\b|\binvestigation\b|\banalysis\b|\bthesis\b/.test(d)?"research":/\bcontent\b|\bmarketing\b|\bgrowth\b|\bseo\b|\bnewsletter\b/.test(d)?"content":/\bsoftware\b|\bapp\b|\bweb app\b|\bmobile app\b/.test(d)?"software":null);if(z&&z!==t.workspace.template){let a=D(t,z);t.workspace=a.workspace,t.team=a.team,t.operations=a.operations,t.deploy.firstMissions=a.deploy.firstMissions}let A=(e=v,/\b(community|topluluk|telegram|discord)\b/.test(e)?"content-brand":/\bagency\b/.test(e)?"agency":/\bresearch\b|\blab\b/.test(e)?"research-lab":/\bcontent\b|\bmedia\b|\bnewsletter\b/.test(e)?"content-brand":/\binternal ops\b|\bops team\b/.test(e)?"internal-ops":/\bsaas\b|\bapp\b|\bweb app\b|\bmobile app\b/.test(e)?"saas":null);A&&(t.company.type=A);let B=(m=u.match(/["“]([^"”]+)["”]/),m?.[1]?.trim());B&&!t.workspace.name&&(t.workspace.name=B,t.company.name||(t.company.name=B));let C=Q(u,"workspace");C&&(t.workspace.name=C);let F=Q(u,"company");if(F&&(t.company.name=F,t.workspace.name||(t.workspace.name=F)),(!t.company.name||!t.workspace.name)&&y){let a=function(a){try{let[b]=new URL(a).hostname.replace(/^www\./,"").split(".");if(!b)return;return b.split(/[-_]+/g).filter(Boolean).map(a=>a.charAt(0).toUpperCase()+a.slice(1)).join(" ")}catch{return}}(y);a&&(t.company.name||(t.company.name=a),t.workspace.name||(t.workspace.name=a))}let G=u.match(/(?:for|serving|targeting|i[çc]in|hedef(?:imiz| kitlemiz)?|ilk kullan[ıi]c[ıi](?:lar)?|ilk m[üu][şs]teri(?:ler)?)\s+([^.!?\n]+)/i);if(G&&!t.company.targetCustomer){let a,b,c=!(a=T(G[S(G)]).replace(/^(?:yeni|bir|the|a|an|bir de|bide)\s+/i,"").replace(/\b(?:birlikte|ile|ve|veya)\b/gi," ").replace(/\b(?:olarak|diye|benim|bide)\b.*$/i,"").replace(/\s+/g," ").trim())||(b=a.toLowerCase(),/\b(yapal[ıi]m|ekleyelim|başlatal[ıi]m|kural[ıi]m|olsun|diyelim|verelim|koyal[ıi]m|kurmak|kurulum|oluşturmak|oluşturma|başlatmak|başlama|yapmak|yapma|istiyorum|istiyoruz|istemek|want|build|create|make|start|launch|setup|set up)\b/.test(b)||/\b(workspace|workspaces|workspace oluştur|workspace oluşturalım|workspace kur|workspace kuralım)\b/.test(b))?"":a;c&&(t.company.targetCustomer=c)}let H=u.match(/(?:goal|mission|we want to|build|create|amac[ıi]m[ıi]z|hedef(?:imiz)?|istiyoruz|yapmak istedi[ğg]imiz|kurmak istedi[ğg]imiz|olu[sş]turmak istedi[ğg]imiz)\s+([^.!?\n]+)/i);return H&&!t.company.mission&&(t.company.mission=T(H[S(H)])),f=t,g=v,["slack","telegram","discord","googlechat"].forEach(a=>{!g.includes("googlechat"===a?"google chat":a)||f.operations.channels.some(b=>b.type===a)||f.operations.channels.push(r(a,{name:k[a].label,purpose:"Team communication and announcements.",announce:!0}))}),function(a,b){let c=["must ","should ","cannot ","can't ","without ","need to ","olmalı","zorunda","gerek","yapmamalı","olmamalı"];for(let d of b.split(/[.!?\n]/).map(a=>a.trim()).filter(Boolean))c.some(a=>d.toLowerCase().includes(a))&&(a.company.constraints=aa([...a.company.constraints,d]))}(t,u),function(a,b,c){if(a.product.offer)return;let d=b.match(/(?:offer|product|service|platform|we are building|sunulan [şs]ey|[üu]r[üu]n|servis|platform)\s*(?:is|:)?\s*([^\n]+)/i);if(d){a.product.offer=T(d[S(d)]);return}/\btelegram\b/.test(c)&&/\b(group|community|grup|topluluk)\b/.test(c)&&(a.product.offer="Operate and automate the Telegram community experience.")}(t,u,v),h=t,(n=(i=u).match(/(?:scope|v1|mvp|kapsam|ilk s[üu]r[üu]m)\s*(?:is|:)?\s*([^\n]+)/i))&&(h.product.scopeV1=aa([...h.product.scopeV1,..._(n[S(n)])])),(o=i.match(/(?:non-goals?|not doing|yapmayaca[ğg][ıi]m[ıi]z [şs]eyler|kapsam d[ıi][şs][ıi])\s*(?:are|:)?\s*([^\n]+)/i))&&(h.product.nonGoals=aa([...h.product.nonGoals,..._(o[S(o)])])),(q=i.match(/(?:success|metric|north star|ba[sş]ar[ıi]|metrik)\s*(?:is|:)?\s*([^\n]+)/i))&&(h.company.successSignals=aa([...h.company.successSignals,..._(q[S(q)])])),j=t,l=v,/\b(şahsi asistan|kişisel asistan|personal assistant|executive assistant)\b/i.test(l)&&!j.team.persistentAgents.some(a=>/assistant/i.test(`${a.id} ${a.role} ${a.name}`))&&(j.team.persistentAgents=[p({id:"personal-assistant",role:"Personal Assistant",name:"Personal Assistant",purpose:"Own personal coordination, reminders, executive support, and operator handoffs.",responsibilities:["Track the operator's priorities and reminders","Prepare concise handoffs and action lists","Handle lightweight coordination and follow-through"],outputs:["daily brief","priority queue","assistant handoff"],enabled:!0}),...j.team.persistentAgents],"small"===j.intake.size?j.intake.size="medium":"medium"===j.intake.size&&(j.intake.size="large")),/\bdaily\b/.test(v)&&!t.operations.automations.some(a=>"daily-triage"===a.id)&&t.operations.automations.push(s({id:"daily-triage",name:"Daily triage",description:"Daily workspace review loop.",scheduleKind:"every",scheduleValue:"24h",agentId:t.team.persistentAgents.find(a=>a.enabled)?.id,mission:"Inspect the workspace, surface blockers, and leave the next handoff.",channelId:t.operations.channels[0]?.id})),/\bweekly\b/.test(v)&&!t.operations.automations.some(a=>"weekly-review"===a.id)&&t.operations.automations.push(s({id:"weekly-review",name:"Weekly review",description:"Weekly synthesis loop.",scheduleKind:"every",scheduleValue:"168h",agentId:t.team.persistentAgents.find(a=>/learn|review/i.test(a.role))?.id,mission:"Summarize progress, decisions, and next bets for the workspace.",thinking:"high",channelId:t.operations.channels[0]?.id})),E(t)}async function G(a){let b=new Date().toISOString(),c=a.deploy.blockers,d=a.deploy.warnings,e=a.operations.workflows.find(a=>a.enabled),f=a.team.persistentAgents.find(a=>a.enabled&&a.isPrimary);return[{advisorId:"founder",summary:a.company.mission&&a.company.targetCustomer?"Outcome and audience are present.":"The commercial story is still thin.",recommendations:[a.company.mission?`Mission: ${a.company.mission}`:"State the company mission in one sentence.",a.company.targetCustomer?`Target customer: ${a.company.targetCustomer}`:"Specify the first buyer or user segment.",a.product.revenueModel?`Revenue model: ${a.product.revenueModel}`:"Lock a revenue or value exchange model before launch."].filter(Boolean),concerns:a.company.successSignals.length>0?[]:["Success signals are still vague. Add measurable outcomes before deploy."]},{advisorId:"product",summary:a.product.scopeV1.length>0?`V1 scope includes ${a.product.scopeV1.length} focused items.`:"V1 scope is not explicit yet.",recommendations:[a.product.offer?`Offer: ${a.product.offer}`:"Describe the core offer or user promise.",a.product.scopeV1.length>0?`Current V1 scope: ${a.product.scopeV1.join(", ")}`:"Define a constrained V1 scope.",a.product.nonGoals.length>0?`Non-goals: ${a.product.nonGoals.join(", ")}`:"List non-goals to prevent scope creep."].filter(Boolean),concerns:a.operations.workflows.length>0?[]:["No delivery workflow is defined yet."]},{advisorId:"architect",summary:f&&e?`${f.name} can own ${e.name}.`:"Agent ownership and workflow design still need alignment.",recommendations:[`Workspace template: ${ad(a.workspace.template)}`,`Source mode: ${a.workspace.sourceMode}`,a.workspace.stackDecisions.length>0?`Stack decisions: ${a.workspace.stackDecisions.join(", ")}`:"Add the critical stack or platform decisions."].filter(Boolean),concerns:a.team.persistentAgents.some(a=>a.enabled)?[]:["No enabled agents remain in the deploy team."]},{advisorId:"ops",summary:a.operations.automations.length>0?`${a.operations.automations.length} automations are queued.`:"Operations loops are not configured yet.",recommendations:[a.operations.channels.some(a=>a.enabled)?`${a.operations.channels.filter(a=>a.enabled).length} channels are enabled.`:"Choose at least one channel or keep the team internal-only.",a.operations.automations.length>0?`Automations: ${a.operations.automations.map(a=>a.name).join(", ")}`:"Define daily or weekly maintenance loops.",`Sandbox mode: ${a.operations.sandbox.mode}`].filter(Boolean),concerns:c.length>0?c.slice(0,2):d.slice(0,2)},{advisorId:"growth",summary:a.operations.channels.some(a=>"internal"!==a.type&&a.enabled)?"External communication channels are in the plan.":"Go-to-market channels are still internal-only.",recommendations:[a.operations.channels.some(a=>"internal"!==a.type&&a.enabled)?`External channels: ${a.operations.channels.filter(a=>"internal"!==a.type&&a.enabled).map(a=>a.name).join(", ")}`:"Add Slack, Telegram, Discord, or Google Chat if the company needs external operating channels.",a.company.successSignals.length>0?`Success signals: ${a.company.successSignals.join(", ")}`:"Tie the launch to measurable success signals."].filter(Boolean),concerns:a.product.launchPriority.length>0?[]:["Launch priorities are not ordered yet."]},{advisorId:"reviewer",summary:0===c.length?"No hard deploy blockers remain.":`${c.length} deploy blocker${1===c.length?"":"s"} still need resolution.`,recommendations:[0===c.length?"You can move into final review.":`Resolve blockers: ${c.join(" | ")}`,0===d.length?"No major warnings were detected.":`Warnings: ${d.join(" | ")}`],concerns:c.length>0?c:d.slice(0,3)}].map(a=>{var c,d,e,f,h;return c=a.advisorId,d=a.summary,e=a.recommendations,f=a.concerns,h=b,{id:l(),advisorId:c,advisorName:g[c],summary:d,recommendations:$(e),concerns:$(f),createdAt:h}})}function H(a,b,c,d){let e=L(a,c);if(!a.intake.started)return m("assistant","Workspace Architect","tr"===e?"Projeyi tek mesajda anlat. Bir website URL'si, repo URL'si ya da mevcut klas\xf6r yolu yapıştır; workspace taslağını \xe7ıkarırım ve istediğin kadar revize edebiliriz.":"Describe the project in one prompt. You can paste a website URL, repo URL, or an existing folder path and I will draft the workspace, then we can revise it as many times as needed.");let f=I(a),g=f?a.deploy.blockers:[],h=J(a),i=a.intake.confirmations.slice(0,2).map(a=>{var b;return b=a,"tr"!==e?b:b.replace("What should I call the company or workspace?","Şirkete ya da workspace'e ne ad verelim?").replace("What exact outcome should this workspace optimize for first?","Bu workspace \xf6nce tam olarak hangi \xe7ıktıyı optimize etmeli?").replace("Should this start from scratch, clone a repo, or attach an existing folder?","Buna sıfırdan mı başlayalım, bir repo mu klonlayalım, yoksa mevcut bir klas\xf6r\xfc m\xfc bağlayalım?").replace("What is the smallest V1 outcome we should launch first?","İlk \xe7ıkaracağımız en k\xfc\xe7\xfck V1 sonucu ne olmalı?").replace("What should stay explicitly out of scope for V1?","V1 i\xe7in neleri \xf6zellikle kapsam dışında bırakalım?").replace("What signal should tell us this workspace is working?","Bu workspace'in işe yaradığını bize hangi sinyal g\xf6stermeli?").replace("Who is the first user or customer segment?","İlk kullanıcı ya da m\xfcşteri segmenti kim?")}),j=a.intake.inferences.slice(0,h?3:4).map(a=>`${a.label}: ${a.value}`),k=a.intake.sources.slice(Math.max(0,a.intake.sources.length-2)).map(a=>`${a.label} (${"ready"===a.status?a.kind:`${a.kind}, needs confirmation`})`),l=b.flatMap(a=>a.recommendations.slice(0,1)).slice(0,f?2:1),n=h?[]:l,o=K(a),p=function(a,b){var c;if(!a)return[];let d=[];if(a.company.name!==b.company.name&&b.company.name&&d.push(`Company name is now ${b.company.name}.`),a.workspace.name!==b.workspace.name&&b.workspace.name&&d.push(`Workspace name is now ${b.workspace.name}.`),a.company.mission!==b.company.mission&&b.company.mission&&d.push(`First outcome is ${b.company.mission}.`),a.company.targetCustomer!==b.company.targetCustomer&&b.company.targetCustomer&&d.push(`First audience is ${b.company.targetCustomer}.`),a.product.offer!==b.product.offer&&b.product.offer&&d.push(`Core offer is ${b.product.offer}.`),a.workspace.sourceMode!==b.workspace.sourceMode&&d.push(`Starting point is ${"clone"===(c=b.workspace.sourceMode)?"clone an existing repository":"existing"===c?"attach an existing folder":"start from scratch"}.`),a.intake.sources.length!==b.intake.sources.length){let c=b.intake.sources.length-a.intake.sources.length;c>0&&d.push(`Added ${c} new context source${1===c?"":"s"}.`)}return d}(d,a),q=(c||"").toLowerCase(),r=/\b(eksik|eksikleri|missing|what'?s missing|neler eksik)\b/.test(q),s=/\b(siteden|site(?:den)?|website|from the site|from the website|çıkar|extract|infer)\b/.test(q);return m("assistant","Workspace Architect",[h&&o&&!a.company.name&&!a.workspace.name?"tr"===e?`Site adını ${o.label} olarak ge\xe7ici varsayım kabul ettim.`:`I treated the site name as ${o.label} for now.`:"",p.length>0?"tr"===e?"Son y\xf6nlendirmene g\xf6re taslağı g\xfcncelledim.":`Applied: ${p.join(" ")}`:h?"tr"===e?"İlk mesajdan niyeti \xe7ıkardım; tam bir ilk taslak oluşturdum ve onu istediğin kadar revize edebiliriz.":"I pulled the intent from your first message, drafted a full first pass, and we can revise it as many times as you want.":"tr"===e?"Taslağı son y\xf6nlendirmene g\xf6re g\xfcncelledim.":"I updated the draft with your latest direction.",k.length>0?"tr"===e?`Kullandığım bağlam: ${k.join(" \xb7 ")}.`:`Context in play: ${k.join(" \xb7 ")}.`:"",j.length>0?"tr"===e?`Şu anki taslak: ${j.join(" | ")}.`:`Current draft: ${j.join(" | ")}.`:"",n.length>0&&!f?"tr"===e?`Arka plan taslağı: ${n.join(" ")}`:`Background draft: ${n.join(" ")}`:"",s&&i.length>0?"tr"===e?`Bağlı kaynaktan \xe7ıkarabildiğim her alanı doldurdum. Sayfa şu noktaları h\xe2l\xe2 belirsiz bırakıyor: ${i.join("; ")}.`:`I filled what I could from the linked context. The page still leaves these items ambiguous: ${i.join("; ")}.`:r&&i.length>0?"tr"===e?`H\xe2l\xe2 eksik ya da d\xfcş\xfck g\xfcvenli noktalar: ${i.join("; ")}.`:`Still missing or low-confidence: ${i.join("; ")}.`:!f&&i.length>0?1===i.length?"tr"===e?`Sıradaki tek not şu: ${i[0]}`:`I still have one unresolved note: ${i[0]}`:"tr"===e?`Sıradaki iki not şu: ${i[0]} Sonra ${V(i[1])}`:`I still have two unresolved notes: ${i[0]} Then ${V(i[1])}`:f&&i.length>0?"tr"===e?`Deploy \xf6ncesi şu notları ele alalım: ${i.join("; ")}.`:`Before deploy, address: ${i.join("; ")}.`:g.length>0?"tr"===e?`DEPLOY \xf6ncesi h\xe2l\xe2 şunlara ihtiyacım var: ${g.join("; ")}.`:`Before DEPLOY I still need: ${g.join("; ")}.`:f?"tr"===e?"Blueprint yapısal olarak DEPLOY i\xe7in hazır. Uyarıları bir kez g\xf6zden ge\xe7irip ardından launch edebiliriz.":"Blueprint is structurally ready for DEPLOY. Review warnings once, then launch.":"tr"===e?"Taslak hazır ve revize edilmeye a\xe7ık. İstersen şimdi gelişmiş edit\xf6r\xfc a\xe7ayım ya da devam eden değişiklikleri birlikte yapalım.":"The draft is ready and open for revision. If you want, I can open the advanced editor or keep iterating with you.",c&&0===p.length&&!h?"tr"===e?`Son y\xf6nlendirmeyi kaydettim: "${c.trim()}".`:`Latest direction captured: "${c.trim()}".`:""].filter(Boolean).join("\n\n"))}function I(a){return a.intake.reviewRequested||"deploying"===a.status||"deployed"===a.status}function J(a){return a.intake.turnCount<=1&&!a.intake.reviewRequested}function K(a){return a.intake.sources.find(a=>"website"===a.kind&&"ready"===a.status&&"number"==typeof a.confidence&&a.confidence<80&&!!a.label)}function L(a,b){for(let c of[b,...a.conversation.slice().reverse().filter(a=>"user"===a.role).map(a=>a.text),a.intake.latestPrompt,a.intake.initialPrompt]){let a=M(c);if(a)return a}return"en"}function M(a){return!function(a){let b=a?.trim();if(!b)return!1;if(/[çğıöşüÇĞİÖŞÜ]/.test(b))return!0;let c=b.toLowerCase().match(/\b(ve|bir|bu|şu|için|ile|olarak|olan|mı|mi|mu|mü|ne|nasıl|hangi|neden|hedef|ilk|müşteri|kullanıcı|oluştur|gerekli|alanları|yardımcı)\b/g);return!!(c&&c.length>=2)}(a)?!function(a){let b=a?.trim();if(!b||/[çğıöşüÇĞİÖŞÜ]/.test(b))return!1;let c=b.toLowerCase().match(/\b(let'?s|the|and|for|with|from|this|that|what|how|why|when|where|who|should|could|would|need|want|start|build|create|launch|project|workspace|customer|user|team|goal|mission|review|deploy|product|website|repo|folder)\b/g);return!!(c&&c.length>=2)}(a)?null:"en":"tr"}function N(a){return/\b(from scratch|greenfield|empty workspace|clone|repo|existing folder|existing workspace|s[ıi]f[ıi]rdan|mevcut klas[oö]r|mevcut repo|bo[sş])\b/i.test(a)}function O(a,b){let c=`${a.intake.initialPrompt} ${a.intake.latestPrompt}`.toLowerCase(),d=a.intake.sources.filter(a=>"ready"===a.status),e=66;return d.length>0&&(e+=8),a.intake.turnCount>1&&(e+=6),("template"===b&&/\b(telegram|discord|community|topluluk|grup|content|marketing|research|frontend|backend)\b/.test(c)||"source-mode"===b&&N(c)||"channels"===b&&/\b(slack|telegram|discord|google chat)\b/.test(c))&&(e+=10),"company-name"===b&&d.some(a=>"website"===a.kind)&&(e+=6),"target-customer"!==b||a.company.targetCustomer||(e-=18),("workflow"===b||"team"===b)&&(e-=4),Math.max(52,Math.min(96,e))}function P(a,b){return a.includes(b)?"needs-confirmation":"inferred"}function Q(a,b){let c="workspace"===b?["workspace","workspace name","project","project name","proje","proje adı","proje ismi"]:["company","company name","firma","firma adı","şirket","şirket adı","company name"],d=["name","adı","adını","ismi","ismini"],e=["is","should be","=",":","olsun","diyelim","verelim","koyalım","yap","yapalım","değiştir","değiştirelim","olarak ayarla"];for(let b of[RegExp(`\\b(?:${c.join("|")})\\b\\s+(?:${d.join("|")})\\s*(?:${e.join("|")})?\\s*([\\p{L}\\p{N}][\\p{L}\\p{N}._ -]{1,40}(?:\\s+[\\p{L}\\p{N}][\\p{L}\\p{N}._ -]{1,40}){0,2})(?=\\s+(?:${e.join("|")}|olarak|i\xe7in)\\b|[.!?,]|$)`,"iu"),RegExp(`\\b(?:${d.join("|")})\\b\\s*(?:of\\s+)?(?:${c.join("|")})?\\s*(?:${e.join("|")})?\\s*([\\p{L}\\p{N}][\\p{L}\\p{N}._ -]{1,40}(?:\\s+[\\p{L}\\p{N}][\\p{L}\\p{N}._ -]{1,40}){0,2})(?=\\s+(?:${e.join("|")}|olarak|i\xe7in)\\b|[.!?,]|$)`,"iu"),RegExp(`\\b(?:${c.join("|")})\\b\\s+(?:${d.join("|")})\\s+(?:${e.join("|")})\\s+([\\p{L}\\p{N}][\\p{L}\\p{N}._ -]{1,40}(?:\\s+[\\p{L}\\p{N}][\\p{L}\\p{N}._ -]{1,40}){0,2})(?=\\s+(?:olarak|i\xe7in)\\b|[.!?,]|$)`,"iu")]){let c=function(a){let b=T(a).replace(/\b(projesi|projesini|workspace|project|company|firma|şirket)\b/gi," ").replace(/\b(yapal[ıi]m|ekleyelim|kural[ıi]m|başlatal[ıi]m|olsun|diyelim|verelim|koyal[ıi]m|kurmak|kurulum|oluşturmak|oluşturma|başlatmak|başlama|yapmak|yapma|istiyorum|istiyoruz|istemek|want|build|create|make|start|launch|setup|set up)\b/gi," ").replace(/\b(yeni|bir)\b/gi," ").replace(/\b(diye|olarak|benim|bide|bir de|için)\b.*$/i,"").replace(/\s+/g," ").trim();return!b||U(b)?"":b}(a.match(b)?.[1]?.trim()??"");if(c)return c}}function R(a){try{let b=new URL(a),c=b.hostname.toLowerCase(),d=b.pathname.toLowerCase();return"github.com"===c||"gitlab.com"===c||"bitbucket.org"===c||d.endsWith(".git")}catch{return!1}}function S(a){return a.length-1}function T(a){return a.replace(/https?:\/\/[^\s)]+/g," ").replace(/\s+/g," ").replace(/^[\s:,-]+|[\s:,-]+$/g,"").trim()}function U(a){let b=a.toLowerCase();return/\b(yapal[ıi]m|ekleyelim|başlatal[ıi]m|kural[ıi]m|olsun|diyelim|verelim|koyal[ıi]m|kurmak|kurulum|oluşturmak|oluşturma|başlatmak|başlama|yapmak|yapma|istiyorum|istiyoruz|istemek|want|build|create|make|start|launch|setup|set up)\b/.test(b)}function V(a){return a?a.charAt(0).toLowerCase()+a.slice(1):a}function W(a,b){return a.find(a=>RegExp(b,"i").test(`${a.id} ${a.role} ${a.name}`))?.id}function X(a){return a.filter((a,b,c)=>c.findIndex(b=>b.id===a.id)===b)}function Y(a){return a.trim()}function Z(a){return a?.trim()||void 0}function $(a){return aa((a??[]).flatMap(a=>_(a)).map(a=>a.trim()).filter(Boolean))}function _(a){return a.split(/\r?\n|,/g).map(a=>a.trim()).filter(Boolean)}function aa(a){return Array.from(new Set(a.filter(Boolean)))}function ab(a){return structuredClone(a)}function ac(a){return a.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function ad(a){return a.split(/[-_]/g).filter(Boolean).map(a=>a[0].toUpperCase()+a.slice(1)).join(" ")}},97639:(a,b,c)=>{c.d(b,{R2:()=>s,Mt:()=>y,Nr:()=>t,r2:()=>x,Td:()=>w,gO:()=>v,Q4:()=>u});var d=c(51455),e=c(76760),f=c.n(e),g=c(39503),h=c(93628),i=c(37037),j=c(9738),k=c(14853),l=c(53816);let m=f().join(process.cwd(),".mission-control","planner"),n=f().join(m,"plans"),o=f().join(m,"runtime-workspace"),p="AgentOS Planner Runtime",q=[{id:"architect",role:"Workspace Architect",name:"Workspace Architect",enabled:!0,isPrimary:!0,emoji:"\uD83E\uDD16",theme:"cyan",skillId:"planner-architect",policy:(0,h.g0)("worker",{fileAccess:"workspace-only",networkAccess:"enabled"}),heartbeat:{enabled:!1}},{id:"founder",role:"Founder",name:"Founder",enabled:!0,emoji:"\uD83C\uDFD7️",theme:"amber",skillId:"planner-founder",policy:(0,h.g0)("worker",{fileAccess:"workspace-only",networkAccess:"enabled"}),heartbeat:{enabled:!1}},{id:"product",role:"Product Lead",name:"Product Lead",enabled:!0,emoji:"\uD83D\uDCD0",theme:"emerald",skillId:"planner-product",policy:(0,h.g0)("worker",{fileAccess:"workspace-only",networkAccess:"enabled"}),heartbeat:{enabled:!1}},{id:"ops",role:"Operations",name:"Operations",enabled:!0,emoji:"⚙️",theme:"blue",skillId:"planner-ops",policy:(0,h.g0)("worker",{fileAccess:"workspace-only",networkAccess:"enabled"}),heartbeat:{enabled:!1}},{id:"growth",role:"Growth",name:"Growth",enabled:!0,emoji:"\uD83D\uDCE3",theme:"violet",skillId:"planner-growth",policy:(0,h.g0)("worker",{fileAccess:"workspace-only",networkAccess:"enabled"}),heartbeat:{enabled:!1}},{id:"reviewer",role:"Reviewer",name:"Reviewer",enabled:!0,emoji:"\uD83D\uDD0D",theme:"rose",skillId:"planner-reviewer",policy:(0,h.g0)("worker",{fileAccess:"workspace-only",networkAccess:"enabled"}),heartbeat:{enabled:!1}}],r=["founder","product","ops","growth","reviewer"];async function s(){let a=(0,j.x7)();return await B(a),{plan:a}}async function t(a){return{plan:await A(a)}}async function u(a,b){return{plan:await z(a,b)}}async function v(a,b,c){var d;let e=b.trim();if(!e)throw Error("Planner message is required.");let f=c?await z(a,c):await A(a),g=Y(e),h=(0,j.xP)((0,j.eR)(f),e);h.conversation.push((0,j.kI)("user","Operator",e));let i=await g;h.intake.sources=function(a,b){let c=[...a];for(let a of b){let b=c.findIndex(b=>b.url&&a.url?b.url===a.url:b.id===a.id);if(b>=0){c[b]=a;continue}c.push(a)}return c}(h.intake.sources,i.sources);let k=!(d=h=(0,j.eR)(h)).intake.reviewRequested&&d.intake.turnCount<=1&&"ready"!==d.runtime.status?h:await F(h),l=k.autopilot&&(k.intake.reviewRequested||k.intake.turnCount>2)?await H(k,e):[];k.advisorNotes=l;let m=await I(k,e,i,l,f);return(h=m.plan).conversation.push((0,j.kI)("assistant","Workspace Architect",m.reply)),h=(0,j.eR)(h),await B(h),{plan:h}}async function w(a,b){let c=b.path.trim();if(!c)throw Error("Document path is required.");let d=b.plan?await z(a,b.plan):await A(a),e=await F((0,j.eR)(d)),f=b.instruction?.trim()||"Rewrite this document to improve clarity, usefulness, and consistency with the workspace context.",g=await J(e,c,b.currentContent,f),h=g.plan;return h.conversation.push((0,j.kI)("assistant","Workspace Architect",g.reply)),h=(0,j.eR)(h),await B(h),{plan:h,reply:g.reply}}async function x(a,b){let c=b?await z(a,b):await A(a),d=await F((0,j.eR)(c)),e=await H(d,"Simulate the specialist planning board.");d.advisorNotes=e;let f=await I(d,"Simulate the specialist planning board and tell me what you would refine next.",{sources:d.intake.sources,confirmations:d.intake.confirmations,inferenceText:d.intake.inferences.map(a=>`${a.label}: ${a.value}`).join("\n"),companyName:d.company.name||void 0,mission:d.company.mission||void 0,offer:d.product.offer||void 0,template:d.workspace.template},e,c);(d=f.plan).conversation.push((0,j.kI)("assistant","Workspace Architect",f.reply));let g=(0,j.eR)(d);return await B(g),{plan:g}}async function y(a,b,c={}){let d=b?await z(a,b):await A(a),e=(0,j.eR)({...d,intake:{...d.intake,reviewRequested:!0}}),f=e.team.persistentAgents.filter(a=>a.enabled).length,g=e.operations.channels.some(a=>a.enabled&&"internal"!==a.type),h=e.operations.automations.some(a=>a.enabled),k=e.deploy.firstMissions.some(a=>a.trim().length>0),m=(0,i.X6)({template:(0,i.Bb)({sourceMode:e.workspace.sourceMode,agentCount:f,kickoffMission:e.workspace.rules.kickoffMission,hasChannels:g,hasAutomations:h,hasPlannerKickoffs:k}),onProgress:c.onProgress});if(await m.startStep("plan","Checking deploy blockers and locking the planner state."),e.deploy.blockers.length>0){let a=`Resolve deploy blockers first: ${e.deploy.blockers.join(" ")}`;throw await m.addActivity("plan",a,"error"),await m.failStep("plan",a),Error(`Resolve deploy blockers first: ${e.deploy.blockers.join(" ")}`)}await m.addActivity("plan","Deploy blockers cleared.","done"),e.status="deploying",e.stage="deploying",await B(e),await m.completeStep("plan","Planner state locked. Workspace bootstrap is starting.");try{var n,o,p;let a,b,c=(a=(n=e).team.persistentAgents.filter(a=>a.enabled),{name:n.workspace.name,brief:[(o=n).company.mission?`Mission: ${o.company.mission}`:"",o.company.targetCustomer?`Target customer: ${o.company.targetCustomer}`:"",o.product.offer?`Offer: ${o.product.offer}`:"",o.product.scopeV1.length>0?`V1 scope: ${o.product.scopeV1.join(", ")}`:"",o.product.nonGoals.length>0?`Non-goals: ${o.product.nonGoals.join(", ")}`:"",o.company.successSignals.length>0?`Success signals: ${o.company.successSignals.join(", ")}`:"",o.workspace.stackDecisions.length>0?`Stack decisions: ${o.workspace.stackDecisions.join(", ")}`:""].filter(Boolean).join("\n"),directory:n.workspace.directory,modelId:n.workspace.modelId,sourceMode:n.workspace.sourceMode,repoUrl:n.workspace.repoUrl,existingPath:n.workspace.existingPath,template:n.workspace.template,teamPreset:"custom",modelProfile:n.workspace.modelProfile,docOverrides:n.workspace.docOverrides,rules:{...n.workspace.rules,workspaceOnly:n.operations.sandbox.workspaceOnly},agents:a.map(T)}),d=await (0,l.zw)(c,{onProgress:async a=>{for(let b of a.steps)await m.syncStep(b)}});await m.startStep("blueprint","Writing planner blueprint and deploy notes into the new workspace."),await m.addActivity("blueprint","Persisting planner blueprint, deploy report, and docs."),await U(e,d.workspacePath,d),await m.completeStep("blueprint","Planner blueprint and docs are now in the workspace.");let f=(p=e,b=ap(p.workspace.name),Object.fromEntries(p.team.persistentAgents.filter(a=>a.enabled).map(a=>[a.id,`${b}-${ap(a.id)||"agent"}`])));await m.startStep("channels",g?"Provisioning enabled external channels.":"No external channels were requested."),g||await m.addActivity("channels","No enabled external channels. Skipping channel provisioning.","done");let i=await V(e.operations.channels,{onProgress:async({message:a,percent:b,status:c})=>{await m.updateStep("channels",{percent:b,detail:a,status:"error"===c?"active":void 0}),await m.addActivity("channels",a,c)}});await m.completeStep("channels",g?`${i.provisioned.length} channel${1===i.provisioned.length?"":"s"} provisioned.`:"Channel stage complete."),await m.startStep("automations",h?"Provisioning enabled automation loops.":"No recurring automations were requested."),h||await m.addActivity("automations","No enabled automations. Skipping automation provisioning.","done");let q=await W(e,d.workspaceId,f,{onProgress:async({message:a,percent:b,status:c})=>{await m.updateStep("automations",{percent:b,detail:a,status:"error"===c?"active":void 0}),await m.addActivity("automations",a,c)}});await m.completeStep("automations",h?`${q.provisioned.length} automation${1===q.provisioned.length?"":"s"} provisioned.`:"Automation stage complete."),await m.startStep("planner-kickoff",k?"Dispatching planner kickoff missions.":"No planner kickoff missions were requested."),k||await m.addActivity("planner-kickoff","No planner kickoff missions. Finalizing deploy.","done");let r=await X(e,d.workspaceId,f,{onProgress:async({message:a,percent:b,status:c})=>{await m.updateStep("planner-kickoff",{percent:b,detail:a,status:"error"===c?"active":void 0}),await m.addActivity("planner-kickoff",a,c)}});await m.completeStep("planner-kickoff",k?`${r.length} kickoff mission${1===r.length?"":"s"} launched.`:"Deploy finalized without extra kickoff missions.");let s=aq([...e.deploy.warnings,...i.warnings,...q.warnings]);e.deploy={...e.deploy,blockers:[],warnings:s,lastDeployedAt:new Date().toISOString(),workspaceId:d.workspaceId,workspacePath:d.workspacePath,primaryAgentId:d.primaryAgentId,createdAgentIds:d.agentIds,provisionedChannels:i.provisioned,provisionedAutomations:q.provisioned,kickoffRunIds:aq([...d.kickoffRunId?[d.kickoffRunId]:[],...r])},e.status="deployed",e.stage="deployed",e.conversation.push((0,j.kI)("assistant","Workspace Architect",`DEPLOY completed. Workspace ${d.workspacePath} is live with ${d.agentIds.length} agent${1===d.agentIds.length?"":"s"}.`));let t=(0,j.eR)(e);return t.status="deployed",t.stage="deployed",await B(t),{plan:t,workspaceId:d.workspaceId,workspacePath:d.workspacePath,primaryAgentId:d.primaryAgentId,agentIds:d.agentIds,kickoffRunIds:t.deploy.kickoffRunIds,warnings:s}}catch(a){throw e.status="blocked",e.stage="pressure-test",e.deploy.warnings=aq([...e.deploy.warnings,a instanceof Error?a.message:"Planner deploy failed."]),await B((0,j.eR)(e)),a}}async function z(a,b){let c=await A(a).catch(()=>(0,j.x7)(a)),d=(0,j.eR)({...c,...b,id:a,createdAt:c.createdAt,runtime:{...c.runtime,...b.runtime},deploy:{...c.deploy,...b.deploy}});return await B(d),d}async function A(a){let b=C(a),c=await (0,d.readFile)(b,"utf8");return(0,j.eR)(JSON.parse(c))}async function B(a){let b=C(a.id);await (0,d.mkdir)(f().dirname(b),{recursive:!0}),await (0,d.writeFile)(b,`${JSON.stringify(a,null,2)}
|
|
1
|
+
"use strict";exports.id=7639,exports.ids=[7639],exports.modules={9738:(a,b,c)=>{c.d(b,{ET:()=>x,Ey:()=>z,Fq:()=>r,Hc:()=>s,K$:()=>G,Lw:()=>p,MV:()=>j,Ni:()=>L,OG:()=>y,PJ:()=>u,Pz:()=>q,W5:()=>A,XE:()=>t,YM:()=>B,Yr:()=>H,bQ:()=>D,eR:()=>E,fK:()=>n,hN:()=>M,kI:()=>m,qN:()=>w,x7:()=>C,xP:()=>F});var d=c(15612),e=c(14853),f=c(93628);let g={founder:"Founder",product:"Product Lead",architect:"System Architect",ops:"Operations",growth:"Growth",reviewer:"Reviewer"},h={small:{label:"Small",agentCount:1,workflowCount:1,automationCount:0,externalChannelCount:0,confirmationLimit:1,suggestedReplyLimit:2},medium:{label:"Medium",agentCount:3,workflowCount:3,automationCount:1,externalChannelCount:0,confirmationLimit:2,suggestedReplyLimit:3},large:{label:"Large",agentCount:5,workflowCount:4,automationCount:2,externalChannelCount:1,confirmationLimit:3,suggestedReplyLimit:4}},i={workspaceOnly:!0,generateStarterDocs:!1,generateMemory:!1,kickoffMission:!1};function j(a){return h[a]??h.medium}let k={internal:{label:"Internal",requiresCredentials:!1,credentials:[]},slack:{label:"Slack",requiresCredentials:!0,credentials:[{key:"botToken",label:"Bot token",placeholder:"xoxb-...",secret:!0}]},telegram:{label:"Telegram",requiresCredentials:!0,credentials:[{key:"token",label:"Bot token",placeholder:"123456:ABC...",secret:!0}]},discord:{label:"Discord",requiresCredentials:!0,credentials:[{key:"token",label:"Bot token",placeholder:"Discord bot token",secret:!0}]},googlechat:{label:"Google Chat",requiresCredentials:!0,credentials:[{key:"webhookUrl",label:"Webhook URL",placeholder:"https://chat.googleapis.com/...",secret:!0}]}};function l(){return globalThis.crypto?.randomUUID?.()??`plan-${Date.now()}`}function m(a,b,c){return{id:l(),role:a,author:b,text:c,createdAt:new Date().toISOString()}}function n(a){return{id:a.id?.trim()||l(),kind:a.kind,label:a.label.trim(),summary:a.summary.trim(),details:$(a.details),status:a.status??"ready",createdAt:a.createdAt??new Date().toISOString(),confidence:"number"==typeof a.confidence?Math.max(0,Math.min(100,Math.round(a.confidence))):void 0,url:Z(a.url),error:Z(a.error)}}function o(a){return{id:a.id?.trim()||l(),section:a.section,label:a.label.trim(),value:a.value.trim(),confidence:Math.max(0,Math.min(100,Math.round(a.confidence??72))),status:a.status??"inferred",rationale:Y(a.rationale??""),sourceLabels:$(a.sourceLabels)}}function p(a){let b=ac(a?.id||a?.name||"operator")||"operator",c=a?.role?.trim()||"Operator",d=a?.name?.trim()||ad(b);return{id:b,role:c,name:d,purpose:a?.purpose?.trim()||`${d} owns ${c.toLowerCase()} execution and handoffs.`,enabled:a?.enabled!==!1,isPrimary:!!a?.isPrimary,emoji:a?.emoji?.trim(),theme:a?.theme?.trim(),skillId:a?.skillId?.trim(),modelId:a?.modelId?.trim(),policy:a?.policy??(0,f.g0)("worker"),heartbeat:a?.heartbeat??{enabled:!1},responsibilities:$(a?.responsibilities),outputs:$(a?.outputs),channelIds:$(a?.channelIds)}}function q(a){return{id:ac(a?.id||a?.name||`workflow-${Date.now()}`)||`workflow-${Date.now()}`,name:a?.name?.trim()||"New workflow",goal:a?.goal?.trim()||"",trigger:a?.trigger??"manual",ownerAgentId:a?.ownerAgentId?.trim(),collaboratorAgentIds:$(a?.collaboratorAgentIds),successDefinition:a?.successDefinition?.trim()||"",outputs:$(a?.outputs),channelIds:$(a?.channelIds),enabled:a?.enabled!==!1}}function r(a="internal",b){let c=k[a];return{id:ac(b?.id||b?.name||`${a}-${Date.now()}`)||`${a}-${Date.now()}`,type:a,name:b?.name?.trim()||c.label,purpose:b?.purpose?.trim()||"",target:b?.target?.trim(),enabled:b?.enabled!==!1,announce:!!b?.announce,requiresCredentials:c.requiresCredentials,accountId:b?.accountId?.trim(),primaryAgentId:b?.primaryAgentId?.trim()??null,allowedChatIds:$(b?.allowedChatIds),groupAssignments:Array.isArray(b?.groupAssignments)?b.groupAssignments.map(a=>({chatId:"string"==typeof a.chatId?a.chatId.trim():"",agentId:"string"==typeof a.agentId?a.agentId.trim():null,title:"string"==typeof a.title?a.title.trim():null,enabled:!1!==a.enabled})).filter(a=>!!a.chatId):[],credentials:b?.credentials?.map(a=>({...a,value:a.value??""}))??c.credentials.map(a=>({...a,value:""}))}}function s(a){return{id:ac(a?.id||a?.name||`automation-${Date.now()}`)||`automation-${Date.now()}`,name:a?.name?.trim()||"New automation",description:a?.description?.trim()||"",enabled:a?.enabled!==!1,scheduleKind:a?.scheduleKind??"every",scheduleValue:a?.scheduleValue?.trim()||"24h",agentId:a?.agentId?.trim(),mission:a?.mission?.trim()||"",thinking:a?.thinking??"medium",announce:!!a?.announce,channelId:a?.channelId?.trim()}}function t(a){return{id:ac(a?.id||a?.name||`hook-${Date.now()}`)||`hook-${Date.now()}`,name:a?.name?.trim()||"New hook",source:a?.source?.trim()||"",enabled:a?.enabled!==!1,notes:a?.notes?.trim()||""}}function u(a){return{workspaceOnly:a?.workspaceOnly??!0,mode:a?.mode??"default",notes:$(a?.notes)}}function v(a){return{started:!!a?.started,initialPrompt:Y(a?.initialPrompt??""),latestPrompt:Y(a?.latestPrompt??""),sources:(a?.sources??[]).map(a=>n(a)),confirmations:$(a?.confirmations).map(a=>a.trim()).filter(Boolean).slice(0,3),mode:a?.mode==="advanced"?"advanced":"guided",size:a?.size==="small"||a?.size==="large"?a.size:"medium",reviewRequested:!!a?.reviewRequested,turnCount:Math.max(0,Math.floor(a?.turnCount??0)),inferences:(a?.inferences??[]).map(a=>o(a)),suggestedReplies:$(a?.suggestedReplies).slice(0,4)}}function w(a,b){let c=b?.architectSessionId?.trim()||`planner-${a}-architect`,d=Object.fromEntries(Object.entries(b?.advisorAgentIds??{}).filter(([,a])=>"string"==typeof a&&a.trim())),e=Object.fromEntries(Object.entries(g).map(([c])=>[c,b?.advisorSessionIds?.[c]?.trim()||`planner-${a}-${c}`]));return{mode:b?.mode==="fallback"?"fallback":"agent",status:b?.status==="error"?"error":b?.status==="ready"?"ready":"pending",workspaceId:Z(b?.workspaceId),workspacePath:Z(b?.workspacePath),architectAgentId:Z(b?.architectAgentId),architectSessionId:c,advisorAgentIds:d,advisorSessionIds:e,lastArchitectRunId:Z(b?.lastArchitectRunId),lastAdvisorRunIds:$(b?.lastAdvisorRunIds),lastError:Z(b?.lastError)}}function x(a,b){return(0,d.P0)(a,"core",b).map(b=>{var c,d,e,g,h,i,j;return p({id:b.id,role:b.role,name:b.name,purpose:(c=b.id,d=b.role,e=a,/review/i.test(c)||/review/i.test(d)?`Pressure-test ${e} work for correctness, regression risk, and missing validation.`:/test/i.test(c)||/test/i.test(d)?`Validate behavior, environment assumptions, and release confidence for this ${e} workspace.`:/learn/i.test(c)||/learn/i.test(d)?"Keep the workspace memory, conventions, and durable decisions coherent over time.":/browser/i.test(c)||/browser/i.test(d)?"Exercise real UI flows and collect evidence for browser-facing work.":`Own hands-on delivery and keep the ${e} workspace moving.`),enabled:b.enabled,isPrimary:b.isPrimary,emoji:b.emoji,theme:b.theme,skillId:b.skillId,modelId:b.modelId,policy:b.policy??(0,f.g0)("worker"),heartbeat:b.heartbeat??{enabled:!1},responsibilities:(g=b.id,h=a,/review/i.test(g)?["Review active work","Call out regressions","Protect launch quality"]:/test/i.test(g)?["Run verification loops","Capture evidence","Surface failing assumptions"]:/learn/i.test(g)?["Update durable memory","Track decisions","Reduce restart friction"]:/browser/i.test(g)?["Exercise flows","Capture screenshots","Validate responsive states"]:"content"===h?["Drive content production","Coordinate handoffs","Prepare launch artifacts"]:["Implement the next increment","Coordinate specialists","Keep execution momentum"]),outputs:(i=b.id,j=a,/review/i.test(i)?["review notes","risk checklist"]:/test/i.test(i)?["verification report","repro steps"]:/learn/i.test(i)?["memory updates","decision log entries"]:/browser/i.test(i)?["screenshots","browser validation notes"]:"research"===j?["research summary","evidence log"]:["implementation artifacts","handoff summary"])})})}function y(a,b){let c=b.find(a=>a.enabled&&a.isPrimary)?.id,d=W(b,"review"),e=W(b,"test"),f=W(b,"learn"),g=W(b,"browser");if("research"===a)return[q({id:"research-loop",name:"Research loop",goal:"Turn the main question into evidence-backed findings and explicit unknowns.",trigger:"manual",ownerAgentId:c,collaboratorAgentIds:[f,d].filter(Boolean),successDefinition:"Question, evidence, synthesis, and next-step recommendations are documented.",outputs:["docs/research-plan.md","deliverables/<run>/research-summary.md"]}),q({id:"finding-review",name:"Finding review",goal:"Pressure-test claims before publishing or acting on them.",trigger:"manual",ownerAgentId:d??c,collaboratorAgentIds:[c].filter(Boolean),successDefinition:"Assumptions, risks, and evidence gaps are explicit.",outputs:["deliverables/<run>/review-notes.md"]})];if("content"===a)return[q({id:"strategy",name:"Strategy and briefing",goal:"Clarify audience, offer, channels, and campaign bets before production.",trigger:"manual",ownerAgentId:c,collaboratorAgentIds:[d,f].filter(Boolean),successDefinition:"The team agrees on brief, priorities, and success signals.",outputs:["docs/content-brief.md","deliverables/<run>/campaign-brief.md"]}),q({id:"production",name:"Production and QA",goal:"Create assets, review them, and prepare a launch package.",trigger:"manual",ownerAgentId:c,collaboratorAgentIds:[d].filter(Boolean),successDefinition:"Assets are approved and delivery-ready.",outputs:["deliverables/<run>/drafts/","deliverables/<run>/launch-package.md"]}),q({id:"performance-loop",name:"Performance loop",goal:"Review outcomes, learn from results, and feed the next iteration.",trigger:"cron",ownerAgentId:f??d??c,collaboratorAgentIds:[c].filter(Boolean),successDefinition:"Measured results and next changes are documented.",outputs:["deliverables/<run>/performance-review.md"]})];let h=g&&"frontend"===a?g:c;return[q({id:"scope-v1",name:"V1 shaping",goal:"Turn the product goal into a constrained first delivery batch.",trigger:"manual",ownerAgentId:c,collaboratorAgentIds:[f,d].filter(Boolean),successDefinition:"Scope, non-goals, and critical path are documented.",outputs:["docs/brief.md","memory/blueprint.md"]}),q({id:"delivery",name:"Delivery loop",goal:"Implement, validate, and hand off the next meaningful increment.",trigger:"manual",ownerAgentId:h,collaboratorAgentIds:[e,d].filter(Boolean),successDefinition:"A tested increment ships with review notes and clear handoff.",outputs:["deliverables/<run>/release-notes.md","deliverables/<run>/verification.md"]}),q({id:"launch-readiness",name:"Launch readiness",goal:"Check blockers, rollback posture, and communication before launch.",trigger:"launch",ownerAgentId:d??c,collaboratorAgentIds:[e,f].filter(Boolean),successDefinition:"Launch risks, open blockers, and go/no-go signal are explicit.",outputs:["deliverables/<run>/launch-checklist.md"]})]}function z(){return[r("internal",{id:"internal-ops",name:"Internal ops",purpose:"Default internal coordination surface for planner outputs and deploy notes.",announce:!1})]}function A(a,b,c){let d=W(b,"review")??b.find(a=>a.enabled)?.id,e=W(b,"learn")??d,f=c[0]?.id;return[s({id:"daily-triage",name:"Daily triage",description:"Review drift, blockers, and next handoffs every day.",scheduleKind:"every",scheduleValue:"24h",agentId:d,mission:"content"===a?"Review active campaigns, blockers, and next content handoffs. Leave a concise operator brief.":"Inspect the workspace, surface blockers, and leave a concise next-step handoff for the team.",thinking:"medium",channelId:f}),s({id:"weekly-review",name:"Weekly review",description:"Capture progress, decisions, and next bets once per week.",scheduleKind:"every",scheduleValue:"168h",agentId:e,mission:"research"===a?"Summarize evidence gathered this week, open questions, and the next investigation batch.":"Summarize progress, major decisions, and the next delivery batch for this workspace.",thinking:"high",channelId:f})].filter(a=>a.agentId)}function B(){return[t({id:"handoff-audit",name:"Handoff audit",source:"workspace manifest",enabled:!0,notes:"Keep delivery artifacts and handoffs durable enough for other agents to continue."})]}function C(a=l()){let b=new Date().toISOString(),c="software",e=x(c),f=z();return E({id:a,status:"draft",stage:"intake",createdAt:b,updatedAt:b,autopilot:!0,readinessScore:0,architectSummary:"",runtime:w(a),intake:v(),company:{name:"",type:"saas",mission:"",targetCustomer:"",constraints:[],successSignals:[]},product:{offer:"",scopeV1:[],nonGoals:[],revenueModel:"",launchPriority:[]},workspace:{name:"",sourceMode:"empty",template:c,modelProfile:"balanced",stackDecisions:[],docs:(0,d.GH)(c,i),docOverrides:[],rules:{...i}},team:{persistentAgents:e,allowEphemeralSubagents:!0,maxParallelRuns:4,escalationRules:["Escalate ambiguous product decisions to the architect before implementation.","Escalate missing tooling or blocked environments before the delivery workflow starts.","Escalate launch blockers when review or verification fails."]},operations:{workflows:y(c,e),channels:f,automations:A(c,e,f),hooks:B(),sandbox:u({workspaceOnly:!0,mode:"default",notes:["Keep file work grounded in the target workspace by default."]})},deploy:{blockers:[],warnings:[],firstMissions:[],createdAgentIds:[],provisionedChannels:[],provisionedAutomations:[],kickoffRunIds:[]},conversation:[m("assistant","Workspace Architect","Tell me the project in one prompt. I will infer the workspace shape, draft a full first pass, and you can revise anything as many times as you want.")],advisorNotes:[]})}function D(a,b){let c=ab(a),e=x(b,c.workspace.name),f=c.operations.channels.length?c.operations.channels:z();return c.workspace.template=b,c.workspace.docs=(0,d.GH)(b,c.workspace.rules),c.team.persistentAgents=e,c.operations.workflows=y(b,e),c.operations.automations=A(b,e,f),E(c)}function E(a){var b,c,f,g,h,i,k,l,m,n,B,C,D,E,F,G,H,M,Q,R,S,T,_,ac,ae,af,ag;let ah,ai,aj,ak,al,am,an,ao,ap,aq,ar,as,at,au,av,aw,ax,ay=ab(a),az=ay.intake.sources.some(a=>"workspace-edit-source"===a.id);if(ay.runtime=w(ay.id,ay.runtime),ay.intake=v({...ay.intake,started:!!ay.intake?.started||ay.conversation.some(a=>"user"===a.role)}),ay.company.name=Y(ay.company.name),ay.company.mission=Y(ay.company.mission),ay.company.targetCustomer=Y(ay.company.targetCustomer),ay.company.constraints=$(ay.company.constraints),ay.company.successSignals=$(ay.company.successSignals),ay.product.offer=Y(ay.product.offer),ay.product.scopeV1=$(ay.product.scopeV1),ay.product.nonGoals=$(ay.product.nonGoals),ay.product.revenueModel=Y(ay.product.revenueModel),ay.product.launchPriority=$(ay.product.launchPriority),ay.workspace.name=Y(ay.workspace.name),ay.workspace.directory=Z(ay.workspace.directory),ay.workspace.repoUrl=Z(ay.workspace.repoUrl),ay.workspace.existingPath=Z(ay.workspace.existingPath),ay.workspace.stackDecisions=$(ay.workspace.stackDecisions),ay.workspace.docs=aa($(ay.workspace.docs).concat((0,d.GH)(ay.workspace.template,ay.workspace.rules))),ay.workspace.docOverrides=(0,e.Iy)(ay.workspace.docOverrides),ay.team.persistentAgents=ay.team.persistentAgents.map(a=>p({...a,id:a.id,role:a.role,name:a.name,purpose:a.purpose,enabled:a.enabled,isPrimary:a.isPrimary,emoji:a.emoji,theme:a.theme,skillId:a.skillId,modelId:a.modelId,policy:a.policy,heartbeat:a.heartbeat,responsibilities:a.responsibilities,outputs:a.outputs})).filter((a,b,c)=>c.findIndex(b=>b.id===a.id)===b),az){if(!ay.team.persistentAgents.some(a=>a.enabled&&a.isPrimary)){let a=ay.team.persistentAgents.find(a=>a.enabled);a&&(a.isPrimary=!0)}}else{let a,b;if(0===ay.team.persistentAgents.length&&(ay.team.persistentAgents=x(ay.workspace.template,ay.workspace.name)),!ay.team.persistentAgents.some(a=>a.enabled&&a.isPrimary)){let a=ay.team.persistentAgents.find(a=>a.enabled);a&&(a.isPrimary=!0)}let e=ay.team.persistentAgents.find(a=>a.enabled&&a.isPrimary);e&&ay.workspace.name&&(c=e.name,f=e.role,a=c.trim().toLowerCase(),b=f.trim().toLowerCase(),!a||"default agent"===a||a===b||"primary agent"===a||"workspace agent"===a)&&(e.name=(0,d.sg)(ay.workspace.name,e.role,e.name))}ay.operations.channels=ay.operations.channels.map(a=>r(a.type,a)).filter((a,b,c)=>c.findIndex(b=>b.id===a.id)===b),az||0!==ay.operations.channels.length||(ay.operations.channels=z()),ay.operations.workflows=ay.operations.workflows.map(a=>q(a)).filter((a,b,c)=>c.findIndex(b=>b.id===a.id)===b),az||0!==ay.operations.workflows.length||(ay.operations.workflows=y(ay.workspace.template,ay.team.persistentAgents)),ay.operations.automations=ay.operations.automations.map(a=>s(a)).filter((a,b,c)=>c.findIndex(b=>b.id===a.id)===b),az||(aw=j((av=ab(ay)).intake.size),av.team.persistentAgents=function(a,b,c){var d;let e,f;if(c<=0)return[];return X((f=(d=[...b,...x(a),...(e=p({id:"ops-lead",role:"Operations Lead",name:"Operations Lead",purpose:"Own automations, reporting cadence, and cross-agent handoffs for the workspace.",responsibilities:["Maintain the operating cadence","Wire recurring automations","Keep handoffs durable"],outputs:["ops brief","automation notes"]}),"research"===a?[p({id:"analyst",role:"Analyst",name:"Analyst",purpose:"Turn gathered evidence into patterns, themes, and decision-ready summaries.",responsibilities:["Cluster findings","Spot repeated signals","Prepare concise summaries"],outputs:["insight summary","theme map"]}),e]:[e])]).find(a=>a.isPrimary)??d[0])?[f,...d.filter(a=>a.id!==f.id)]:d).slice(0,c).map((a,b)=>p({...a,enabled:!0,isPrimary:a.isPrimary||0===b}))}(av.workspace.template,av.team.persistentAgents,aw.agentCount),av.operations.channels=function(a,b,c){let d=b.find(a=>"internal"===a.type)??z()[0],e=[...b.filter(a=>"internal"!==a.type),...("content"===a?["telegram","discord","slack"]:["slack","discord","telegram"]).map(b=>r(b,{id:`${b}-ops`,purpose:"content"===a?"Optional distribution or community surface for a larger operating setup.":"Optional external operating surface for a larger workspace.",enabled:!1,announce:!0}))].filter((a,b,c)=>c.findIndex(b=>b.type===a.type)===b);return[r("internal",{...d,enabled:!0}),...e.slice(0,c)]}(av.workspace.template,av.operations.channels,aw.externalChannelCount),av.operations.workflows=function(a,b,c,d){let e,f,g,h;return d<=0?[]:X([...b,...y(a,c),...(e=c.find(a=>a.enabled&&a.isPrimary)?.id,f=W(c,"review"),g=W(c,"learn"),h=W(c,"ops"),[q({id:"context-sync",name:"research"===a?"Evidence sync":"Context sync",goal:"Pull new context from linked sources and keep the blueprint aligned with reality.",trigger:"manual",ownerAgentId:g??e,collaboratorAgentIds:[e,f].filter(Boolean),successDefinition:"New context is reflected in durable docs, scope, and decision notes.",outputs:["memory/blueprint.md","deliverables/<run>/context-sync.md"]}),q({id:"ops-rhythm",name:"Operating rhythm",goal:"Review handoffs, automations, and next-step ownership on a repeatable cadence.",trigger:"cron",ownerAgentId:h??f??g??e,collaboratorAgentIds:[e].filter(Boolean),successDefinition:"The workspace has a fresh operator brief and an explicit next batch of work.",outputs:["deliverables/<run>/ops-rhythm.md"]})])]).slice(0,d).map(a=>{var b,d;let e,f,g,h,i;return b=a,e=new Set((d=c).filter(a=>a.enabled).map(a=>a.id)),f=d.find(a=>a.enabled&&a.isPrimary)?.id,g=W(d,"review"),h=W(d,"learn"),i=b.ownerAgentId&&e.has(b.ownerAgentId)?b.ownerAgentId:g??h??f,q({...b,ownerAgentId:i,collaboratorAgentIds:b.collaboratorAgentIds.filter(a=>e.has(a)&&a!==i),enabled:!0})})}(av.workspace.template,av.operations.workflows,av.team.persistentAgents,aw.workflowCount),av.operations.automations=(g=av.workspace.template,h=av.operations.automations,i=av.team.persistentAgents,k=av.operations.channels,(l=aw.automationCount)<=0?[]:X([...h,...A(g,i,k)]).slice(0,l).map(a=>{var b,c,d;let e,f,g,h,j;return b=a,c=i,d=k,e=new Set(c.filter(a=>a.enabled).map(a=>a.id)),f=new Set(d.map(a=>a.id)),g=c.find(a=>a.enabled&&a.isPrimary)?.id,h=W(c,"review"),j=W(c,"learn"),s({...b,agentId:b.agentId&&e.has(b.agentId)?b.agentId:h??j??g,channelId:b.channelId&&f.has(b.channelId)?b.channelId:d[0]?.id,enabled:!0})})),ay=av),ay.operations.hooks=ay.operations.hooks.map(a=>t(a)).filter((a,b,c)=>c.findIndex(b=>b.id===a.id)===b),ay.operations.sandbox=u(ay.operations.sandbox),az||(ay.deploy.firstMissions=(ax=(b=ay).team.persistentAgents.find(a=>a.enabled&&a.isPrimary),aa([ax?"Inspect the new workspace, refine docs to match the blueprint, and break the first delivery batch into concrete tasks.":"",b.team.persistentAgents.find(a=>/review/i.test(a.role)&&a.enabled)?"Review the blueprint against the created workspace, call out execution risks, and leave a launch-readiness checklist.":"",b.team.persistentAgents.find(a=>/learn/i.test(a.role)&&a.enabled)?"Capture durable facts, decisions, and conventions in memory files so the team can continue without drift.":""].filter(Boolean))));let aA=U(ay.company.name),aB=U(ay.workspace.name);if((!ay.company.name||aA)&&ay.workspace.name&&!aB&&(ay.company.name=ay.workspace.name),(!ay.workspace.name||aB)&&ay.company.name&&!aA&&(ay.workspace.name=ay.company.name),!ay.intake.started)return ay.deploy.blockers=[],ay.deploy.warnings=[],ay.intake.confirmations=[],ay.intake.inferences=[],ay.intake.suggestedReplies=[],ay.readinessScore=0,ay.architectSummary="Start with one prompt. Paste the project goal, website URL, repo, or existing folder and the architect will draft the workspace for you.",ay.stage="intake",ay.status="draft",ay.updatedAt=new Date().toISOString(),ay;let aC=function(a){let b=[],c=j(a.intake.size);for(let c of a.intake.sources.filter(a=>"error"===a.status))b.push("tr"===L(a)?`${c.label} kaynağını inceleyemedim. Bu kaynak \xf6nemliyse şirket bağlamını manuel olarak doğrula.`:`I could not inspect ${c.label}. Confirm the company context manually if this source matters.`);return aa(b).slice(0,c.confirmationLimit)}(ay),aD=function(a){let b=[];for(let c of(a.company.name||b.push("Company or workspace name is missing."),a.company.mission||b.push("Mission is missing."),a.company.targetCustomer||b.push("Target customer is missing."),a.workspace.name||b.push("Workspace name is missing."),"clone"!==a.workspace.sourceMode||a.workspace.repoUrl||b.push("Clone mode needs a repository URL."),"existing"!==a.workspace.sourceMode||a.workspace.existingPath||b.push("Existing-folder mode needs a folder path."),a.team.persistentAgents.some(a=>a.enabled)||b.push("At least one persistent agent must be enabled."),a.team.persistentAgents.some(a=>a.enabled&&a.isPrimary)||b.push("One enabled agent must be marked as primary."),a.operations.workflows.some(a=>a.enabled)||b.push("At least one enabled workflow is required."),a.operations.workflows.filter(a=>a.enabled)))c.name&&c.goal&&c.successDefinition||b.push(`Workflow "${c.name||c.id}" is incomplete.`),c.ownerAgentId&&!a.team.persistentAgents.some(a=>a.id===c.ownerAgentId&&a.enabled)&&b.push(`Workflow "${c.name}" points to a missing or disabled owner agent.`);for(let c of a.operations.automations.filter(a=>a.enabled))c.mission&&c.scheduleValue||b.push(`Automation "${c.name}" is incomplete.`),c.agentId&&!a.team.persistentAgents.some(a=>a.id===c.agentId&&a.enabled)&&b.push(`Automation "${c.name}" points to a missing or disabled agent.`);for(let c of a.operations.channels.filter(a=>a.enabled&&a.requiresCredentials))c.credentials.filter(a=>!a.value.trim()).length>0&&b.push(`Channel "${c.name}" is missing required credentials.`);return aa(b)}(ay),aE=(ah=[],ai=j((m=ay).intake.size),0===m.product.nonGoals.length&&ah.push("No non-goals are defined for V1."),0===m.product.launchPriority.length&&ah.push("Launch priorities are not ordered yet."),0===m.company.successSignals.length&&ah.push("Success signals are still empty."),0===m.workspace.stackDecisions.length&&"content"!==m.workspace.template&&ah.push("Critical stack decisions are not captured yet."),ai.automationCount>0&&!m.operations.automations.some(a=>a.enabled)&&ah.push("No automation loops are enabled."),ai.externalChannelCount>0&&!m.operations.channels.some(a=>"internal"!==a.type)&&ah.push("Only internal channels are configured."),ai.agentCount>=3&&m.team.maxParallelRuns<2&&ah.push("Parallel run limit is conservative for a multi-agent workspace."),aa(ah)),aF=I(ay);return ay.intake.confirmations=aC,ay.intake.inferences=(aj=[],ak=(n=ay).intake.sources.filter(a=>"ready"===a.status).map(a=>a.label),al=n.intake.confirmations.join(" ").toLowerCase(),n.company.name&&aj.push(o({section:"company",label:"Company",value:n.company.name,confidence:O(n,"company-name"),status:P(al,"company"),rationale:ak.length>0?"Derived from linked context and the current brief.":"Derived from the current brief.",sourceLabels:ak})),n.company.mission&&aj.push(o({section:"company",label:"Mission",value:n.company.mission,confidence:O(n,"mission"),status:P(al,"outcome"),rationale:"Architect condensed the first business outcome from the request.",sourceLabels:ak})),n.company.targetCustomer&&aj.push(o({section:"company",label:"First audience",value:n.company.targetCustomer,confidence:O(n,"target-customer"),status:P(al,"audience"),rationale:"This is the current best guess for the first user or buyer segment.",sourceLabels:ak})),aj.push(o({section:"workspace",label:"Workspace type",value:ad(n.workspace.template),confidence:O(n,"template"),status:"inferred",rationale:"Template is inferred from the requested operating model and linked context.",sourceLabels:ak})),aj.push(o({section:"workspace",label:"Starting point",value:"clone"===n.workspace.sourceMode?n.workspace.repoUrl||"Clone an existing repository":"existing"===n.workspace.sourceMode?n.workspace.existingPath||"Attach an existing folder":"Start from scratch",confidence:O(n,"source-mode"),status:P(al,"start"),rationale:"This is how the workspace will be materialized when you deploy.",sourceLabels:ak})),n.product.offer&&aj.push(o({section:"product",label:"Offer",value:n.product.offer,confidence:O(n,"offer"),status:"inferred",rationale:"Architect turned the brief into a concrete operator-facing offer.",sourceLabels:ak})),(am=n.operations.channels.filter(a=>a.enabled&&"internal"!==a.type)).length>0&&aj.push(o({section:"operations",label:"External channels",value:am.map(a=>a.name).join(", "),confidence:O(n,"channels"),status:"inferred",rationale:"The request implies these operating channels should exist after deploy.",sourceLabels:ak})),(an=n.team.persistentAgents.find(a=>a.enabled&&a.isPrimary))&&aj.push(o({section:"team",label:"Primary operator",value:`${an.name} (${an.role})`,confidence:O(n,"team"),status:"inferred",rationale:"Architect drafted a primary agent to own the first delivery loop.",sourceLabels:ak})),(ao=n.operations.workflows.find(a=>a.enabled))&&aj.push(o({section:"operations",label:"First workflow",value:ao.name,confidence:O(n,"workflow"),status:"inferred",rationale:"This is the first operational loop the company would run after deploy.",sourceLabels:ak})),aj.slice(0,8)),ay.intake.suggestedReplies=(B=ay,C=aC,ap=L(B),aq=[],ar=j(B.intake.size),as=function(a){let b=a.intake.sources.filter(a=>"ready"===a.status).flatMap(a=>[a.label,a.summary,...a.details]).join(" ").toLowerCase();if(!b)return;let c=/\bweb3|onchain|crypto|blockchain|token\b/.test(b),d=/\bstartup|startups|founder|founders|business(?:es)?\b/.test(b),e=/\bcommunity|communities|member|members|holder|holders|nft|dao|governance\b/.test(b),f=/\bdeveloper|developers|builder|builders|engineer|engineers\b/.test(b),g=/\boperator|operators|moderator|moderators|admin|admins|ops\b/.test(b);return d&&e?c?"Web3 startups and token-led communities":"startups and their communities":d?c?"Web3 startups and founders":"startups and founders":e?c?"DAO, NFT, and Web3 communities":"community leads and members":f&&g?"developers and internal operators":f?"developers and technical teams":g?"internal operators and moderators":void 0}(B),at=J(B),B.company.targetCustomer||(as&&aq.push("tr"===ap?`İlk hedef kitle ${V(as)} gibi g\xf6r\xfcn\xfcyor.`:`The first audience looks like ${V(as)}.`),"content"===B.workspace.template?(aq.push("tr"===ap?"İlk kullanıcılar topluluk y\xf6neticileri ve moderat\xf6rler.":"The first users are community managers and moderators."),aq.push("tr"===ap?"İlk kullanıcılar daha hızlı moderasyon ve onboarding isteyen Telegram \xfcyeleri.":"The first users are Telegram members who need faster moderation and onboarding.")):aq.push("tr"===ap?"İlk kullanıcılar bu iş akışını her g\xfcn y\xfcr\xfcten operat\xf6rler.":"The first users are the operators running this workflow every day.")),B.company.mission||aq.push("tr"===ap?"İlk hedef, hacmi en y\xfcksek manuel iş akışını otomatikleştirmek.":"The first outcome is automating the highest-volume manual workflow."),!B.product.scopeV1.length&&B.company.mission&&B.company.targetCustomer&&aq.push("tr"===ap?"V1, genişlemeden \xf6nce en dar ama faydalı d\xf6ng\xfcy\xfc u\xe7tan uca \xe7\xf6zmeli.":"V1 should handle the narrowest useful loop end to end before we expand."),B.workspace.repoUrl||B.workspace.existingPath||N(B.intake.latestPrompt||B.intake.initialPrompt)||(aq.push("tr"===ap?"Şimdilik varsayılan bir başlangı\xe7la ilerleyelim; kaynak t\xfcr\xfcn\xfc daha sonra istediğin gibi revize edebiliriz.":"We can proceed with a default starting point and revise the source later if you want."),aq.push("tr"===ap?"Eğer bir repo ya da mevcut klas\xf6r istiyorsan sonraki mesajda sadece onu s\xf6ylemen yeterli.":"If you want a repo or existing folder, just say so in the next edit.")),0===B.company.successSignals.length&&B.intake.turnCount>=2&&aq.push("tr"===ap?"Başarı; daha az manuel iş, daha hızlı yanıt s\xfcreleri ve daha net bir operasyon ritmi demek.":"Success means less manual work, faster response times, and a clearer operating cadence."),0!==C.length||at||(aq.push("tr"===ap?"İstersen bu taslağı şimdi daha keskin hale getirebiliriz.":"If you want, we can tighten this draft right now."),aq.push("tr"===ap?"Gelişmiş edit\xf6r\xfc a\xe7.":"Open the advanced editor.")),aa(aq).slice(0,ar.suggestedReplyLimit)),ay.deploy.blockers=aF?aD:[],ay.deploy.warnings=aF?aE:[],ay.readinessScore=(D=ay,E=aD,F=aE,G=aF,au=14,D.company.name&&(au+=10),D.company.mission&&(au+=15),D.company.targetCustomer&&(au+=15),D.product.offer&&(au+=10),D.product.scopeV1.length>0&&(au+=10),D.workspace.name&&(au+=10),D.intake.sources.length>0&&(au+=6),D.team.persistentAgents.some(a=>a.enabled&&a.isPrimary)&&(au+=10),D.operations.workflows.some(a=>a.enabled)&&(au+=10),D.operations.automations.some(a=>a.enabled)&&(au+=5),G?(au-=12*E.length,au-=3*F.length):au-=4*Math.max(0,D.intake.confirmations.length-1),Math.max(0,Math.min(100,au))),ay.architectSummary=function(a,b,c,d){let e=L(a),f=J(a),g=K(a),h=a.team.persistentAgents.filter(a=>a.enabled).length,i=a.operations.workflows.filter(a=>a.enabled).length,j=a.operations.automations.filter(a=>a.enabled).length,k=a.intake.confirmations.length;if(!a.intake.started)return"tr"===e?"Tek mesajla başla.":"Start with one prompt.";if(!d&&f){let b=a.company.mission||a.product.offer||a.company.name||a.workspace.name,c="clone"===a.workspace.sourceMode?"tr"===e?"klon repo":"a cloned repo":"existing"===a.workspace.sourceMode?"tr"===e?"mevcut klas\xf6r":"an existing folder":"tr"===e?"sıfırdan":"scratch",d=!g||a.company.name||a.workspace.name?"":"tr"===e?`Site adı i\xe7in ${g.label} varsayımını kullandım.`:`I used ${g.label} as the site name.`;return"tr"===e?[d,b?`İlk taslak ${b} etrafında hazır.`:`İlk taslak ${c} başlangıcıyla hazır.`].filter(Boolean).join(" "):[d,b?`First pass ready around ${b}.`:`First pass ready from ${c}.`].filter(Boolean).join(" ")}return d?"tr"===e?[a.company.mission?`Odak: ${a.company.mission}.`:"Misyon kısa bir c\xfcmle istiyor.",a.company.targetCustomer?`Kitle: ${a.company.targetCustomer}.`:"Kitle a\xe7ık.",`${h} agent, ${i} g\xf6rev, ${j} automation.`,k>0?`${k} revizyon kaldı.`:b.length>0?`${b.length} blocker kaldı.`:c.length>0?`${c.length} warning var.`:"Deploy'a hazır."].join(" "):[a.company.mission?`Focus: ${a.company.mission}.`:"Mission still needs a short sentence.",a.company.targetCustomer?`Audience: ${a.company.targetCustomer}.`:"Audience open.",`${h} agents, ${i} workflows, ${j} automations.`,k>0?`${k} revision${1===k?"":"s"} left.`:b.length>0?`${b.length} blocker${1===b.length?"":"s"} remain.`:c.length>0?`${c.length} warning${1===c.length?"":"s"} remain.`:"Ready to deploy."].join(" "):"tr"===e?[a.company.mission?`Odak: ${a.company.mission}.`:a.company.name||a.workspace.name?`İlk \xe7ıktı: ${a.company.name||a.workspace.name}.`:"İlk \xe7ıktı netleşiyor.",a.company.targetCustomer?`Kitle: ${a.company.targetCustomer}.`:"Kitle a\xe7ık.",a.intake.sources.length>0?`${a.intake.sources.length} kaynak topladım.`:"URL, repo ya da kısa brief yeterli.",`${h} agent, ${i} g\xf6rev, ${j} automation.`,k>0?`${k} revizyon kaldı.`:"Revizyona hazır."].join(" "):[a.company.mission?`Focus: ${a.company.mission}.`:`First outcome: ${a.company.name||a.workspace.name||"this workspace"}.`,a.company.targetCustomer?`Audience: ${a.company.targetCustomer}.`:"Audience open.",a.intake.sources.length>0?`I have ${a.intake.sources.length} source${1===a.intake.sources.length?"":"s"}.`:"Add a URL, repo, or short brief.",`${h} agents, ${i} workflows, ${j} automations.`,k>0?`${k} revision${1===k?"":"s"} left.`:"Ready to revise."].join(" ")}(ay,aD,aE,aF),ay.stage=(H=ay,M=aD,Q=aE,R=aC,S=aF,H.intake.started?!S&&J(H)?H.intake.sources.length>0?"context-harvest":"intake":"deploying"===H.status?"deploying":"deployed"===H.status?"deployed":(T=H).company.mission||T.product.offer||T.workspace.name||T.intake.sources.length>0?((_=H).company.name||_.workspace.name)&&_.company.mission&&_.team.persistentAgents.some(a=>a.enabled)&&_.operations.workflows.some(a=>a.enabled)?S?M.length>0?"pressure-test":Q.length>0||H.readinessScore<90?"decision-lock":"ready":R.length>0?"team-synthesis":"decision-lock":"team-synthesis":H.intake.turnCount>1?"context-harvest":"intake":"intake"),ay.status=(ac=ay,ae=aD,af=aC,ag=aF,ac.intake.started?"deploying"===ac.status||"deployed"===ac.status?ac.status:ag?"blocked"===ac.status&&ae.length>0||ae.length>0?"blocked":ac.readinessScore>=90?"ready":"review":J(ac)||af.length>0?"draft":"review":"draft"),ay.updatedAt=new Date().toISOString(),ay}function F(a,b){var c,d,e,f,g,h,i,j,l;let m,n,o,q,t=ab(a),u=b.trim(),v=u.toLowerCase(),w=Array.from(new Set([...(c=u).match(/https?:\/\/[^\s)]+/g)??[],...c.match(/\b(?:www\.)?[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)+(?:\/[^\s)]*)?/gi)??[]].map(a=>(function(a){if(a.includes("@"))return null;let b=a.replace(/[),.;!?]+$/g,""),c=/^https?:\/\//i.test(b)?b:`https://${b}`;try{let a=new URL(c);return a.hostname.includes(".")?a.toString():null}catch{return null}})(a)).filter(a=>!!a))),x=w.find(a=>R(a)),y=w.find(a=>!R(a));t.intake.started=!0,t.intake.initialPrompt||(t.intake.initialPrompt=u),t.intake.latestPrompt=u,t.intake.turnCount+=1,/\b(advanced|detailed|full editor|geli[sş]mi[sş]|detayl[ıi]|ileri seviye)\b/.test(v)&&(t.intake.mode="advanced"),/\b(simple|keep it simple|guided|basit|sade|y[öo]nlendir)\b/.test(v)&&(t.intake.mode="guided"),/\b(review|deploy review|launch review|final review|go to deploy|deploye ge[cç]|reviewe ge[cç]|son kontrol)\b/.test(v)&&(t.intake.reviewRequested=!0),x&&(t.workspace.sourceMode="clone",t.workspace.repoUrl=x),/\b(existing folder|existing workspace|existing repo|mevcut klas[oö]r|mevcut workspace|mevcut repo)\b/.test(v)&&(t.workspace.sourceMode="existing"),/\b(empty workspace|from scratch|greenfield|s[ıi]f[ıi]rdan|bo[sş] workspace|bo[sş] proje)\b/.test(v)&&(t.workspace.sourceMode="empty");let z=(d=v,/\b(telegram|discord|community|topluluk|grup|channel automation|community ops)\b/.test(d)?"content":/\bfrontend\b|\bui\b|\bwebsite\b|\blanding page\b|\bdesign system\b/.test(d)?"frontend":/\bbackend\b|\bapi\b|\bservice\b|\bmicroservice\b/.test(d)?"backend":/\bresearch\b|\binvestigation\b|\banalysis\b|\bthesis\b/.test(d)?"research":/\bcontent\b|\bmarketing\b|\bgrowth\b|\bseo\b|\bnewsletter\b/.test(d)?"content":/\bsoftware\b|\bapp\b|\bweb app\b|\bmobile app\b/.test(d)?"software":null);if(z&&z!==t.workspace.template){let a=D(t,z);t.workspace=a.workspace,t.team=a.team,t.operations=a.operations,t.deploy.firstMissions=a.deploy.firstMissions}let A=(e=v,/\b(community|topluluk|telegram|discord)\b/.test(e)?"content-brand":/\bagency\b/.test(e)?"agency":/\bresearch\b|\blab\b/.test(e)?"research-lab":/\bcontent\b|\bmedia\b|\bnewsletter\b/.test(e)?"content-brand":/\binternal ops\b|\bops team\b/.test(e)?"internal-ops":/\bsaas\b|\bapp\b|\bweb app\b|\bmobile app\b/.test(e)?"saas":null);A&&(t.company.type=A);let B=(m=u.match(/["“]([^"”]+)["”]/),m?.[1]?.trim());B&&!t.workspace.name&&(t.workspace.name=B,t.company.name||(t.company.name=B));let C=Q(u,"workspace");C&&(t.workspace.name=C);let F=Q(u,"company");if(F&&(t.company.name=F,t.workspace.name||(t.workspace.name=F)),(!t.company.name||!t.workspace.name)&&y){let a=function(a){try{let[b]=new URL(a).hostname.replace(/^www\./,"").split(".");if(!b)return;return b.split(/[-_]+/g).filter(Boolean).map(a=>a.charAt(0).toUpperCase()+a.slice(1)).join(" ")}catch{return}}(y);a&&(t.company.name||(t.company.name=a),t.workspace.name||(t.workspace.name=a))}let G=u.match(/(?:for|serving|targeting|i[çc]in|hedef(?:imiz| kitlemiz)?|ilk kullan[ıi]c[ıi](?:lar)?|ilk m[üu][şs]teri(?:ler)?)\s+([^.!?\n]+)/i);if(G&&!t.company.targetCustomer){let a,b,c=!(a=T(G[S(G)]).replace(/^(?:yeni|bir|the|a|an|bir de|bide)\s+/i,"").replace(/\b(?:birlikte|ile|ve|veya)\b/gi," ").replace(/\b(?:olarak|diye|benim|bide)\b.*$/i,"").replace(/\s+/g," ").trim())||(b=a.toLowerCase(),/\b(yapal[ıi]m|ekleyelim|başlatal[ıi]m|kural[ıi]m|olsun|diyelim|verelim|koyal[ıi]m|kurmak|kurulum|oluşturmak|oluşturma|başlatmak|başlama|yapmak|yapma|istiyorum|istiyoruz|istemek|want|build|create|make|start|launch|setup|set up)\b/.test(b)||/\b(workspace|workspaces|workspace oluştur|workspace oluşturalım|workspace kur|workspace kuralım)\b/.test(b))?"":a;c&&(t.company.targetCustomer=c)}let H=u.match(/(?:goal|mission|we want to|build|create|amac[ıi]m[ıi]z|hedef(?:imiz)?|istiyoruz|yapmak istedi[ğg]imiz|kurmak istedi[ğg]imiz|olu[sş]turmak istedi[ğg]imiz)\s+([^.!?\n]+)/i);return H&&!t.company.mission&&(t.company.mission=T(H[S(H)])),f=t,g=v,["slack","telegram","discord","googlechat"].forEach(a=>{!g.includes("googlechat"===a?"google chat":a)||f.operations.channels.some(b=>b.type===a)||f.operations.channels.push(r(a,{name:k[a].label,purpose:"Team communication and announcements.",announce:!0}))}),function(a,b){let c=["must ","should ","cannot ","can't ","without ","need to ","olmalı","zorunda","gerek","yapmamalı","olmamalı"];for(let d of b.split(/[.!?\n]/).map(a=>a.trim()).filter(Boolean))c.some(a=>d.toLowerCase().includes(a))&&(a.company.constraints=aa([...a.company.constraints,d]))}(t,u),function(a,b,c){if(a.product.offer)return;let d=b.match(/(?:offer|product|service|platform|we are building|sunulan [şs]ey|[üu]r[üu]n|servis|platform)\s*(?:is|:)?\s*([^\n]+)/i);if(d){a.product.offer=T(d[S(d)]);return}/\btelegram\b/.test(c)&&/\b(group|community|grup|topluluk)\b/.test(c)&&(a.product.offer="Operate and automate the Telegram community experience.")}(t,u,v),h=t,(n=(i=u).match(/(?:scope|v1|mvp|kapsam|ilk s[üu]r[üu]m)\s*(?:is|:)?\s*([^\n]+)/i))&&(h.product.scopeV1=aa([...h.product.scopeV1,..._(n[S(n)])])),(o=i.match(/(?:non-goals?|not doing|yapmayaca[ğg][ıi]m[ıi]z [şs]eyler|kapsam d[ıi][şs][ıi])\s*(?:are|:)?\s*([^\n]+)/i))&&(h.product.nonGoals=aa([...h.product.nonGoals,..._(o[S(o)])])),(q=i.match(/(?:success|metric|north star|ba[sş]ar[ıi]|metrik)\s*(?:is|:)?\s*([^\n]+)/i))&&(h.company.successSignals=aa([...h.company.successSignals,..._(q[S(q)])])),j=t,l=v,/\b(şahsi asistan|kişisel asistan|personal assistant|executive assistant)\b/i.test(l)&&!j.team.persistentAgents.some(a=>/assistant/i.test(`${a.id} ${a.role} ${a.name}`))&&(j.team.persistentAgents=[p({id:"personal-assistant",role:"Personal Assistant",name:"Personal Assistant",purpose:"Own personal coordination, reminders, executive support, and operator handoffs.",responsibilities:["Track the operator's priorities and reminders","Prepare concise handoffs and action lists","Handle lightweight coordination and follow-through"],outputs:["daily brief","priority queue","assistant handoff"],enabled:!0}),...j.team.persistentAgents],"small"===j.intake.size?j.intake.size="medium":"medium"===j.intake.size&&(j.intake.size="large")),/\bdaily\b/.test(v)&&!t.operations.automations.some(a=>"daily-triage"===a.id)&&t.operations.automations.push(s({id:"daily-triage",name:"Daily triage",description:"Daily workspace review loop.",scheduleKind:"every",scheduleValue:"24h",agentId:t.team.persistentAgents.find(a=>a.enabled)?.id,mission:"Inspect the workspace, surface blockers, and leave the next handoff.",channelId:t.operations.channels[0]?.id})),/\bweekly\b/.test(v)&&!t.operations.automations.some(a=>"weekly-review"===a.id)&&t.operations.automations.push(s({id:"weekly-review",name:"Weekly review",description:"Weekly synthesis loop.",scheduleKind:"every",scheduleValue:"168h",agentId:t.team.persistentAgents.find(a=>/learn|review/i.test(a.role))?.id,mission:"Summarize progress, decisions, and next bets for the workspace.",thinking:"high",channelId:t.operations.channels[0]?.id})),E(t)}async function G(a){let b=new Date().toISOString(),c=a.deploy.blockers,d=a.deploy.warnings,e=a.operations.workflows.find(a=>a.enabled),f=a.team.persistentAgents.find(a=>a.enabled&&a.isPrimary);return[{advisorId:"founder",summary:a.company.mission&&a.company.targetCustomer?"Outcome and audience are present.":"The commercial story is still thin.",recommendations:[a.company.mission?`Mission: ${a.company.mission}`:"State the company mission in one sentence.",a.company.targetCustomer?`Target customer: ${a.company.targetCustomer}`:"Specify the first buyer or user segment.",a.product.revenueModel?`Revenue model: ${a.product.revenueModel}`:"Lock a revenue or value exchange model before launch."].filter(Boolean),concerns:a.company.successSignals.length>0?[]:["Success signals are still vague. Add measurable outcomes before deploy."]},{advisorId:"product",summary:a.product.scopeV1.length>0?`V1 scope includes ${a.product.scopeV1.length} focused items.`:"V1 scope is not explicit yet.",recommendations:[a.product.offer?`Offer: ${a.product.offer}`:"Describe the core offer or user promise.",a.product.scopeV1.length>0?`Current V1 scope: ${a.product.scopeV1.join(", ")}`:"Define a constrained V1 scope.",a.product.nonGoals.length>0?`Non-goals: ${a.product.nonGoals.join(", ")}`:"List non-goals to prevent scope creep."].filter(Boolean),concerns:a.operations.workflows.length>0?[]:["No delivery workflow is defined yet."]},{advisorId:"architect",summary:f&&e?`${f.name} can own ${e.name}.`:"Agent ownership and workflow design still need alignment.",recommendations:[`Workspace template: ${ad(a.workspace.template)}`,`Source mode: ${a.workspace.sourceMode}`,a.workspace.stackDecisions.length>0?`Stack decisions: ${a.workspace.stackDecisions.join(", ")}`:"Add the critical stack or platform decisions."].filter(Boolean),concerns:a.team.persistentAgents.some(a=>a.enabled)?[]:["No enabled agents remain in the deploy team."]},{advisorId:"ops",summary:a.operations.automations.length>0?`${a.operations.automations.length} automations are queued.`:"Operations loops are not configured yet.",recommendations:[a.operations.channels.some(a=>a.enabled)?`${a.operations.channels.filter(a=>a.enabled).length} channels are enabled.`:"Choose at least one channel or keep the team internal-only.",a.operations.automations.length>0?`Automations: ${a.operations.automations.map(a=>a.name).join(", ")}`:"Define daily or weekly maintenance loops.",`Sandbox mode: ${a.operations.sandbox.mode}`].filter(Boolean),concerns:c.length>0?c.slice(0,2):d.slice(0,2)},{advisorId:"growth",summary:a.operations.channels.some(a=>"internal"!==a.type&&a.enabled)?"External communication channels are in the plan.":"Go-to-market channels are still internal-only.",recommendations:[a.operations.channels.some(a=>"internal"!==a.type&&a.enabled)?`External channels: ${a.operations.channels.filter(a=>"internal"!==a.type&&a.enabled).map(a=>a.name).join(", ")}`:"Add Slack, Telegram, Discord, or Google Chat if the company needs external operating channels.",a.company.successSignals.length>0?`Success signals: ${a.company.successSignals.join(", ")}`:"Tie the launch to measurable success signals."].filter(Boolean),concerns:a.product.launchPriority.length>0?[]:["Launch priorities are not ordered yet."]},{advisorId:"reviewer",summary:0===c.length?"No hard deploy blockers remain.":`${c.length} deploy blocker${1===c.length?"":"s"} still need resolution.`,recommendations:[0===c.length?"You can move into final review.":`Resolve blockers: ${c.join(" | ")}`,0===d.length?"No major warnings were detected.":`Warnings: ${d.join(" | ")}`],concerns:c.length>0?c:d.slice(0,3)}].map(a=>{var c,d,e,f,h;return c=a.advisorId,d=a.summary,e=a.recommendations,f=a.concerns,h=b,{id:l(),advisorId:c,advisorName:g[c],summary:d,recommendations:$(e),concerns:$(f),createdAt:h}})}function H(a,b,c,d){let e=L(a,c);if(!a.intake.started)return m("assistant","Workspace Architect","tr"===e?"Projeyi tek mesajda anlat. Bir website URL'si, repo URL'si ya da mevcut klas\xf6r yolu yapıştır; workspace taslağını \xe7ıkarırım ve istediğin kadar revize edebiliriz.":"Describe the project in one prompt. You can paste a website URL, repo URL, or an existing folder path and I will draft the workspace, then we can revise it as many times as needed.");let f=I(a),g=f?a.deploy.blockers:[],h=J(a),i=a.intake.confirmations.slice(0,2).map(a=>{var b;return b=a,"tr"!==e?b:b.replace("What should I call the company or workspace?","Şirkete ya da workspace'e ne ad verelim?").replace("What exact outcome should this workspace optimize for first?","Bu workspace \xf6nce tam olarak hangi \xe7ıktıyı optimize etmeli?").replace("Should this start from scratch, clone a repo, or attach an existing folder?","Buna sıfırdan mı başlayalım, bir repo mu klonlayalım, yoksa mevcut bir klas\xf6r\xfc m\xfc bağlayalım?").replace("What is the smallest V1 outcome we should launch first?","İlk \xe7ıkaracağımız en k\xfc\xe7\xfck V1 sonucu ne olmalı?").replace("What should stay explicitly out of scope for V1?","V1 i\xe7in neleri \xf6zellikle kapsam dışında bırakalım?").replace("What signal should tell us this workspace is working?","Bu workspace'in işe yaradığını bize hangi sinyal g\xf6stermeli?").replace("Who is the first user or customer segment?","İlk kullanıcı ya da m\xfcşteri segmenti kim?")}),j=a.intake.inferences.slice(0,h?3:4).map(a=>`${a.label}: ${a.value}`),k=a.intake.sources.slice(Math.max(0,a.intake.sources.length-2)).map(a=>`${a.label} (${"ready"===a.status?a.kind:`${a.kind}, needs confirmation`})`),l=b.flatMap(a=>a.recommendations.slice(0,1)).slice(0,f?2:1),n=h?[]:l,o=K(a),p=function(a,b){var c;if(!a)return[];let d=[];if(a.company.name!==b.company.name&&b.company.name&&d.push(`Company name is now ${b.company.name}.`),a.workspace.name!==b.workspace.name&&b.workspace.name&&d.push(`Workspace name is now ${b.workspace.name}.`),a.company.mission!==b.company.mission&&b.company.mission&&d.push(`First outcome is ${b.company.mission}.`),a.company.targetCustomer!==b.company.targetCustomer&&b.company.targetCustomer&&d.push(`First audience is ${b.company.targetCustomer}.`),a.product.offer!==b.product.offer&&b.product.offer&&d.push(`Core offer is ${b.product.offer}.`),a.workspace.sourceMode!==b.workspace.sourceMode&&d.push(`Starting point is ${"clone"===(c=b.workspace.sourceMode)?"clone an existing repository":"existing"===c?"attach an existing folder":"start from scratch"}.`),a.intake.sources.length!==b.intake.sources.length){let c=b.intake.sources.length-a.intake.sources.length;c>0&&d.push(`Added ${c} new context source${1===c?"":"s"}.`)}return d}(d,a),q=(c||"").toLowerCase(),r=/\b(eksik|eksikleri|missing|what'?s missing|neler eksik)\b/.test(q),s=/\b(siteden|site(?:den)?|website|from the site|from the website|çıkar|extract|infer)\b/.test(q);return m("assistant","Workspace Architect",[h&&o&&!a.company.name&&!a.workspace.name?"tr"===e?`Site adını ${o.label} olarak ge\xe7ici varsayım kabul ettim.`:`I treated the site name as ${o.label} for now.`:"",p.length>0?"tr"===e?"Son y\xf6nlendirmene g\xf6re taslağı g\xfcncelledim.":`Applied: ${p.join(" ")}`:h?"tr"===e?"İlk mesajdan niyeti \xe7ıkardım; tam bir ilk taslak oluşturdum ve onu istediğin kadar revize edebiliriz.":"I pulled the intent from your first message, drafted a full first pass, and we can revise it as many times as you want.":"tr"===e?"Taslağı son y\xf6nlendirmene g\xf6re g\xfcncelledim.":"I updated the draft with your latest direction.",k.length>0?"tr"===e?`Kullandığım bağlam: ${k.join(" \xb7 ")}.`:`Context in play: ${k.join(" \xb7 ")}.`:"",j.length>0?"tr"===e?`Şu anki taslak: ${j.join(" | ")}.`:`Current draft: ${j.join(" | ")}.`:"",n.length>0&&!f?"tr"===e?`Arka plan taslağı: ${n.join(" ")}`:`Background draft: ${n.join(" ")}`:"",s&&i.length>0?"tr"===e?`Bağlı kaynaktan \xe7ıkarabildiğim her alanı doldurdum. Sayfa şu noktaları h\xe2l\xe2 belirsiz bırakıyor: ${i.join("; ")}.`:`I filled what I could from the linked context. The page still leaves these items ambiguous: ${i.join("; ")}.`:r&&i.length>0?"tr"===e?`H\xe2l\xe2 eksik ya da d\xfcş\xfck g\xfcvenli noktalar: ${i.join("; ")}.`:`Still missing or low-confidence: ${i.join("; ")}.`:!f&&i.length>0?1===i.length?"tr"===e?`Sıradaki tek not şu: ${i[0]}`:`I still have one unresolved note: ${i[0]}`:"tr"===e?`Sıradaki iki not şu: ${i[0]} Sonra ${V(i[1])}`:`I still have two unresolved notes: ${i[0]} Then ${V(i[1])}`:f&&i.length>0?"tr"===e?`Deploy \xf6ncesi şu notları ele alalım: ${i.join("; ")}.`:`Before deploy, address: ${i.join("; ")}.`:g.length>0?"tr"===e?`DEPLOY \xf6ncesi h\xe2l\xe2 şunlara ihtiyacım var: ${g.join("; ")}.`:`Before DEPLOY I still need: ${g.join("; ")}.`:f?"tr"===e?"Blueprint yapısal olarak DEPLOY i\xe7in hazır. Uyarıları bir kez g\xf6zden ge\xe7irip ardından launch edebiliriz.":"Blueprint is structurally ready for DEPLOY. Review warnings once, then launch.":"tr"===e?"Taslak hazır ve revize edilmeye a\xe7ık. İstersen şimdi gelişmiş edit\xf6r\xfc a\xe7ayım ya da devam eden değişiklikleri birlikte yapalım.":"The draft is ready and open for revision. If you want, I can open the advanced editor or keep iterating with you.",c&&0===p.length&&!h?"tr"===e?`Son y\xf6nlendirmeyi kaydettim: "${c.trim()}".`:`Latest direction captured: "${c.trim()}".`:""].filter(Boolean).join("\n\n"))}function I(a){return a.intake.reviewRequested||"deploying"===a.status||"deployed"===a.status}function J(a){return a.intake.turnCount<=1&&!a.intake.reviewRequested}function K(a){return a.intake.sources.find(a=>"website"===a.kind&&"ready"===a.status&&"number"==typeof a.confidence&&a.confidence<80&&!!a.label)}function L(a,b){for(let c of[b,...a.conversation.slice().reverse().filter(a=>"user"===a.role).map(a=>a.text),a.intake.latestPrompt,a.intake.initialPrompt]){let a=M(c);if(a)return a}return"en"}function M(a){return!function(a){let b=a?.trim();if(!b)return!1;if(/[çğıöşüÇĞİÖŞÜ]/.test(b))return!0;let c=b.toLowerCase().match(/\b(ve|bir|bu|şu|için|ile|olarak|olan|mı|mi|mu|mü|ne|nasıl|hangi|neden|hedef|ilk|müşteri|kullanıcı|oluştur|gerekli|alanları|yardımcı)\b/g);return!!(c&&c.length>=2)}(a)?!function(a){let b=a?.trim();if(!b||/[çğıöşüÇĞİÖŞÜ]/.test(b))return!1;let c=b.toLowerCase().match(/\b(let'?s|the|and|for|with|from|this|that|what|how|why|when|where|who|should|could|would|need|want|start|build|create|launch|project|workspace|customer|user|team|goal|mission|review|deploy|product|website|repo|folder)\b/g);return!!(c&&c.length>=2)}(a)?null:"en":"tr"}function N(a){return/\b(from scratch|greenfield|empty workspace|clone|repo|existing folder|existing workspace|s[ıi]f[ıi]rdan|mevcut klas[oö]r|mevcut repo|bo[sş])\b/i.test(a)}function O(a,b){let c=`${a.intake.initialPrompt} ${a.intake.latestPrompt}`.toLowerCase(),d=a.intake.sources.filter(a=>"ready"===a.status),e=66;return d.length>0&&(e+=8),a.intake.turnCount>1&&(e+=6),("template"===b&&/\b(telegram|discord|community|topluluk|grup|content|marketing|research|frontend|backend)\b/.test(c)||"source-mode"===b&&N(c)||"channels"===b&&/\b(slack|telegram|discord|google chat)\b/.test(c))&&(e+=10),"company-name"===b&&d.some(a=>"website"===a.kind)&&(e+=6),"target-customer"!==b||a.company.targetCustomer||(e-=18),("workflow"===b||"team"===b)&&(e-=4),Math.max(52,Math.min(96,e))}function P(a,b){return a.includes(b)?"needs-confirmation":"inferred"}function Q(a,b){let c="workspace"===b?["workspace","workspace name","project","project name","proje","proje adı","proje ismi"]:["company","company name","firma","firma adı","şirket","şirket adı","company name"],d=["name","adı","adını","ismi","ismini"],e=["is","should be","=",":","olsun","diyelim","verelim","koyalım","yap","yapalım","değiştir","değiştirelim","olarak ayarla"];for(let b of[RegExp(`\\b(?:${c.join("|")})\\b\\s+(?:${d.join("|")})\\s*(?:${e.join("|")})?\\s*([\\p{L}\\p{N}][\\p{L}\\p{N}._ -]{1,40}(?:\\s+[\\p{L}\\p{N}][\\p{L}\\p{N}._ -]{1,40}){0,2})(?=\\s+(?:${e.join("|")}|olarak|i\xe7in)\\b|[.!?,]|$)`,"iu"),RegExp(`\\b(?:${d.join("|")})\\b\\s*(?:of\\s+)?(?:${c.join("|")})?\\s*(?:${e.join("|")})?\\s*([\\p{L}\\p{N}][\\p{L}\\p{N}._ -]{1,40}(?:\\s+[\\p{L}\\p{N}][\\p{L}\\p{N}._ -]{1,40}){0,2})(?=\\s+(?:${e.join("|")}|olarak|i\xe7in)\\b|[.!?,]|$)`,"iu"),RegExp(`\\b(?:${c.join("|")})\\b\\s+(?:${d.join("|")})\\s+(?:${e.join("|")})\\s+([\\p{L}\\p{N}][\\p{L}\\p{N}._ -]{1,40}(?:\\s+[\\p{L}\\p{N}][\\p{L}\\p{N}._ -]{1,40}){0,2})(?=\\s+(?:olarak|i\xe7in)\\b|[.!?,]|$)`,"iu")]){let c=function(a){let b=T(a).replace(/\b(projesi|projesini|workspace|project|company|firma|şirket)\b/gi," ").replace(/\b(yapal[ıi]m|ekleyelim|kural[ıi]m|başlatal[ıi]m|olsun|diyelim|verelim|koyal[ıi]m|kurmak|kurulum|oluşturmak|oluşturma|başlatmak|başlama|yapmak|yapma|istiyorum|istiyoruz|istemek|want|build|create|make|start|launch|setup|set up)\b/gi," ").replace(/\b(yeni|bir)\b/gi," ").replace(/\b(diye|olarak|benim|bide|bir de|için)\b.*$/i,"").replace(/\s+/g," ").trim();return!b||U(b)?"":b}(a.match(b)?.[1]?.trim()??"");if(c)return c}}function R(a){try{let b=new URL(a),c=b.hostname.toLowerCase(),d=b.pathname.toLowerCase();return"github.com"===c||"gitlab.com"===c||"bitbucket.org"===c||d.endsWith(".git")}catch{return!1}}function S(a){return a.length-1}function T(a){return a.replace(/https?:\/\/[^\s)]+/g," ").replace(/\s+/g," ").replace(/^[\s:,-]+|[\s:,-]+$/g,"").trim()}function U(a){let b=a.toLowerCase();return/\b(yapal[ıi]m|ekleyelim|başlatal[ıi]m|kural[ıi]m|olsun|diyelim|verelim|koyal[ıi]m|kurmak|kurulum|oluşturmak|oluşturma|başlatmak|başlama|yapmak|yapma|istiyorum|istiyoruz|istemek|want|build|create|make|start|launch|setup|set up)\b/.test(b)}function V(a){return a?a.charAt(0).toLowerCase()+a.slice(1):a}function W(a,b){return a.find(a=>RegExp(b,"i").test(`${a.id} ${a.role} ${a.name}`))?.id}function X(a){return a.filter((a,b,c)=>c.findIndex(b=>b.id===a.id)===b)}function Y(a){return a.trim()}function Z(a){return a?.trim()||void 0}function $(a){return aa((a??[]).flatMap(a=>_(a)).map(a=>a.trim()).filter(Boolean))}function _(a){return a.split(/\r?\n|,/g).map(a=>a.trim()).filter(Boolean)}function aa(a){return Array.from(new Set(a.filter(Boolean)))}function ab(a){return structuredClone(a)}function ac(a){return a.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function ad(a){return a.split(/[-_]/g).filter(Boolean).map(a=>a[0].toUpperCase()+a.slice(1)).join(" ")}},97639:(a,b,c)=>{c.d(b,{R2:()=>s,Mt:()=>y,Nr:()=>t,r2:()=>x,Td:()=>w,gO:()=>v,Q4:()=>u});var d=c(51455),e=c(76760),f=c.n(e),g=c(39503),h=c(93628),i=c(37037),j=c(9738),k=c(14853),l=c(24767);let m=f().join(process.cwd(),".mission-control","planner"),n=f().join(m,"plans"),o=f().join(m,"runtime-workspace"),p="AgentOS Planner Runtime",q=[{id:"architect",role:"Workspace Architect",name:"Workspace Architect",enabled:!0,isPrimary:!0,emoji:"\uD83E\uDD16",theme:"cyan",skillId:"planner-architect",policy:(0,h.g0)("worker",{fileAccess:"workspace-only",networkAccess:"enabled"}),heartbeat:{enabled:!1}},{id:"founder",role:"Founder",name:"Founder",enabled:!0,emoji:"\uD83C\uDFD7️",theme:"amber",skillId:"planner-founder",policy:(0,h.g0)("worker",{fileAccess:"workspace-only",networkAccess:"enabled"}),heartbeat:{enabled:!1}},{id:"product",role:"Product Lead",name:"Product Lead",enabled:!0,emoji:"\uD83D\uDCD0",theme:"emerald",skillId:"planner-product",policy:(0,h.g0)("worker",{fileAccess:"workspace-only",networkAccess:"enabled"}),heartbeat:{enabled:!1}},{id:"ops",role:"Operations",name:"Operations",enabled:!0,emoji:"⚙️",theme:"blue",skillId:"planner-ops",policy:(0,h.g0)("worker",{fileAccess:"workspace-only",networkAccess:"enabled"}),heartbeat:{enabled:!1}},{id:"growth",role:"Growth",name:"Growth",enabled:!0,emoji:"\uD83D\uDCE3",theme:"violet",skillId:"planner-growth",policy:(0,h.g0)("worker",{fileAccess:"workspace-only",networkAccess:"enabled"}),heartbeat:{enabled:!1}},{id:"reviewer",role:"Reviewer",name:"Reviewer",enabled:!0,emoji:"\uD83D\uDD0D",theme:"rose",skillId:"planner-reviewer",policy:(0,h.g0)("worker",{fileAccess:"workspace-only",networkAccess:"enabled"}),heartbeat:{enabled:!1}}],r=["founder","product","ops","growth","reviewer"];async function s(){let a=(0,j.x7)();return await B(a),{plan:a}}async function t(a){return{plan:await A(a)}}async function u(a,b){return{plan:await z(a,b)}}async function v(a,b,c){var d;let e=b.trim();if(!e)throw Error("Planner message is required.");let f=c?await z(a,c):await A(a),g=Y(e),h=(0,j.xP)((0,j.eR)(f),e);h.conversation.push((0,j.kI)("user","Operator",e));let i=await g;h.intake.sources=function(a,b){let c=[...a];for(let a of b){let b=c.findIndex(b=>b.url&&a.url?b.url===a.url:b.id===a.id);if(b>=0){c[b]=a;continue}c.push(a)}return c}(h.intake.sources,i.sources);let k=!(d=h=(0,j.eR)(h)).intake.reviewRequested&&d.intake.turnCount<=1&&"ready"!==d.runtime.status?h:await F(h),l=k.autopilot&&(k.intake.reviewRequested||k.intake.turnCount>2)?await H(k,e):[];k.advisorNotes=l;let m=await I(k,e,i,l,f);return(h=m.plan).conversation.push((0,j.kI)("assistant","Workspace Architect",m.reply)),h=(0,j.eR)(h),await B(h),{plan:h}}async function w(a,b){let c=b.path.trim();if(!c)throw Error("Document path is required.");let d=b.plan?await z(a,b.plan):await A(a),e=await F((0,j.eR)(d)),f=b.instruction?.trim()||"Rewrite this document to improve clarity, usefulness, and consistency with the workspace context.",g=await J(e,c,b.currentContent,f),h=g.plan;return h.conversation.push((0,j.kI)("assistant","Workspace Architect",g.reply)),h=(0,j.eR)(h),await B(h),{plan:h,reply:g.reply}}async function x(a,b){let c=b?await z(a,b):await A(a),d=await F((0,j.eR)(c)),e=await H(d,"Simulate the specialist planning board.");d.advisorNotes=e;let f=await I(d,"Simulate the specialist planning board and tell me what you would refine next.",{sources:d.intake.sources,confirmations:d.intake.confirmations,inferenceText:d.intake.inferences.map(a=>`${a.label}: ${a.value}`).join("\n"),companyName:d.company.name||void 0,mission:d.company.mission||void 0,offer:d.product.offer||void 0,template:d.workspace.template},e,c);(d=f.plan).conversation.push((0,j.kI)("assistant","Workspace Architect",f.reply));let g=(0,j.eR)(d);return await B(g),{plan:g}}async function y(a,b,c={}){let d=b?await z(a,b):await A(a),e=(0,j.eR)({...d,intake:{...d.intake,reviewRequested:!0}}),f=e.team.persistentAgents.filter(a=>a.enabled).length,g=e.operations.channels.some(a=>a.enabled&&"internal"!==a.type),h=e.operations.automations.some(a=>a.enabled),k=e.deploy.firstMissions.some(a=>a.trim().length>0),m=(0,i.X6)({template:(0,i.Bb)({sourceMode:e.workspace.sourceMode,agentCount:f,kickoffMission:e.workspace.rules.kickoffMission,hasChannels:g,hasAutomations:h,hasPlannerKickoffs:k}),onProgress:c.onProgress});if(await m.startStep("plan","Checking deploy blockers and locking the planner state."),e.deploy.blockers.length>0){let a=`Resolve deploy blockers first: ${e.deploy.blockers.join(" ")}`;throw await m.addActivity("plan",a,"error"),await m.failStep("plan",a),Error(`Resolve deploy blockers first: ${e.deploy.blockers.join(" ")}`)}await m.addActivity("plan","Deploy blockers cleared.","done"),e.status="deploying",e.stage="deploying",await B(e),await m.completeStep("plan","Planner state locked. Workspace bootstrap is starting.");try{var n,o,p;let a,b,c=(a=(n=e).team.persistentAgents.filter(a=>a.enabled),{name:n.workspace.name,brief:[(o=n).company.mission?`Mission: ${o.company.mission}`:"",o.company.targetCustomer?`Target customer: ${o.company.targetCustomer}`:"",o.product.offer?`Offer: ${o.product.offer}`:"",o.product.scopeV1.length>0?`V1 scope: ${o.product.scopeV1.join(", ")}`:"",o.product.nonGoals.length>0?`Non-goals: ${o.product.nonGoals.join(", ")}`:"",o.company.successSignals.length>0?`Success signals: ${o.company.successSignals.join(", ")}`:"",o.workspace.stackDecisions.length>0?`Stack decisions: ${o.workspace.stackDecisions.join(", ")}`:""].filter(Boolean).join("\n"),directory:n.workspace.directory,modelId:n.workspace.modelId,sourceMode:n.workspace.sourceMode,repoUrl:n.workspace.repoUrl,existingPath:n.workspace.existingPath,template:n.workspace.template,teamPreset:"custom",modelProfile:n.workspace.modelProfile,docOverrides:n.workspace.docOverrides,rules:{...n.workspace.rules,workspaceOnly:n.operations.sandbox.workspaceOnly},agents:a.map(T)}),d=await (0,l.zw)(c,{onProgress:async a=>{for(let b of a.steps)await m.syncStep(b)}});await m.startStep("blueprint","Writing planner blueprint and deploy notes into the new workspace."),await m.addActivity("blueprint","Persisting planner blueprint, deploy report, and docs."),await U(e,d.workspacePath,d),await m.completeStep("blueprint","Planner blueprint and docs are now in the workspace.");let f=(p=e,b=ap(p.workspace.name),Object.fromEntries(p.team.persistentAgents.filter(a=>a.enabled).map(a=>[a.id,`${b}-${ap(a.id)||"agent"}`])));await m.startStep("channels",g?"Provisioning enabled external channels.":"No external channels were requested."),g||await m.addActivity("channels","No enabled external channels. Skipping channel provisioning.","done");let i=await V(e.operations.channels,{onProgress:async({message:a,percent:b,status:c})=>{await m.updateStep("channels",{percent:b,detail:a,status:"error"===c?"active":void 0}),await m.addActivity("channels",a,c)}});await m.completeStep("channels",g?`${i.provisioned.length} channel${1===i.provisioned.length?"":"s"} provisioned.`:"Channel stage complete."),await m.startStep("automations",h?"Provisioning enabled automation loops.":"No recurring automations were requested."),h||await m.addActivity("automations","No enabled automations. Skipping automation provisioning.","done");let q=await W(e,d.workspaceId,f,{onProgress:async({message:a,percent:b,status:c})=>{await m.updateStep("automations",{percent:b,detail:a,status:"error"===c?"active":void 0}),await m.addActivity("automations",a,c)}});await m.completeStep("automations",h?`${q.provisioned.length} automation${1===q.provisioned.length?"":"s"} provisioned.`:"Automation stage complete."),await m.startStep("planner-kickoff",k?"Dispatching planner kickoff missions.":"No planner kickoff missions were requested."),k||await m.addActivity("planner-kickoff","No planner kickoff missions. Finalizing deploy.","done");let r=await X(e,d.workspaceId,f,{onProgress:async({message:a,percent:b,status:c})=>{await m.updateStep("planner-kickoff",{percent:b,detail:a,status:"error"===c?"active":void 0}),await m.addActivity("planner-kickoff",a,c)}});await m.completeStep("planner-kickoff",k?`${r.length} kickoff mission${1===r.length?"":"s"} launched.`:"Deploy finalized without extra kickoff missions.");let s=aq([...e.deploy.warnings,...i.warnings,...q.warnings]);e.deploy={...e.deploy,blockers:[],warnings:s,lastDeployedAt:new Date().toISOString(),workspaceId:d.workspaceId,workspacePath:d.workspacePath,primaryAgentId:d.primaryAgentId,createdAgentIds:d.agentIds,provisionedChannels:i.provisioned,provisionedAutomations:q.provisioned,kickoffRunIds:aq([...d.kickoffRunId?[d.kickoffRunId]:[],...r])},e.status="deployed",e.stage="deployed",e.conversation.push((0,j.kI)("assistant","Workspace Architect",`DEPLOY completed. Workspace ${d.workspacePath} is live with ${d.agentIds.length} agent${1===d.agentIds.length?"":"s"}.`));let t=(0,j.eR)(e);return t.status="deployed",t.stage="deployed",await B(t),{plan:t,workspaceId:d.workspaceId,workspacePath:d.workspacePath,primaryAgentId:d.primaryAgentId,agentIds:d.agentIds,kickoffRunIds:t.deploy.kickoffRunIds,warnings:s}}catch(a){throw e.status="blocked",e.stage="pressure-test",e.deploy.warnings=aq([...e.deploy.warnings,a instanceof Error?a.message:"Planner deploy failed."]),await B((0,j.eR)(e)),a}}async function z(a,b){let c=await A(a).catch(()=>(0,j.x7)(a)),d=(0,j.eR)({...c,...b,id:a,createdAt:c.createdAt,runtime:{...c.runtime,...b.runtime},deploy:{...c.deploy,...b.deploy}});return await B(d),d}async function A(a){let b=C(a),c=await (0,d.readFile)(b,"utf8");return(0,j.eR)(JSON.parse(c))}async function B(a){let b=C(a.id);await (0,d.mkdir)(f().dirname(b),{recursive:!0}),await (0,d.writeFile)(b,`${JSON.stringify(a,null,2)}
|
|
2
2
|
`,"utf8")}function C(a){return f().join(n,`${a}.json`)}let D={founder:"Founder",product:"Product Lead",ops:"Operations",growth:"Growth",reviewer:"Reviewer",architect:"Workspace Architect"},E={"planner-architect":`# Workspace Architect
|
|
3
3
|
|
|
4
4
|
You are the primary planning agent for AgentOS.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
globalThis.__BUILD_MANIFEST={polyfillFiles:["static/chunks/polyfills-42372ed130431b0a.js"],devFiles:[],lowPriorityFiles:["static/
|
|
1
|
+
globalThis.__BUILD_MANIFEST={polyfillFiles:["static/chunks/polyfills-42372ed130431b0a.js"],devFiles:[],lowPriorityFiles:["static/uAxTxVvm7tdXyEJ7SnLpD/_buildManifest.js","static/uAxTxVvm7tdXyEJ7SnLpD/_ssgManifest.js"],rootMainFiles:["static/chunks/webpack-49728cc9bb386219.js","static/chunks/f6503f1c-7df4e7c4564148dc.js","static/chunks/4424-08671f25c8f9ae84.js","static/chunks/main-app-9a4481b0ab7b57f6.js"],rootMainFilesTree:{},pages:{"/_app":[]}};
|