werkmeister 0.19.0 → 0.22.0

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 CHANGED
@@ -50,10 +50,9 @@ feature name (`infra` plus the workspaces under the workspaces root).
50
50
  - CLI parsing is commander; templates in `infra/templates/*.njk` render through
51
51
  nunjucks with a small compat layer (`{% do %}`, dict truthiness,
52
52
  `map(attribute=…)`) so they stay shared verbatim with other consumers
53
- - `sandbox mcp` runs the headless MCP server over stdio. Its source is
53
+ - `sandbox mcp` runs the one MCP server over stdio. Its source is
54
54
  `apps/mcp`, bundled into `dist/mcp.js` by `esbuild.mjs` so it ships in the npm
55
- package. `sandbox dashboard` runs the richer workspaces dashboard from
56
- `apps/sandbox-dashboard` (Jira, PRs, MCP Apps UI), which is checkout-only;
57
- where that app is absent the verb falls back to the bundled headless server
55
+ package. `sandbox dashboard` runs the localhost workspaces dashboard from
56
+ `apps/sandbox-dashboard`, which is checkout-only
58
57
  - interactive prompts and process-spawn edges are async (`run()` is
59
58
  `async` throughout); core logic stays synchronous
@@ -0,0 +1,7 @@
1
+ import { createRequire as __sandboxCreateRequire } from "node:module";
2
+ const require = __sandboxCreateRequire(import.meta.url);
3
+ var b=Object.defineProperty;var i=(e,t)=>b(e,"name",{value:t,configurable:!0});import*as s from"node:fs";import*as x from"node:path";import*as S from"node:fs";import*as l from"node:path";var y=[".werkmeister",".sandbox"];function d(e){let t=y.find(n=>S.existsSync(l.join(e,n)));return l.join(e,t??y[0])}i(d,"dotDir");import*as m from"node:fs";import*as p from"node:path";function g(e){let t=p.resolve(e);for(;;){if(m.existsSync(p.join(d(t),"workspace.yml")))return t;let n=p.dirname(t);if(n===t)return null;t=n}}i(g,"findRecordRoot");var k=new Set(["working","needs-you","done","idle"]),R=new Set(["AskUserQuestion","ExitPlanMode"]),T=new Set(["permission_prompt","elicitation_dialog"]),_=i(e=>x.join(d(e),"agent-state.json"),"stateFile");function q(e){try{let t=JSON.parse(s.readFileSync(_(e),"utf8"));return!k.has(t?.state)||typeof t.at!="string"?null:typeof t.question=="string"?{state:t.state,at:t.at,question:t.question}:{state:t.state,at:t.at}}catch{return null}}i(q,"readAgentState");function A(e){return/\?[\s*_`'")\]]*$/.test(e)}i(A,"asksQuestion");function $(e){let t=e.trim().split(/\n\s*\n/);return t[t.length-1].trim().slice(0,200)}i($,"questionOf");function O(e){let t=s.openSync(e,"r"),n;try{let o=s.fstatSync(t).size,c=Math.min(o,65536),a=Buffer.alloc(c);s.readSync(t,a,0,c,o-c),n=a.toString("utf8")}finally{s.closeSync(t)}let r=n.split(`
4
+ `);for(let o=r.length-1;o>=0;o--){let c;try{c=JSON.parse(r[o])}catch{continue}if(c.type!=="assistant")continue;let a=c.message?.content;if(typeof a=="string")return a;if(!Array.isArray(a))continue;let f=a.filter(u=>u?.type==="text"&&typeof u.text=="string");if(f.length)return f.map(u=>u.text).join(`
5
+ `)}return null}i(O,"lastAssistantText");function D(e,t){switch(e.hook_event_name){case"UserPromptSubmit":case"PostToolUse":return{state:"working"};case"PreToolUse":{let n=String(e.tool_name??"");if(!R.has(n))return{state:"working"};let r=e.tool_input?.questions?.[0]?.question;return{state:"needs-you",question:typeof r=="string"?r:"Approve the plan?"}}case"Notification":{let n=e.notification_type,r=String(e.message??"");return(typeof n=="string"?T.has(n):!/waiting for your input/i.test(r))?{state:"needs-you",question:r||void 0}:null}case"Stop":{let n=null;return typeof e.last_assistant_message=="string"?n=e.last_assistant_message:typeof e.transcript_path=="string"&&(n=O(e.transcript_path)),n&&A(n)?{state:"needs-you",question:$(n)}:{state:"done"}}case"SessionEnd":return t?.state==="working"?{state:"idle"}:null;default:return null}}i(D,"nextState");function P(e,t=new Date){let n=g(String(e.cwd||process.cwd()));if(!n)return null;let r=q(n),o=D(e,r);if(!o||r&&r.state===o.state&&r.question===o.question)return null;let c={state:o.state,at:t.toISOString()};o.question&&(c.question=o.question);let a=_(n),f=`${a}.${process.pid}.tmp`;return s.writeFileSync(f,`${JSON.stringify(c)}
6
+ `),s.renameSync(f,a),a}i(P,"record");function w(){try{let e=process.stdin.isTTY?"":s.readFileSync(0,"utf8"),t=e.trim()?JSON.parse(e):{};typeof t=="object"&&t!==null&&!Array.isArray(t)&&P(t)}catch{}}i(w,"main");w();
7
+ //# sourceMappingURL=agent_state.js.map