import{r as e}from"./core-DcH9fClu.js";import{Cn as t,En as n,Tn as r,Zn as i,nr as a,wn as o,zn as s}from"./tauri-BdW-vCOV.js";var c=`orchestra`,l=`Project secrets require a secure Orchestra host and are unavailable in the browser/mock host.`;function u(){return new Date().toISOString()}function d(e,t){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)||t}function f(e){return d(e,`worker`)}var p=[`You are an agent working inside Orchestra on task {TASK.NUMBER} — {TASK.NAME}.`,``,`Canonical task ID: {TASK.ID}`,`Task slug: {TASK.SLUG}`,``,`Orchestra is the project orchestration system. It tracks tasks, workflows, worker ownership, runtime sessions, comments, attachments, and transitions between steps of work. You are operating as a worker inside that system, so your job is not just to do good work — it is to keep Orchestra's state accurate as you work.`,``,`Orchestra concepts you need to understand:
- Task: the tracked unit of work you are responsible for right now. Tasks can have descriptions, comments, attachments, todos, subtasks, dependencies, and workflow history.
- Workflow: the overall process definition attached to a task. A workflow contains ordered lanes and transition rules.
- Lane: the current step of the workflow. Each lane has an owner type (user, role, or agent) and defines what should happen on success or failure.
- Session: the running conversation/runtime for a worker. This session is the place where you reason, inspect task context, and decide how to move the task forward.
- Transition: the explicit tool call that moves the task out of the current lane. You must always end your work by choosing the correct transition tool.`,``,`Workflow: {WORKFLOW.NAME}`,`Current lane: {LANE.NAME}`,`Lane owner: {LANE.OWNER}`,`Task status: {TASK.STATUS}`,`Task assignee: {TASK.ASSIGNEE}`,`Runtime cwd: {RUNTIME.CWD}`,``,`As you do work - periodically comment on tasks to give an update on what you’re doing.`,``,`{WORKER.CONTEXT}`,`{SOURCE_CONTROL.CONTEXT}`,`{TASK.DESCRIPTION}`,`{TASK.BLOCKED_BY}`,`{TASK.REPOSITORIES}`,`{TASK.FILE_REFERENCES}`,`{TASK.ATTACHMENTS}`,`{TASK.TODOS}`,`{TASK.COMMENTS}`,`{LANE.INSTRUCTION}`,`{ORCHESTRA.WORKING_RULES}`,`{ORCHESTRA.TOOL_HELP}`,`{ORCHESTRA.COMPLETION_RULES}`].join(`
`),m=[{token:`{TASK.ID}`,description:`Canonical Orchestra task id.`},{token:`{TASK.NUMBER}`,description:`Human-readable task number such as <PROJECT_PREFIX>-42.`},{token:`{TASK.SLUG}`,description:`Slugified task title for prompt customization.`},{token:`{TASK.NAME}`,description:`Task title/name.`},{token:`{TASK.STATUS}`,description:`Current task status.`},{token:`{TASK.ASSIGNEE}`,description:`Current assignee label.`},{token:`{TASK.DESCRIPTION}`,description:`Task description block when present.`},{token:`{TASK.COMMENTS}`,description:`Recent task comments block.`},{token:`{TASK.BLOCKED_BY}`,description:`Blocking tasks block.`},{token:`{TASK.REPOSITORIES}`,description:`Task repositories block.`},{token:`{TASK.FILE_REFERENCES}`,description:`Tracked project file references block.`},{token:`{TASK.ATTACHMENTS}`,description:`Task attachments block.`},{token:`{TASK.TODOS}`,description:`Task todo items block.`},{token:`{WORKFLOW.NAME}`,description:`Workflow name.`},{token:`{LANE.NAME}`,description:`Current lane name.`},{token:`{LANE.OWNER}`,description:`Current lane owner type.`},{token:`{LANE.INSTRUCTION}`,description:`Lane entry instruction block.`},{token:`{WORKER.CONTEXT}`,description:`Worker-specific prompt context block including base and overlay prompts.`},{token:`{SOURCE_CONTROL.CONTEXT}`,description:`Rendered block summarizing the effective git identity for the current project and worker context.`},{token:`{SOURCE_CONTROL.GIT.USER_NAME}`,description:`Resolved git user.name value after project/global precedence and {role}/{agent} substitution.`},{token:`{SOURCE_CONTROL.GIT.EMAIL}`,description:`Resolved git user.email value after project/global precedence and {role}/{agent} substitution.`},{token:`{RUNTIME.CWD}`,description:`Resolved task workspace cwd for the current lane.`},{token:`{ORCHESTRA.WORKING_RULES}`,description:`Standard Orchestra working rules block.`},{token:`{ORCHESTRA.TOOL_HELP}`,description:`Standard Orchestra task tool help block.`},{token:`{ORCHESTRA.COMPLETION_RULES}`,description:`Standard Orchestra completion rules block.`}];function h(e){return e??s()??c}function g(){return i()?.client.settings??null}function _(e){return{projectSlug:h(e),availability:{status:`unsupported`,message:l},secrets:[]}}function v(){throw Error(l)}async function y(n){let r=g();if(r)return r.getSessionPromptSettings(n);let i=h(n);if(!a()){let e=t(i);return{projectSlug:i,template:e.taskSessionContextTemplate??p,defaultTemplate:p,availableTokens:[...m],updatedAt:e.updatedAt??null}}return e(`get_session_prompt_settings`,{projectSlug:i})}async function b(t,r){let i=g();if(i)return i.updateSessionPromptSettings(t,r);let o=h(r);return a()?e(`update_session_prompt_settings`,{projectSlug:o,template:t}):(n(o,e=>({...e,taskSessionContextTemplate:t?.trim()||null,updatedAt:u()})),y(o))}async function x(n){let r=g();if(r)return r.getTaskAutomationSettings(n);let i=h(n);if(!a()){let e=t(i);return{projectSlug:i,autoDispatchOnBlockerCompletion:e.autoDispatchOnBlockerCompletion??!0,updatedAt:e.updatedAt??null}}return e(`get_task_automation_settings`,{projectSlug:i})}async function S(t,r){let i=g();if(i)return i.updateTaskAutomationSettings(t,r);let o=h(r);return a()?e(`update_task_automation_settings`,{projectSlug:o,autoDispatchOnBlockerCompletion:t}):(n(o,e=>({...e,autoDispatchOnBlockerCompletion:t,updatedAt:u()})),x(o))}async function C(t,n,r){let i=g();if(i)return i.getWorkerOverlay(t,n,r);let s=h(r);if(!a()){let e=o(),r=t===`role`?`role`:`agent`,i=f(n),a=r===`role`?e.roleOverlays?.[i]:e.agentOverlays?.[i];return{projectSlug:s,workerType:r,workerSlug:i,prompt:a?.prompt??null,updatedAt:a?.updatedAt??null}}return e(`get_worker_overlay`,{projectSlug:s,workerType:t,workerSlug:n})}async function w(t,n,i,s){let c=g();if(c)return c.updateWorkerOverlay(t,n,i,s);let l=h(s);if(!a()){let e=o(),a=t===`role`?`role`:`agent`,s=f(n),c={prompt:i.trim()||null,updatedAt:u()};return a===`role`?e.roleOverlays={...e.roleOverlays??{},[s]:c}:e.agentOverlays={...e.agentOverlays??{},[s]:c},r(e),{projectSlug:l,workerType:a,workerSlug:s,prompt:c.prompt,updatedAt:c.updatedAt}}return e(`update_worker_overlay`,{projectSlug:l,workerType:t,workerSlug:n,prompt:i})}async function T(t){let n=g();return n?n.getProjectSecrets(t):a()?e(`get_project_secrets`,{projectSlug:h(t)}):_(t)}async function E(t,n){let r=g();return r?r.createProjectSecret(t,n):(a()||v(),e(`create_project_secret`,{projectSlug:h(n),input:t}))}async function D(t,n){let r=g();return r?r.updateProjectSecret(t,n):(a()||v(),e(`update_project_secret`,{projectSlug:h(n),input:t}))}async function O(t,n){let r=g();return r?r.deleteProjectSecret(t,n):(a()||v(),e(`delete_project_secret`,{projectSlug:h(n),secretKey:t}))}export{x as a,b as c,y as i,S as l,O as n,C as o,T as r,D as s,E as t,w as u};