module.exports=[14116,e=>{"use strict";var t=e.i(14747),i=e.i(24868),s=e.i(22734),n=e.i(25289),o=e.i(20993),a=e.i(48705),r=e.i(5779),l=e.i(76430),d=e.i(85824),c=e.i(43127),u=e.i(8035),h=e.i(28177);let p=e=>t.default.join(process.cwd(),"data","employees",e);async function m(e){let m,{employee:f,ceoContext:y,onEvent:g,lookbackDays:w}=e,b=Date.now(),v=()=>Date.now()-b;if(!Number.isFinite(w)||w<30||w>360){g({type:"error",message:`lookbackDays must be between 30 and 360 (got ${w}).`,ts:v()}),g({type:"done",filesWritten:[],turns:0,costUsd:0,stoppedReason:"lookback_out_of_range",ts:v()});return}let _=p(f.id);await i.default.mkdir(_,{recursive:!0});let[k,E,S]=await Promise.all([(0,o.readState)(f.id),(0,o.buildEmployeeMcpServer)(f.id),(0,a.loadOrgCustomMcpServers)()]),I=Object.values(k.connections).filter(e=>"ACTIVE"===e.status).map(e=>e.toolkit);if(g({type:"start",employeeId:f.id,activeToolkits:I,activeLookbackDays:w,ts:v()}),!E&&0===Object.keys(S).length){g({type:"error",message:"No connected systems. Connect at least one toolkit at /connections/"+f.id+" before building the twin.",ts:v()}),g({type:"done",filesWritten:[],turns:0,costUsd:0,stoppedReason:"no_connections",ts:v()});return}let T={...S,...E?{composio:E}:{}},$=new Set(h.TWIN_FILE_NAMES),R=t.default.resolve(_),A=async(e,i)=>{let s=i??{};if("Write"===e){let i="string"==typeof s.file_path?s.file_path:"",n=t.default.resolve(_,i),o=t.default.basename(n);if(!n.startsWith(R+t.default.sep)&&n!==R){let t=`Write blocked: ${i} is outside ${_}.`;return g({type:"tool_blocked",tool:e,reason:t,ts:v()}),{behavior:"deny",message:t}}if(!$.has(o)){let e=`Filename ${o} is not one of the 9 twin profile files (${h.TWIN_FILE_NAMES.join(", ")}).`;return g({type:"file_blocked",filename:o,reason:e,ts:v()}),{behavior:"deny",message:e}}let a="string"==typeof s.content?s.content:"";try{(0,l.snapshotRootFile)(f.id,o,"builder",{buildId:x})}catch(t){let e=t instanceof Error?t.message:String(t);console.warn(`[twin-versions] pre-write snapshot skipped: ${e}`)}return g({type:"file_writing",filename:o,content:a,ts:v()}),{behavior:"allow",updatedInput:{...s,file_path:n}}}if("Read"===e||"Glob"===e||"Grep"===e)return{behavior:"allow",updatedInput:s};let n=(0,r.classifyTool)(e,s);if("allow"===n.kind)return{behavior:"allow",updatedInput:s};let o="block"===n.kind?n.reason:`Twin builder is read-only — ${e} blocked. Use *_GET_* / *_LIST_* / *_SEARCH_* / *_FETCH_* / *_RETRIEVE_* / *_FIND_* / *_READ_* tools to gather evidence.`;return g({type:"tool_blocked",tool:e,reason:o,ts:v()}),{behavior:"deny",message:o}},N=(m=p(f.id),h.TWIN_FILE_NAMES.filter(e=>{try{let i=s.default.statSync(t.default.join(m,e));return i.isFile()&&i.size>0}catch{return!1}})),C=new Map;for(let e of h.TWIN_FILE_NAMES)try{C.set(e,s.default.statSync(t.default.join(_,e)).mtimeMs)}catch{}let O=new Set,L=function(e){let{employee:t,ceoContext:i,employeeDir:s,activeToolkits:n,orgMcpNames:o,existingFiles:a,lookbackDays:r}=e,l=t.firstName,d=[{name:"CONTEXT.md",spec:`The company + role context the twin needs to reason like ${l}: company name & stage, business model, target customer, current quarter focus, real day-to-day constraints, the political map (who has influence, where the friction is). **Evidence preference order:** email signatures + calendar invites ${l} sent or organized → Slack channels they're most active in (channel names + their topics) → Notion/Drive docs they authored or last edited → Linear cycle goals they own. Avoid generic boilerplate ("a fast-paced startup"); the CEO needs the *specific* current reality.`},{name:"EXPERTISE.md",spec:`${l}'s technical/functional expertise as a **light SWOT**:

  - **Strengths (3–5)** — domains they're authoritative on, with verbatim evidence (e.g. "led the migration from X to Y per PR #1234", "authored 4 specs on retrieval ranking in Notion"). Recognize patterns: what kinds of problems do they take on first?
  - **Weaknesses / gaps (1–3)** — be honest. Even senior people have areas they avoid, defer, or get pushback on. Look for: topics they CC their manager on, threads they hand off, problems they ask others to solve. If you genuinely can't find any, say "(no observable gaps in available signals)" — don't invent.
  - **Adjacent opportunities** — areas where their existing strengths give them a natural next step.

  Cite the tool calls and quote the evidence. The CEO uses this section to know when to push and when to defer to ${l}.`},{name:"PROJECTS.md",spec:`Active and recent projects with a **mini Threats/Opportunities pass per project**:

  - **Project name → ${l}'s role → current status → next milestone → blockers → threats → opportunities.**
  - Evidence preference: Linear/Jira issues *assigned to or created by* ${l} (not just visible to them); GitHub PRs they authored; Notion project pages they edited in the last ${r} days; calendar events they organize for that project.
  - "Threats" = what could derail it (resource, dependency, deadline, political).
  - "Opportunities" = what would 10x it if they leaned in.
  - Avoid listing projects they're peripherally CC'd on — that's noise, not their actual work.`},{name:"PEOPLE.md",spec:`Real teammates ${l} works with — and the **power dynamics**, not just an org-chart dump:

  - **Who they defer to** (escalate decisions to, ask for sign-off, CC for cover): ${l}'s manager + anyone whose name shows up disproportionately as the recipient of "wanted to flag…" / "checking with you on…" / "your call".
  - **Who they manage / mentor** (their team, their reports, anyone they coach in Slack DMs).
  - **Peers they collaborate most with** (top 3–5 by Slack DM frequency, recurring 1:1 calendar slots, GitHub co-review pairs).
  - **External counterparts** (customers, vendors, contractors) named in their sent emails.
  - Use signals like Slack DM frequency, GitHub PR reviewers, recurring calendar attendees. Don't list every name; rank by signal strength.`},{name:"DECISIONS.md",spec:`${l}'s **decision-making fingerprint** — how they think, with examples:

  - **Decision style:** decisive vs deliberative? Data-led vs intuition-led? Build vs buy? Fast iteration vs careful design?
  - Look for hedging vs assertive language: "I think we should…" / "let me check with X first" vs "do this" / "shipping Friday" / "no, we're not doing that". Quantify if you can ("~70% of their PR reviews end with a specific ask, ~30% are open questions").
  - **3–5 example decisions** with: the situation, ${l}'s position (verbatim quote ≤30 words), the rationale, the outcome if visible. Pull from PR descriptions, design-doc comments, Linear issue threads, Slack threads where they pushed back.
  - **How they say no:** hard refusal? Soft deferral ("not now, let's revisit Q3")? Redirect ("the bigger problem is…")? This is gold for the CEO.`},{name:"PREFERENCES.md",spec:`How ${l} actually operates day-to-day — the **behavioral signature**:

  - **Meeting style:** load (meetings/day), preferred lengths, decline rate, who they decline (and who they always accept). Recurring blocks (deep-work mornings? no-meeting Wednesdays?).
  - **Communication cadence:** when do they ship messages — early morning, late night, weekends? Reply latency. Do they batch responses or interleave with deep work?
  - **Tooling preferences:** when given the choice, which tool do they reach for? (Linear vs GitHub Issues? Notion vs Google Docs? Slack DM vs email?)
  - **Process patterns:** doc structures they reuse, recurring agenda templates, how they run a kickoff or retro.

  Evidence is in calendar (organizer/attendee data, accept/decline patterns), Slack timestamps, GitHub commit times, Gmail send-time histogram.`},{name:"TONE.md",spec:`${l}'s voice — the highest-NLP file, must read like a linguistic fingerprint a colleague would recognize:

  - **Voice fingerprint:** typical greeting/opening, typical sign-off, typical length (one-liner Slacker vs paragraph composer), formality level, presence/absence of humor.
  - **Lexical patterns:** 3–6 words or phrases they reuse ("the right call here", "shipping it", "let me think on it"). Quote them.
  - **Hedging vs decisiveness:** measure roughly. Do they say "maybe / I think we should" or "we need to / let's just"?
  - **How they praise:** generic ("great job") vs specific (name + concrete reason). With evidence.
  - **How they push back:** soft questions, hard "no", or pivot ("the better question is…")?
  - **Formality gradient:** how does their tone shift between writing to (a) their team, (b) execs/board, (c) external customers? Quote one example of each if you can.
  - **Required:** ≥6 verbatim quotes, each ≤25 words, no PII (no last names of non-public people, no phone numbers, no internal customer names). **Source priority is critical here:** these MUST come from messages ${l} *sent* (Gmail \`in:sent\`, Slack \`from:@<their_handle>\`, PR descriptions/comments authored by them). Received messages are useless for this file.`},{name:"BOUNDARIES.md",spec:`Topics where the twin must escalate to the human ${l}. Default enterprise list (compensation, hiring decisions, legal, PR/comms, anything that creates legal commitment) is fine as a baseline, but **derive org-specific boundaries from the data when possible**: which topics does ${l} consistently route to a specific other person? ("redirects pricing questions to @sales-leader") — that's a boundary. Phrase as "twin should NOT do X without first checking with ${l} or @<person>." If signal is thin, default to the enterprise list explicitly.`},{name:"EMPLOYMENT.md",spec:"HR-style record: title, manager (if discoverable from email/calendar/Slack), direct reports if any (recurring 1:1s, code-review delegates, mentees), peers (frequent collaborators at the same level), tenure (estimate from earliest message date if you can, else mark as unknown), certifications/credentials visible in signatures or LinkedIn-style sources. **Public information only — never compensation, never home address, never private contact info.**"}];return`You are an **HR psychologist + workplace ethnographer** building a behavioral profile of a real person. The output is 9 markdown files that will permanently ground a digital twin of ${l}. The twin then chats and acts on the CEO's behalf using these files as its identity, so the profile has to be one their own colleagues would recognize as accurate — not a generic corporate bio.

You are NOT a content generator. You are reading between the lines of a digital trail. Apply the same skills a great manager applies on day-30 of a new hire: pattern recognition, NLP, behavioral analysis, light SWOT thinking.

# Subject

- **Employee id:** ${t.id}
- **Name:** ${t.name}
- **Role:** ${t.role}
- **First name (used by the twin in conversation):** ${l}
${i?`
## What the CEO told us about ${l}

${i}
`:""}

# Lookback window

All evidence gathering should focus on the **last ${r} days** of ${l}'s digital trail. When a toolkit accepts a date filter (Gmail \`after:\`, Slack \`after:\`, GitHub \`updated:>\`, Linear \`updatedAt\`, Calendar \`timeMin\`), scope the query to roughly \`now - ${r} days\` so you don't burn budget on stale signal. Older signal is only useful as fallback if the recent window is thin.

# Available systems

${n.length>0?`- **Composio MCP** (\`mcp__composio__*\`) — ${l}'s personal SaaS connections currently ACTIVE: ${n.join(", ")}.
  - Discover with the toolkit-specific list/search tools, then read.
  - Pattern: \`mcp__composio__<TOOLKIT>_<VERB>_<OBJECT>\` — e.g. \`mcp__composio__GITHUB_LIST_PULL_REQUESTS\`, \`mcp__composio__SLACK_SEARCH_MESSAGES\`, \`mcp__composio__GMAIL_FETCH_EMAILS\`, \`mcp__composio__GOOGLECALENDAR_LIST_EVENTS\`.`:"- (No Composio toolkits active — rely on org-level MCP only.)"}
${o.length>0?`- **Org-wide MCP servers** — workspace-level tools: ${o.map(e=>`\`mcp__${e}__*\``).join(", ")}.`:""}
- **Local Read/Write/Glob/Grep** — write the 9 markdown files into \`${s}\`. The Write tool is sandboxed to that directory and to the 9 known filenames; any other path will be denied.

# Source priority — outgoing > incoming, authored > assigned

A profile built from messages someone *received* tells you about THEM, not about how THEY think. Always prefer:

| Toolkit | Strong signal (use first) | Weak signal (last resort) |
|---|---|---|
| **Gmail** | Sent emails (\`in:sent\`, \`from:me\`) — their voice + decisions in writing | Received emails (only useful for context on who's writing TO them) |
| **Slack** | Messages they posted (\`from:@<their_handle>\`), threads they replied in | Channels they're a passive member of |
| **GitHub** | PRs *authored* by them, review comments *by* them, issues they opened | PRs assigned to them as reviewer (passive) |
| **Calendar** | Events they ORGANIZED (organizer = them), declines they sent | Events they were merely invited to |
| **Notion / Drive** | Docs they CREATED or edited recently | Docs shared with them |
| **Linear / Jira** | Issues they CREATED or are ASSIGNEE on | Issues they're CC'd on |

When you have multiple toolkits, **start with the strong-signal source for each file**. For TONE.md specifically, only sent/authored content has any value at all — received messages are noise.

# Reading between the lines (apply throughout)

While you read, watch for these signals — they feed the file specs below:

- **Lexical patterns**: words/phrases they reuse, terms-of-art they coined, opening/closing rituals.
- **Hedging vs decisiveness**: "maybe / I think / let's not" vs "do this / no / shipping Friday".
- **How they say no**: hard refusal, soft deferral, redirection, silent ignore.
- **How they praise**: name + specific reason, or generic "great work".
- **Formality gradient**: with whom do they get more formal, with whom more casual?
- **Power dyads**: who do they always CC? Who do they DM most? Who do they decline meetings from / always accept from?
- **Time-of-day patterns**: morning shipper vs night writer? Weekend worker?
- **Message-length distribution**: one-liner vs essayist?

Don't dump these as raw observations — fold them into the relevant file's narrative.

# Goal — produce these 9 files

${d.map(e=>`## ${e.name}
${e.spec}`).join("\n\n")}

${a.length>0?`
# Existing files on disk (you may overwrite to improve)

${a.join(", ")}
`:""}

# Operating rules

1. **Plan first.** Open with a short plan (3–8 sentences): for each of the 9 files, name the strongest signal source you have access to. If a file has no good signal source available, say so explicitly in the plan — that's a quality-score input, not a failure mode.
2. **Read-only only.** You may search, list, fetch, read, retrieve. You may NOT post messages, create issues, send emails, or mutate any external system. The platform will deny any write tool you try.
3. **Ground every claim in evidence.** Every assertion in a file must trace back to a tool result you saw. Do not invent teammates, projects, or decisions. Quoted phrases must be VERBATIM (with light truncation marked "…") from the agent's own writing — never paraphrased then quoted.
4. **Honesty over completeness.** If you can only access 1 toolkit, your profile WILL be low-quality on 5–7 of the 9 files. **DO NOT compensate by inventing detail.** Write \`(insufficient evidence — only <toolkit> available; this section is best-effort)\` and move on. The CEO sees a low Twin Quality score and knows what to fix. **Faking depth is the worst possible outcome — the twin will then confidently say wrong things in the CEO's name.**
5. **Frontmatter every file.** Each file starts with YAML frontmatter:
   \`\`\`
   ---
   employee: ${t.id}
   file: <FILENAME>.md
   generatedAt: <ISO timestamp>
   sources: [list of toolkits + specific tool actions used]
   confidenceNote: "high|medium|low — one short reason"
   ---
   \`\`\`
6. **Quality bar.** Each file should be 600–2,500 chars of substantive, evidence-grounded content. Use markdown sections, lists, and verbatim quotes. Never write "Lorem ipsum", "TBD", or filler.
7. **One file per Write call.** Always invoke \`Write\` with \`file_path\` set to just the filename (\`CONTEXT.md\`) — the cwd is already \`${s}\`. Do not batch multiple files into one Write.
8. **Don't quote PII.** Phone numbers, home addresses, government IDs, banking details, customer lists with full names — never include these. Verbatim quotes about style and decisions are fine.
9. **Stop only when all 9 files exist on disk with substantive content** (or with the explicit "(insufficient evidence)" stub from rule 4 — that's still a complete file).

# Output protocol

After writing each file, in 1–2 sentences state: which file you finished, which tools you grounded it in, and your confidence (high/medium/low) for that file. When all 9 files are done, end your turn with the exact line:

\`Twin profile complete: 9/9 files written.\`
`}({employee:f,ceoContext:y,employeeDir:_,activeToolkits:I,orgMcpNames:Object.keys(S),existingFiles:N,lookbackDays:w}),x=e.buildId??(0,l.newBuildId)(),W=new Date,D=0,M=0,P="natural",F=0,j="";(0,c.registerRun)({runId:x,surface:"builder",employeeId:f.id,employeeName:f.name,label:`Build — ${f.firstName}`,startedAt:W.toISOString(),logPath:(0,u.logPathFor)("builder",x)}),(0,u.appendRunLog)("builder",x,{type:"meta",message:"Twin Builder started"});try{let i=(0,d.buildBaseOptions)({surface:"builder",abortController:e.abortController,runId:x,employeeId:f.id,title:`Build for ${f.name} — ${new Date().toISOString().slice(0,10)}`}),o=(0,d.buildTwinHooks)({runId:x,employeeId:f.id,employeeName:f.name,surface:"builder",onNotification:e=>{g({type:"error",message:`[${e.kind}] ${e.title?e.title+": ":""}${e.message}`,ts:v()})}}),a={type:"object",properties:{files:{type:"array",items:{type:"object",properties:{filename:{type:"string",enum:[...h.TWIN_FILE_NAMES]},confidence:{type:"string",enum:["high","medium","low"]},sources:{type:"array",items:{type:"string"},description:"Toolkit + action names used as evidence (e.g. 'gmail.fetch_emails')."},summary:{type:"string",description:"One short sentence about what was learned."}},required:["filename","confidence","sources"]}},overallConfidence:{type:"string",enum:["high","medium","low"]},notes:{type:"string",description:"Free-form notes for the CEO: blockers, missing toolkits, suggestions."}},required:["files","overallConfidence"]};for await(let r of(0,n.query)({prompt:`Research ${f.name} (${f.role}) using the connected systems and write all 9 twin profile files into \`${_}\`. Begin by listing what's connected, then plan, then execute. Do not write a file until you have grounded evidence for it.`,options:{...i,cwd:_,systemPrompt:L,allowedTools:["Read","Write","Glob","Grep","TodoWrite"],mcpServers:T,maxTurns:120,maxBudgetUsd:e.maxBudgetUsd??5,includePartialMessages:!0,permissionMode:"default",canUseTool:A,settingSources:[],hooks:o,enableFileCheckpointing:!0,extraArgs:{"replay-user-messages":null},outputFormat:{type:"json_schema",schema:a}}})){if("stream_event"===r.type){let e=r.event;"content_block_delta"===e.type&&"text_delta"===e.delta.type&&e.delta.text&&(g({type:"text_delta",delta:e.delta.text,ts:v()}),j+=e.delta.text,/[.!?\n]\s*$/.test(j)&&j.length>40&&((0,u.appendRunLog)("builder",x,{type:"text",text:j}),(0,c.updateRun)(x,{lastText:j.slice(-200)}),j=""));continue}if("assistant"===r.type){for(let e of r.message.content)if("tool_use"===e.type){if("Write"===e.name)continue;g({type:"tool_use",tool:e.name,input:e.input,ts:v()}),F++;let t=e.name.replace(/^mcp__[a-z0-9_]+__/i,"");j.trim()&&((0,u.appendRunLog)("builder",x,{type:"text",text:j}),j=""),(0,u.appendRunLog)("builder",x,{type:"tool_use",tool:t}),(0,c.updateRun)(x,{toolCalls:F,currentTool:t})}continue}if("user"===r.type){let e=r.message.content;if(Array.isArray(e)){for(let i of e)if("object"==typeof i&&null!==i&&"type"in i&&"tool_result"===i.type){for(let e of h.TWIN_FILE_NAMES)try{let i=s.default.statSync(t.default.join(_,e));if(i.isFile()&&i.size>0){let t=C.get(e)??0;i.mtimeMs>t&&(C.set(e,i.mtimeMs),O.add(e),g({type:"file_done",filename:e,sizeBytes:i.size,ts:v()}))}}catch{}(0,u.appendRunLog)("builder",x,{type:"tool_result",tool:"result"}),g({type:"tool_result",tool:"result",ts:v()})}}continue}if("result"===r.type){D=r.num_turns??0,M=r.total_cost_usd??0;let e=r.subtype;"error_max_budget_usd"===e?P="max_budget":"error_max_turns"===e&&(P="max_turns"),(0,c.updateRun)(x,{costUsd:M});let t=r.structured_output;if(t&&"object"==typeof t&&"files"in t&&Array.isArray(t.files))try{g({type:"build_manifest",manifest:t,ts:v()})}catch{}}}}catch(t){let e=t instanceof Error?t.message:"Unknown error";g({type:"error",message:e,ts:v()}),(0,u.appendRunLog)("builder",x,{type:"error",message:e}),(0,c.unregisterRun)(x,{status:"error",costUsd:0})}for(let e of h.TWIN_FILE_NAMES)try{let i=s.default.statSync(t.default.join(_,e));if(i.isFile()&&i.size>0){let t=C.get(e)??0;i.mtimeMs>t&&(C.set(e,i.mtimeMs),O.add(e),g({type:"file_done",filename:e,sizeBytes:i.size,ts:v()}))}}catch{}if(h.TWIN_FILE_NAMES.some(e=>{try{return s.default.statSync(t.default.join(_,e)).size>0}catch{return!1}}))try{let e=(0,l.recordBuild)({employeeId:f.id,buildId:x,startedAt:W,finishedAt:new Date,modelUsed:"claude-sonnet-4-6",costUsd:M,turns:D,stoppedReason:P,ceoContext:y,activeToolkits:I,writtenFiles:[...O]}),t=(0,l.listBuilds)(f.id).find(t=>t.buildId===e.buildId)?.version??0;g({type:"build_recorded",buildId:e.buildId,version:t,filesInManifest:e.files.map(e=>e.filename),ts:v()})}catch(t){let e=t instanceof Error?t.message:String(t);console.warn(`[twin-builder] manifest write failed: ${e}`)}j.trim()&&(0,u.appendRunLog)("builder",x,{type:"text",text:j}),(0,u.appendRunLog)("builder",x,{type:"done",summary:`${O.size}/9 files written`,costUsd:M,turns:D}),(0,c.unregisterRun)(x,{status:"complete",costUsd:M}),g({type:"done",filesWritten:[...O],turns:D,costUsd:M,stoppedReason:P,ts:v()})}let f=e=>t.default.join(process.cwd(),"data","employees",e,".builder-pending.json");async function y(e,s){let n=t.default.dirname(f(e));await i.default.mkdir(n,{recursive:!0});let o={status:"pending_toolkits",createdAt:new Date().toISOString(),...s};await i.default.writeFile(f(e),JSON.stringify(o,null,2),"utf8")}async function g(e){try{let t=await i.default.readFile(f(e),"utf8");return JSON.parse(t)}catch{return null}}async function w(e){try{await i.default.unlink(f(e))}catch{}}e.s(["clearPendingBuild",0,w,"countActiveConnections",0,function(e){return Object.values(e.connections).filter(e=>"ACTIVE"===e.status).length},"readPendingBuild",0,g,"spawnDetachedBuild",0,function(e){let{employee:t,lookbackDays:i,ceoContext:s,maxBudgetUsd:n}=e,o=t.id,a=(0,l.getActiveBuild)(o);if(a)return{spawned:!1,reason:"already_running",buildId:a.buildId,startedAt:a.startedAt,alreadyRunning:!0};let r=(0,l.newBuildId)(),d=new Date().toISOString();(0,l.markBuildActive)({employeeId:o,buildId:r,startedAt:d,lastEventTs:0,eventCount:0,filesWritten:0,filesTotal:h.TWIN_FILE_NAMES.length,costUsd:0,ceoContext:s});let c=0,u=0;return m({employee:t,buildId:r,ceoContext:s,maxBudgetUsd:n,lookbackDays:i,onEvent:e=>{c+=1,"file_done"===e.type&&(u+=1);try{(0,l.appendBuildEvent)(o,r,e)}catch(t){let e=t instanceof Error?t.message:String(t);console.warn(`[twin-builder] event persist failed: ${e}`)}try{(0,l.bumpBuildActivity)(o,{eventCount:c,lastEventTs:e.ts,filesWritten:u,costUsd:"done"===e.type?e.costUsd:0})}catch(t){let e=t instanceof Error?t.message:String(t);console.warn(`[twin-builder] activity bump failed: ${e}`)}}}).catch(e=>{let t=e instanceof Error?e.message:String(e);console.error(`[twin-builder] run crashed: ${t}`);try{(0,l.appendBuildEvent)(o,r,{type:"error",message:t,ts:0}),(0,l.appendBuildEvent)(o,r,{type:"done",filesWritten:[],turns:0,costUsd:0,stoppedReason:"natural",ts:0})}catch{}}).finally(()=>{try{(0,l.clearBuildActive)(o)}catch{}}),{spawned:!0,buildId:r,startedAt:d,alreadyRunning:!1}},"writePendingBuild",0,y],14116)}];

//# sourceMappingURL=src_lib_twin-build-runner_ts_0xx4t1o._.js.map