@bendyline/gezel-service 1.0.2 → 1.0.3

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.
Files changed (61) hide show
  1. package/dist/bin/gezeld.js +17312 -16791
  2. package/dist/handboek.js +13 -2
  3. package/dist/index-store/static-index-worker.js +8 -5
  4. package/dist/index.d.ts +64 -5
  5. package/dist/index.js +17312 -16791
  6. package/dist/providers/mlx/python/gezel_mlx_server.py +154 -22
  7. package/dist/ui/assets/{TerminalCodeEditor-BpkIEKrW.js → TerminalCodeEditor-CXspNipu.js} +2 -2
  8. package/dist/ui/assets/{_.contribution-DESswd3T.js → _.contribution-Bi8h5rS7.js} +1 -1
  9. package/dist/ui/assets/{cpp.contribution-DazoHQwn.js → cpp.contribution-CIgWElWw.js} +1 -1
  10. package/dist/ui/assets/{csharp.contribution-B64MdTmq.js → csharp.contribution-DDiJzXzB.js} +1 -1
  11. package/dist/ui/assets/{css.contribution-u617lXYH.js → css.contribution-Dc5E_mNx.js} +1 -1
  12. package/dist/ui/assets/{cssMode-Cf_QqRjJ.js → cssMode-BN_VZB6O.js} +1 -1
  13. package/dist/ui/assets/dist-BwDZUtiH.js +2 -0
  14. package/dist/ui/assets/dist-D4PZf1Q3.js +222 -0
  15. package/dist/ui/assets/{dockerfile.contribution-P8T1FxHz.js → dockerfile.contribution-BQsaSuAJ.js} +1 -1
  16. package/dist/ui/assets/{go.contribution-BqqmPpYF.js → go.contribution-CPvqBST7.js} +1 -1
  17. package/dist/ui/assets/{handlebars-B9qcPqjD.js → handlebars-DJvRMy-I.js} +1 -1
  18. package/dist/ui/assets/{handlebars.contribution-vZslMuRE.js → handlebars.contribution-BNbstxN6.js} +2 -2
  19. package/dist/ui/assets/{html-Fp2jEZ7j.js → html-Becff5XU.js} +1 -1
  20. package/dist/ui/assets/{html.contribution-B1GzaEV-.js → html.contribution-CPDzzJ0M.js} +2 -2
  21. package/dist/ui/assets/{htmlMode-B5cPhGim.js → htmlMode-BFmyC6t-.js} +1 -1
  22. package/dist/ui/assets/index-DTicLc4o.css +1 -0
  23. package/dist/ui/assets/{index-CQSh1NUQ.js → index-w_CaRVtV.js} +192 -191
  24. package/dist/ui/assets/{ini.contribution-XkZYQphY.js → ini.contribution-DFSSA0eY.js} +1 -1
  25. package/dist/ui/assets/{java.contribution-CUQitE0a.js → java.contribution-Bdvvskrf.js} +1 -1
  26. package/dist/ui/assets/{javascript-CcBUpTjJ.js → javascript-DByfaclN.js} +1 -1
  27. package/dist/ui/assets/{javascript.contribution-D6DhUpPP.js → javascript.contribution-CPCuprn0.js} +2 -2
  28. package/dist/ui/assets/{jsonMode-D9SbmDW6.js → jsonMode-CxkV6dJT.js} +1 -1
  29. package/dist/ui/assets/{kotlin.contribution-B9AYd3Yp.js → kotlin.contribution-D8eqi2Fi.js} +1 -1
  30. package/dist/ui/assets/{less.contribution-DtKQK3HF.js → less.contribution-DFRb86Ld.js} +1 -1
  31. package/dist/ui/assets/{lua.contribution-DxFFDcBW.js → lua.contribution-BgktkcsF.js} +1 -1
  32. package/dist/ui/assets/{markdown.contribution-B7aCxle-.js → markdown.contribution-BKqBKD_g.js} +1 -1
  33. package/dist/ui/assets/{monaco-BBFILBn6.js → monaco-CyhM025v.js} +3 -3
  34. package/dist/ui/assets/{monaco-base-CvsKN-Z-.js → monaco-base-hW9ht_BG.js} +1 -1
  35. package/dist/ui/assets/{monaco-setup-BeHgXlpG.js → monaco-setup-Cquhh1OE.js} +1 -1
  36. package/dist/ui/assets/{monaco.contribution-DRZnYNPl.js → monaco.contribution-BVrZ1Anc.js} +2 -2
  37. package/dist/ui/assets/{monaco.contribution-B-c9k_-7.js → monaco.contribution-Cle0Lbgx.js} +2 -2
  38. package/dist/ui/assets/{monaco.contribution-BBrbIBfd.js → monaco.contribution-D9-bPyBf.js} +2 -2
  39. package/dist/ui/assets/{monaco.contribution-Baa3Cv83.js → monaco.contribution-Dl8lHLi5.js} +2 -2
  40. package/dist/ui/assets/{php.contribution-vC08ovbS.js → php.contribution-CcYxMawn.js} +1 -1
  41. package/dist/ui/assets/{python-CevkXHVb.js → python-DivQov6J.js} +1 -1
  42. package/dist/ui/assets/{python.contribution-C6TUOYNZ.js → python.contribution-CiRaN0sm.js} +2 -2
  43. package/dist/ui/assets/{ruby.contribution-BMZvE4z1.js → ruby.contribution-DNudSRrU.js} +1 -1
  44. package/dist/ui/assets/{rust.contribution-DOWKjtrn.js → rust.contribution-BqG2lQpP.js} +1 -1
  45. package/dist/ui/assets/{scss.contribution-BXLJWEv0.js → scss.contribution-DDxPnF-K.js} +1 -1
  46. package/dist/ui/assets/{shell.contribution-gbqcscnj.js → shell.contribution-Q7wVL7zv.js} +1 -1
  47. package/dist/ui/assets/{sql.contribution-DO39C_-u.js → sql.contribution-B9ndj3QH.js} +1 -1
  48. package/dist/ui/assets/{swift.contribution-D4Vjb2VA.js → swift.contribution-D_FDdL6S.js} +1 -1
  49. package/dist/ui/assets/{terminal-monaco-setup-Bb4lnoOq.js → terminal-monaco-setup-BdF0mUfG.js} +1 -1
  50. package/dist/ui/assets/{tsMode-BAHQHAnm.js → tsMode-JVR2Jo5q.js} +1 -1
  51. package/dist/ui/assets/{typescript-15FhCrR2.js → typescript-1ZOjdUnd.js} +1 -1
  52. package/dist/ui/assets/{typescript.contribution-D30L44Mw.js → typescript.contribution-_s-8TvIE.js} +2 -2
  53. package/dist/ui/assets/{xml-BA1mrkDo.js → xml-DrdFGpo2.js} +1 -1
  54. package/dist/ui/assets/{xml.contribution-CN9NFcUA.js → xml.contribution-DUPYAKAC.js} +2 -2
  55. package/dist/ui/assets/{yaml-CIqCv-ro.js → yaml-DYQPB5Mj.js} +1 -1
  56. package/dist/ui/assets/{yaml.contribution-BsLB8vrs.js → yaml.contribution-CRBo99nF.js} +2 -2
  57. package/dist/ui/index.html +4 -4
  58. package/package.json +11 -11
  59. package/dist/ui/assets/dist-DB6xxrlD.js +0 -2
  60. package/dist/ui/assets/dist-DucbO86I.js +0 -222
  61. package/dist/ui/assets/index-Ch0qGtVJ.css +0 -1
@@ -1,2 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-aKtaBQYM.js";import{$t as t,Gt as n,Ht as r,Jt as i,Kt as a,Qt as o,Ut as s,Vt as c,Wt as l,Xt as u,Yt as d,Zt as ee,ct as te,en as ne,nn as f,qt as re,tn as p}from"./dist-DucbO86I.js";var m=a(`kind`,[u({kind:i(`gezel`),gezelId:t()}),u({kind:i(`user`)})]),ie=[`tiny`,`small`,`medium`,`large`,`cloud`],ae=p([r([`llm`,`network`,`workspace.read`,`workspace.write`,`artifacts.read`,`artifacts.write`,`documents.read`,`documents.write`,`tasks.read`,`tasks.write`,`memory.read`,`memory.write`]),t().regex(/^credential:[a-zA-Z][\w.:-]*$/,`credential capability must be of the form "credential:<name>" where <name> starts with a letter and contains letters, digits, underscore, hyphen, dot, or colon`)]),oe=a(`type`,[u({type:i(`string`),description:t(),required:n().optional(),default:t().optional(),pattern:t().optional(),multiline:n().optional()}),u({type:i(`number`),description:t(),required:n().optional(),default:d().optional(),min:d().optional(),max:d().optional(),integer:n().optional()}),u({type:i(`boolean`),description:t(),required:n().optional(),default:n().optional()}),u({type:i(`choice`),description:t(),required:n().optional(),default:t().optional(),options:l(u({value:t(),label:t().optional()})).min(1)}),u({type:i(`ref`),description:t(),required:n().optional(),kind:r([`gezel`,`task`,`artifact`,`document`])}),u({type:i(`json`),description:t(),required:n().optional(),default:f().optional(),schema:f().optional()})]),se=o(t(),oe),ce=a(`type`,[u({type:i(`string`),description:t(),nullable:n().optional()}),u({type:i(`number`),description:t(),nullable:n().optional()}),u({type:i(`boolean`),description:t(),nullable:n().optional()}),u({type:i(`array`),description:t(),itemType:r([`string`,`number`,`boolean`,`object`])}),u({type:i(`object`),description:t(),schema:f().optional()}),u({type:i(`json`),description:t(),schema:f().optional()})]),le=o(t(),ce),ue=u({name:t().regex(/^[a-zA-Z][\w-]*$/,`name must start with a letter and contain only letters, digits, underscore, or hyphen`),description:t().min(10),kind:r([`action`,`gate`]).optional(),inputs:se.optional(),outputs:le.optional(),requires:l(ae).optional()}),de=r([`project`,`craftbook`,`user`,`standard`]),fe=a(`op`,[u({op:i(`always`)}),u({op:i(`never`)}),u({op:i(`ok`)}),u({op:i(`equals`),field:t().min(1),value:p([t(),d(),n(),s()])}),u({op:i(`exists`),field:t().min(1),negate:n().optional()}),u({op:i(`gt`),field:t().min(1),value:d()})]),pe=u({name:t().min(1),scope:de.optional(),inputs:o(t(),f()).optional(),autoAdvanceOnSuccess:n().optional(),autoAdvanceWhen:fe.optional()}),h=p([pe,l(pe)]);function me(e){return e===void 0?[]:Array.isArray(e)?e:[e]}var he=r([`running`,`ok`,`error`]),ge=u({at:t(),kind:t(),argsSummary:t(),outputSummary:t().optional(),durationMs:d().nonnegative(),error:t().optional()}),_e=a(`kind`,[u({kind:i(`step`),taskRef:t(),stepId:t(),moment:r([`enter`,`exit`,`gate`])}),u({kind:i(`chat`),sessionId:t(),gezelId:t()}),u({kind:i(`manual`),userInitiated:i(!0)}),u({kind:i(`nested`),parentRunId:t()}),u({kind:i(`connector`),typeId:t(),bindingId:t()}),u({kind:i(`page`),tool:t()})]);u({id:t(),projectId:t(),scriptName:t(),startedAt:t(),finishedAt:t().optional(),status:he,trigger:_e,inputs:o(t(),f()),output:f().optional(),calls:l(ge),logs:t(),error:t().optional()}),u({name:t().min(1),scope:de.optional(),input:o(t(),f()).optional()});var ve=u({runId:t(),status:he,output:f().optional(),callsSummary:l(u({kind:t(),durationMs:d().nonnegative(),error:t().optional()})),error:t().optional()});u({tool:t().regex(/^[a-z][a-z0-9_]*$/),input:o(t(),f()).optional()}),ve.extend({reaction:u({delivered:n(),gezelId:t().optional(),reason:t().optional()}).optional()}),u({op:r([`read`,`list`,`stat`]),source:r([`workspace`,`artifacts`]),path:t().min(1),as:r([`text`,`json`,`bytes`]).optional(),maxBytes:d().int().positive().optional()});var ye=u({name:t(),kind:r([`file`,`dir`]),size:d().nonnegative(),mtime:d().nonnegative()});u({op:r([`read`,`list`,`stat`]),content:t().optional(),encoding:r([`utf8`,`base64`]).optional(),entries:l(ye).optional(),etag:t(),size:d().nonnegative().optional(),mtime:d().nonnegative().optional()}),u({scripts:l(u({name:t(),meta:ue,path:t()}))});var g=t().regex(/^[a-zA-Z][\w-]*$/,`script name must start with a letter and contain only letters, digits, underscore, or hyphen`),be=u({severity:r([`error`,`warning`,`info`]),source:r([`meta`,`typescript`,`runtime-compat`]),message:t(),line:d().optional(),column:d().optional()}),xe=u({kind:r([`craftbook`,`import`,`user`,`standard`]),ref:t()});u({name:g,source:t(),hash:t(),mtimeMs:d(),meta:ue.optional(),metaError:t().optional(),provenance:xe.optional()}),u({name:g,source:t(),baseHash:t().optional()}),a(`status`,[u({status:i(`saved`),hash:t(),metaOk:n(),meta:ue.optional(),diagnostics:l(be)}),u({status:i(`conflict`),currentHash:t(),currentSource:t()})]);var Se=r([`blank`,`post-message`,`fetch-and-summarize`,`check-files`,`call-tool`,`ask-ai`]);u({name:g,description:t().optional(),template:Se.optional(),source:t().optional()}),u({name:g,source:t(),hash:t()}),u({version:t(),files:l(u({name:t(),content:t()}))}),u({name:g,description:t().min(1)}),u({source:t()});var Ce=r([`html-complete`,`html-game`,`nonempty`,`json-valid`,`data-table`]),we=p([t(),d(),n(),s()]),Te=a(`kind`,[u({kind:i(`minBytes`),file:t().min(1),bytes:d().int().positive(),artifact:n().optional()}),u({kind:i(`totalMinBytes`),files:l(t().min(1)).min(1),bytes:d().int().positive()}),u({kind:i(`fileCount`),ext:l(t().min(1)).min(1),min:d().int().positive(),dir:t().optional(),verifyImageBytes:n().optional()}),u({kind:i(`cssMinBytes`),bytes:d().int().positive(),file:t().optional()}),u({kind:i(`sniff`),file:t().min(1),sniff:Ce,artifact:n().optional()}),u({kind:i(`jsonPathEquals`),file:t().min(1),path:t().min(1),value:we,label:t().min(1).optional()}),u({kind:i(`csvShape`),file:t().min(1),requiredColumns:l(t().min(1)).min(1).optional(),exactColumns:l(t().min(1)).min(1).optional(),minRows:d().int().nonnegative().optional(),consistentColumns:n().optional(),allowedValues:o(t(),l(t().min(1)).min(1)).optional()}),u({kind:i(`contains`),file:t().min(1),pattern:t().min(1),flags:t().optional(),label:t().min(1).optional(),artifact:n().optional()}),u({kind:i(`notContains`),file:t().min(1),pattern:t().min(1),flags:t().optional(),label:t().min(1).optional()}),u({kind:i(`unsupportedClaims`),file:t().min(1),sourceFiles:l(t().min(1)).min(1),patterns:l(u({pattern:t().min(1),label:t().min(1).optional()})).min(1),flags:t().optional()}),u({kind:i(`jsParses`),file:t().optional()}),u({kind:i(`htmlLint`),file:t().min(1)}),u({kind:i(`esmImports`),file:t().min(1)}),u({kind:i(`sourceParses`),file:t().min(1)}),u({kind:i(`tableShape`),file:t().min(1),requiredColumns:l(t().min(1)).min(1).optional(),minRows:d().int().nonnegative().optional(),artifact:n().optional()}),u({kind:i(`recordSchema`),file:t().min(1),fields:l(u({name:t().min(1),type:t().optional(),required:n().optional()})).min(1),minRows:d().int().nonnegative().optional(),uniqueBy:t().optional(),format:r([`json`,`csv`,`auto`]).optional(),artifact:n().optional()}),u({kind:i(`nodeRuns`),file:t().min(1),timeoutMs:d().int().positive().max(6e4).optional()}),u({kind:i(`citationsResolve`),file:t().min(1),pattern:t().min(1).optional(),flags:t().optional(),minCitations:d().int().nonnegative().optional(),corpus:l(t().min(1)).min(1).optional(),artifact:n().optional()}),u({kind:i(`researchEvidence`),sourcePath:t().optional(),tools:l(t().min(1)).min(1),minSuccessful:d().int().positive().optional()}),u({kind:i(`markdownHeadingsMatch`),file:t().min(1),outlineFile:t().min(1)}),u({kind:i(`valueGrounding`),file:t().min(1),facts:l(u({id:t().min(1),label:t().min(1).optional(),required:l(t().min(1)).min(1),forbidden:l(t().min(1)).optional()})).min(1),normalizeDigits:n().optional(),artifact:n().optional()}),u({kind:i(`valuesSubsetOf`),file:t().min(1),sourceFiles:l(t().min(1)).min(1),pattern:t().min(1),flags:t().optional(),minMatches:d().int().nonnegative().optional(),artifact:n().optional()}),u({kind:i(`judge`),file:t().min(1),rubric:t().min(1),sourceFiles:l(t().min(1)).optional(),requireEvidence:n().optional(),advisory:n().optional(),timeoutMs:d().int().positive().max(12e4).optional(),label:t().min(1).optional(),artifact:n().optional()}),u({kind:i(`planStructure`),file:t().min(1),minRows:d().int().positive().optional(),ownerRoster:l(t().min(1)).optional(),requireEarlierOnly:n().optional(),doneWhenMinChars:d().int().positive().optional(),artifact:n().optional()})]);u({verdict:r([`pass`,`fail`]),reasons:l(t().min(1)).max(5),evidence:l(t()).default([]),confidence:r([`low`,`medium`,`high`]).optional()});var Ee=u({checks:l(Te).min(1),onFail:t().optional(),onPass:t().optional(),maxAttempts:d().int().positive().optional(),reviewer:t().optional()}),De=u({name:t().min(1),scope:de.optional(),inputs:o(t(),f()).optional()});u({decision:r([`approve`,`reject`]),message:t().optional(),goto:t().optional(),handoff:u({message:t(),params:o(t(),f()).optional()}).optional()}).superRefine((e,t)=>{e.decision===`reject`&&!e.message?.trim()&&t.addIssue({code:c.custom,message:`a reject result must carry a message — it is the prescriptive guidance the working session uses to fix the step`,path:[`message`]})});var Oe=p([u({at:r([`completion`,`activation`]),checks:l(Te).optional(),scripts:l(De).optional(),onReject:t().optional(),onApprove:t().optional(),maxAttempts:d().int().positive().optional(),reviewer:t().optional()}).superRefine((e,t)=>{!e.checks?.length&&!e.scripts?.length&&t.addIssue({code:c.custom,message:`a gate needs at least one check or one script`})}),Ee]);function ke(e){return!(`at`in e)}function Ae(e){return ke(e)?{at:`activation`,checks:e.checks,scripts:[],...e.onFail===void 0?{}:{onReject:e.onFail},...e.onPass===void 0?{}:{onApprove:e.onPass},maxAttempts:e.maxAttempts??4,...e.reviewer===void 0?{}:{reviewer:e.reviewer},legacy:!0}:{at:e.at,checks:e.checks??[],scripts:e.scripts??[],...e.onReject===void 0?{}:{onReject:e.onReject},...e.onApprove===void 0?{}:{onApprove:e.onApprove},maxAttempts:e.maxAttempts??4,...e.reviewer===void 0?{}:{reviewer:e.reviewer},legacy:!1}}function je(e){let t=Ae(e);return[t.onReject,t.onApprove].filter(e=>e!==void 0)}var Me=r([`PreToolUse`,`PostToolUse`]),Ne=r([`allow`,`deny`,`ask`]),_=u({phase:Me,matcher:t().default(`.*`),script:pe.optional(),decision:Ne.optional(),label:t().optional()}).superRefine((e,t)=>{let n=e.script!==void 0;n===(e.decision!==void 0)&&t.addIssue({code:c.custom,message:"a hook must set exactly one of `script` or `decision`",path:[n?`decision`:`script`]})});u({decision:Ne.default(`allow`),message:t().optional()});var Pe=u({when:fe,goto:t()}),Fe=u({file:t().min(1),minBytes:d().int().positive().optional(),sniff:Ce.optional(),requireChange:n().optional(),artifact:n().optional(),goto:t().optional()}),Ie=r(ie),v=u({id:t().min(1),name:t().min(1),description:t().optional(),prompt:t().optional(),suggestedGezelId:t().optional(),suggestedRole:t().optional(),capabilityFloor:Ie.optional(),assignee:m.optional(),onEnter:h.optional(),onExit:h.optional(),advanceWhen:Fe.optional(),gate:Oe.optional(),next:t().optional(),branches:l(Pe).optional(),terminal:n().optional(),spawnFanout:n().optional()}),y=u({overFile:t().min(1),itemsPath:t().optional(),entryStepId:t().optional(),steps:l(v).min(1)});function Le(e){let t=[],n=new Set;for(let r of e.steps)n.has(r.id)&&t.push(`duplicate step id "${r.id}"`),n.add(r.id),r.terminal&&(r.next||r.branches&&r.branches.length>0)&&t.push(`step "${r.id}" is terminal but also has next/branches`);n.has(e.entryStepId)||t.push(`entryStepId "${e.entryStepId}" not in steps`);for(let r of e.steps){r.next&&!n.has(r.next)&&t.push(`step "${r.id}".next "${r.next}" missing from steps`);for(let e of r.branches??[])n.has(e.goto)||t.push(`step "${r.id}" branch goto "${e.goto}" missing from steps`);if(r.advanceWhen&&(r.terminal&&t.push(`step "${r.id}" is terminal but also has advanceWhen`),r.advanceWhen.goto&&!n.has(r.advanceWhen.goto)&&t.push(`step "${r.id}" advanceWhen.goto "${r.advanceWhen.goto}" missing from steps`)),r.gate){let e=Ae(r.gate);r.terminal&&e.at===`activation`&&t.push(`step "${r.id}" is terminal but also has an activation gate`);for(let e of je(r.gate))n.has(e)||t.push(`step "${r.id}" gate route "${e}" missing from steps`)}}return t}function Re(e,t){for(let n of Le(e))t.addIssue({code:c.custom,message:n,path:n.startsWith(`entryStepId`)?[`entryStepId`]:[`steps`]});for(let n of Ve(e))t.addIssue({code:c.custom,message:n,path:[`steps`]})}var b=a(`kind`,[u({kind:i(`github`)}),u({kind:i(`non-main-branch`)})]),x=u({scheduled:r([`supported`,`recommended`]).optional(),nightShift:r([`supported`,`recommended`]).optional()}),S=u({toolsetId:t().min(1),sourceId:t().optional(),minVersion:t().optional(),optional:n().optional(),autoAllow:n().optional(),reason:t().optional()}),C=u({typeId:t().min(1),sourceId:t().optional(),optional:n().optional(),reason:t().optional()}),ze=64*1024,Be=256*1024,w=o(g,t().min(1).max(ze)).superRefine((e,t)=>{let n=Object.keys(e);n.length>24&&t.addIssue({code:c.custom,message:`a craftbook carries at most 24 scripts (got ${n.length})`});let r=0;for(let t of n)r+=e[t].length;r>262144&&t.addIssue({code:c.custom,message:`craftbook scripts total ${r} bytes \u2014 the ceiling is ${Be}`})}),T=u({name:t().min(1),url:t().url().regex(/^https?:\/\//i,`basedOn.url must use http or https`)});function Ve(e){if(!e.scripts)return[];let t=[],n=new Set(Object.keys(e.scripts)),r=(e,r,i)=>{for(let a of i)(a.scope??`project`)===`craftbook`&&!n.has(a.name)&&t.push(`step "${e}" ${r} references craftbook script "${a.name}" which is not in the scripts map${n.size>0?` (available: ${[...n].join(`, `)})`:``}`)};for(let t of e.steps)r(t.id,`onEnter`,me(t.onEnter)),r(t.id,`onExit`,me(t.onExit)),t.gate&&r(t.id,`gate`,Ae(t.gate).scripts);return t}var He=u({id:t().min(1),name:t().min(1),description:t().optional(),version:t().optional(),basedOn:T.optional(),plan:t().optional(),defaultAssignee:m.optional(),steps:l(v).min(1),entryStepId:t().min(1),triggers:l(t()).optional(),hooks:l(_).optional(),paramSchema:o(t(),f()).optional(),command:t().regex(/^[a-z][a-z0-9-]*$/).optional(),requirements:l(b).optional(),runModes:x.optional(),toolsets:l(S).optional(),connectors:l(C).optional(),scripts:w.optional(),spawn:y.optional(),createdAt:t(),updatedAt:t()}).superRefine(Re),Ue=r([`html-game`,`html-multiscreen-game`,`html-page`,`html-marketing-site`,`markdown-doc`,`markdown-report`,`markdown-notes`,`json`,`yaml-spec`,`code-module`,`code-with-tests`,`security-report`,`image-set`,`audio-file`,`slide-deck`,`data-file`,`generic-file`]),We=u({path:t().min(1),kind:Ue.optional(),minBytes:d().int().positive().optional(),maxAttempts:d().int().positive().optional(),artifact:n().optional(),requireChange:n().optional(),execute:n().optional(),columns:l(t().min(1)).min(1).optional(),minRows:d().int().positive().optional()}),E=u({id:t().optional(),name:t().min(1),description:t().optional(),prompt:t().optional(),suggestedGezelId:t().optional(),suggestedRole:t().optional(),capabilityFloor:Ie.optional(),assignee:m.optional(),onEnter:h.optional(),onExit:h.optional(),advanceWhen:Fe.optional(),gate:Oe.optional(),deliverable:We.optional(),next:t().optional(),branches:l(Pe).optional(),terminal:n().optional(),spawnFanout:n().optional()});u({id:t().optional(),name:t().min(1),description:t().optional(),basedOn:T.optional(),plan:t().optional(),defaultAssignee:m.optional(),steps:l(E).min(1),entryStepId:t().optional(),paramSchema:o(t(),f()).optional(),command:t().regex(/^[a-z][a-z0-9-]*$/).optional(),requirements:l(b).optional(),runModes:x.optional(),toolsets:l(S).optional(),scripts:w.optional()}),u({name:t().min(1).optional(),description:t().nullable().optional(),basedOn:T.nullable().optional(),plan:t().nullable().optional(),defaultAssignee:m.nullable().optional(),steps:l(E).min(1).optional(),entryStepId:t().optional(),paramSchema:o(t(),f()).nullable().optional(),command:t().regex(/^[a-z][a-z0-9-]*$/).nullable().optional(),requirements:l(b).nullable().optional(),runModes:x.nullable().optional(),toolsets:l(S).nullable().optional(),scripts:w.nullable().optional()}),u({craftbooks:l(u({id:t(),name:t(),description:t().optional(),version:t().optional(),basedOn:T.optional(),source:r([`bundled`,`local`,`project`]),stepCount:d().int().nonnegative()}))}),u({installedBy:i(`project-type`),typeId:t(),typeVersion:t(),bookVersion:t(),contentHash:t(),installedAt:t()}),u({suggestions:l(u({id:t(),name:t(),description:t().optional(),source:r([`bundled`,`local`,`project`]),version:t().optional(),basedOn:T.optional(),stepCount:d().int().nonnegative(),tags:l(t()).optional(),triggers:l(t()).optional(),score:d(),semantic:d().optional(),lexical:d()}))}),u({craftbook:He}),u({after:t().optional(),before:t().optional(),index:d().int().nonnegative().optional()}),u({id:t().optional(),name:t().min(1),description:t().optional(),basedOn:T.optional(),plan:t().optional(),entryStepId:t().optional(),triggers:l(t()).optional(),command:t().regex(/^[a-z][a-z0-9-]*$/).optional(),defaultAssignee:m.optional(),requirements:l(b).optional(),runModes:x.optional(),toolsets:l(S).optional(),connectors:l(C).optional(),paramSchema:o(t(),f()).optional(),hooks:l(_).optional(),steps:l(E).min(1),spawn:y.optional(),scripts:w.optional(),version:t().optional(),releasedAt:t().optional(),minGezelVersion:t().optional()});var Ge=Object.keys({broad:{baseW:46,hipW:52,waistW:52,chestW:56,shoulderW:54,label:`broad`,note:`Barrel torso, broad through the shoulders. Reads adult, sturdy.`},tapered:{baseW:58,hipW:52,waistW:46,chestW:38,shoulderW:32,label:`tapered`,note:`Classic peg-doll cone. Wide base, smooth taper to a narrow top.`},curvy:{baseW:48,hipW:60,waistW:34,chestW:46,shoulderW:36,label:`curvy`,note:`Hourglass — hip flare, pinched waist, narrower shoulders.`},athletic:{baseW:38,hipW:40,waistW:42,chestW:54,shoulderW:56,label:`athletic`,note:`V-shape. Wider chest and shoulders, narrower waist and hips.`},slender:{baseW:46,hipW:42,waistW:34,chestW:36,shoulderW:32,label:`slender`,note:`Narrow throughout. Reads tall and lean.`},stout:{baseW:62,hipW:64,waistW:62,chestW:58,shoulderW:50,label:`stout`,note:`Wide throughout. Reads grounded, generous.`}}),Ke=Object.keys({adult:{bodyScale:1,headScale:1,label:`adult`,note:`Standard crew member.`},shorter:{bodyScale:.88,headScale:.98,label:`shorter`,note:`Older or simply shorter adult.`},child:{bodyScale:.78,headScale:.96,label:`child`,note:`Short body, head reads proportionally larger.`},toddler:{bodyScale:.76,headScale:.95,label:`toddler`,note:`Smallest. Mostly head.`}}),qe=[`cap`,`beanie`,`kerchief`,`straw`,`newsboy`,`hood`],Je=[`scarf`,`apron`,`collar`,`turtleneck`],Ye=[`halo`,`short`,`long`,`bun`,`braids`,`shaved`,`bald`],Xe=`glasses.sunglasses.cateye.readers.monocle.eyepatch.earrings.earring-left.earring-right.flower.hairclip.headband.bowtie.necklace.brooch.facemask.goggles.safety-glasses.pince-nez.headphones.hearing-aid.nose-ring.hoop-earrings.drop-earrings.pearl-earrings.bandage.feather.pencil.ribbon.necktie.cravat.bolo-tie.lanyard.medal.pocket-square.tool-pendant`.split(`.`),Ze=[`beard`,`mustache`],Qe=[`freckles`,`mole`],$e=[`plain`,`buttons`,`stripes`,`sash`,`yoke`,`twotone`],et=[`smile`,`wider`,`neutral`,`wink`,`sleepy`];function tt(e){if(!e||typeof e!=`object`)return e;let t={...e},n=t.accessory;return n===`beard`||n===`mustache`?(t.facialHair??=n,t.accessory=null):n===`freckles`||n===`mole`?(t.mark??=n,t.accessory=null):n===`earring`&&(t.accessory=`earrings`),t}var nt=ee(tt,u({key:t().min(1),name:t(),bodyShape:r(Ge),figureScale:r(Ke),skin:t(),skin2:t(),hair:t(),hairShape:r(Ye),hat:r(qe).nullable().optional().default(null),dress:r(Je).nullable().optional().default(null),accessory:r(Xe).nullable().optional().default(null),facialHair:r(Ze).nullable().optional().default(null),mark:r(Qe).nullable().optional().default(null),expression:r(et).optional().default(`smile`),shirt:t(),shirtAccent:t(),shirtPattern:r($e).optional().default(`plain`)})),D=r([`default`,`acceptEdits`,`plan`,`bypassPermissions`]),rt=r([`plan`,`edit`,`reviewed`,`full`]),it=p([rt,r([`default`,`acceptEdits`,`bypassPermissions`])]),at=/^[A-Za-z0-9@][A-Za-z0-9@._-]{0,199}$/,ot=new Set([`CON`,`PRN`,`AUX`,`NUL`,`COM1`,`COM2`,`COM3`,`COM4`,`COM5`,`COM6`,`COM7`,`COM8`,`COM9`,`LPT1`,`LPT2`,`LPT3`,`LPT4`,`LPT5`,`LPT6`,`LPT7`,`LPT8`,`LPT9`]);function st(e){if(typeof e!=`string`||!at.test(e))return!1;let t=(e.split(`.`)[0]??``).toUpperCase();return!ot.has(t)}var ct=t().refine(st,{message:`must be a portable single-segment entity id`}),O=t().min(1).describe(`Canonical tuning profile id.`),lt=u({day:t().regex(/^\d{4}-\d{2}-\d{2}$/),kind:r([`fact`,`decision`,`pref`,`status`]),excerpt:t().min(1).max(400)}),ut=u({id:t(),kind:i(`trait`),title:t().min(1).max(80),traitText:t().min(1).max(200),evidence:l(lt).min(1).max(3)}),dt=a(`type`,[u({type:i(`profile`),profile:O}),u({type:i(`temperature`),delta:p([i(.1),i(-.1)])})]),ft=a(`kind`,[ut,u({id:t(),kind:i(`tuning`),title:t().max(80),description:t().max(300),action:dt}),u({id:t(),kind:i(`cosmetic`),title:t().max(80),cosmeticId:t()})]),pt=u({toLevel:d().int().min(2),proposals:l(ft).min(1).max(5),createdAt:t()}),mt=u({memoryXp:d().int().nonnegative().default(0),lessonsXp:d().int().nonnegative().default(0),taskXp:d().int().nonnegative().default(0),consultXp:d().int().nonnegative().default(0)}),ht=u({traitId:t(),text:t(),level:d().int(),adoptedAt:t(),evidence:l(lt),removedAt:t().optional()}),gt=u({kind:r([`trait`,`tuning`,`cosmetic`]),title:t(),traitText:t().optional(),level:d().int(),declinedAt:t()}),_t=u({version:i(1).default(1),level:d().int().min(1).default(1),xp:d().int().nonnegative().default(0),signals:mt.prefault({}),lastComputedAt:t().optional(),pendingLevelUp:pt.optional(),adoptedTraits:l(ht).default([]),declinedProposals:l(gt).default([]),unlockedCosmetics:l(u({id:t(),at:t()})).default([])}),vt=u({level:d().int().min(1),pending:n().optional()}),yt=u({multiplier:d().min(0).max(5).describe(`DRY penalty strength. 0 disables. 0.8 is a reasonable default.`),base:d().min(0).max(5).optional().describe(`Base of the exponential penalty for repeated tokens. Default 1.75.`),allowedLength:d().int().min(0).max(64).optional().describe(`Minimum n-gram length before DRY kicks in. Default 2.`)}).describe(`DRY anti-repetition sampler (llama.cpp only).`),bt=u({probability:d().min(0).max(1).describe(`Probability of triggering XTC on any given step.`),threshold:d().min(0).max(1).describe(`Minimum top-token probability for XTC to fire.`)}).describe(`XTC sampler (llama.cpp only).`),xt=u({temperature:d().min(0).max(2).optional().describe(`Sampling temperature. 0 = greedy. Most reasoning models want 0.6–1.0.`),topP:d().min(0).max(1).optional().describe(`Nucleus sampling. 0.95 is the common default for Qwen, Gemma, Nemotron.`),topK:d().int().min(0).max(1e3).optional().describe(`Top-k cutoff. 20 for Qwen think, 64 for Gemma, 1 for greedy-on-instruct.`),minP:d().min(0).max(1).optional().describe(`Min-p cutoff (llama.cpp / MLX / Ollama). Qwen recommends 0.`),maxTokens:d().int().positive().optional().describe(`Per-turn output token cap. Maps to num_predict / max_tokens / n_predict.`),seed:d().int().optional().describe(`RNG seed. Unset / negative = random. Best-effort determinism on cloud.`),repetitionPenalty:d().min(0).max(3).optional().describe(`Local engines (Ollama / llama.cpp / MLX): repeat_penalty. 1.0 = off, 1.1 = mild.`),repetitionContext:d().int().positive().optional().describe("Local engines: window size for repetition penalty (`repeat_last_n`)."),frequencyPenalty:d().min(-2).max(2).optional().describe(`Cloud (OpenAI) and Ollama / llama.cpp: penalize repeated tokens by frequency.`),presencePenalty:d().min(-2).max(2).optional().describe(`Cloud (OpenAI) and Ollama / llama.cpp: penalize any reused token.`),dry:yt.optional(),xtc:bt.optional()}).describe(`Sampling parameters applied per-request.`),St=u({effort:r([`low`,`medium`,`high`]).optional().describe("Cloud reasoning effort. Maps to OpenAI `reasoning.effort` and Anthropic `thinking.budget_tokens` tiers."),thinkingBudget:d().int().positive().optional().describe("Explicit thinking-token budget (Anthropic `thinking.budget_tokens`, Nemotron `reasoning_budget`). Wins over `effort` when both set."),enableThinking:n().optional().describe(`Chat-template toggle for dual-mode models (Qwen3+, Nemotron Nano/Super). Implicit on cloud thinking models.`),templateKwargs:o(t(),p([t(),d(),n()])).optional().describe("Chat-template variables that drive this model's reasoning depth, forwarded verbatim as `chat_template_kwargs` on local engines. The names are the model's own — GPT-OSS reads `reasoning_effort`, Muse Glimmer reads `reasoning_strength` (low|medium|high|xhigh) — so the manifest declares them rather than the runtime guessing. Lives under `reasoning` (not `engine`) because depth is a per-request choice a tuning profile overrides: `thinking-coding` can ask for xhigh while `instruct` asks for low. Cloud providers ignore it; use `reasoning.effort` there.")}).describe(`Reasoning controls.`),Ct=u({responseFormat:r([`text`,`json_object`]).optional().describe("Output mode. `text` = freeform (default). `json_object` = enforce JSON."),jsonSchema:f().optional().describe(`Pin output to a JSON Schema (OpenAI strict mode, llama.cpp --json-schema).`),grammar:t().optional().describe(`llama.cpp GBNF grammar. Last-resort structured-output knob.`)}).describe(`Structured-output controls.`),wt=u({enableThinkingTag:t().optional().describe("User-prompt tag that enables thinking for this turn (e.g. `/think`)."),disableThinkingTag:t().optional().describe("User-prompt tag that disables thinking for this turn (e.g. `/no_think`).")}).describe(`Per-turn reasoning toggle tags.`),Tt=u({llamaCpp:u({nGpuLayers:d().int().min(-1).optional().describe("`--n-gpu-layers` override. -1 = all. Unset = b9843 `auto`/`--fit`."),cpuMoe:n().optional().describe("`--cpu-moe`: keep ALL MoE experts in system RAM (attention/dense on GPU)."),nCpuMoe:d().int().min(0).optional().describe("`--n-cpu-moe N`: keep the first N layers’ MoE experts in RAM. Partial split."),cacheReuse:d().int().min(0).optional().describe("`--cache-reuse N` prefix-KV reuse chunk. 0 = disable. Unset inherits the global default."),swaFull:n().optional().describe("`--swa-full`: full-size SWA cache (Gemma family)."),flashAttn:r([`on`,`off`,`auto`]).optional().describe("`--flash-attn` mode override for this model."),ubatchSize:d().int().positive().optional().describe("`--ubatch-size` (inner microbatch) override for this model."),contextSize:d().int().positive().optional().describe(`Per-turn context ceiling (tokens) this model launches with. Capped by GGUF train ctx.`),chatTemplate:t().min(1).optional().describe("`--chat-template` override for GGUFs whose embedded Jinja template is incompatible with llama.cpp tool parsing."),threads:d().int().positive().optional().describe("`--threads` override."),batchSize:d().int().positive().optional().describe("`--batch-size` override."),spec:u({type:r([`none`,`draft-mtp`,`draft-eagle3`,`draft-dflash`,`draft-simple`,`ngram-mod`,`ngram-simple`,`ngram-map-k`,`ngram-map-k4v`,`ngram-cache`]).optional().describe("`--spec-type` speculative-decoding mode for this model."),mtp:n().optional().describe("VERIFIED capability metadata: this model’s target or companion GGUF carries MTP tensors. Does not enable `draft-mtp` by itself."),draftModelId:t().optional().describe("Catalog id / path of the draft model for `draft-simple`."),nMax:d().int().positive().optional().describe("`--spec-draft-n-max`: tokens drafted per step.")}).optional().describe(`Speculative-decoding config for this model.`)}).describe(`Per-model llama.cpp launch-flag defaults (engine-level, applied at model load).`).optional()}).describe(`Per-model engine launch-flag defaults, keyed by engine.`),Et=u({sampling:xt.optional(),samplingWhenThinking:xt.optional().describe("Sparse override of `sampling` applied when the runtime determines reasoning is engaged. Used by Qwen3+ (different sampling for /think mode) and Nemotron Nano (different sampling for thinking vs instruct)."),reasoning:St.optional(),output:Ct.optional(),toolChoice:r([`auto`,`required`,`none`]).optional().describe("Tool selection mode (cloud + llama.cpp + MLX). `auto` lets the model decide; `required` forces a tool call this turn; `none` disables tools."),promptTags:wt.optional()}).describe(`Per-model sampling, reasoning, and output defaults (without profiles).`),k=Et.extend({engine:Tt.optional().describe("Per-model ENGINE launch-flag defaults (llama.cpp `--n-gpu-layers`, `--cpu-moe`, `--spec-type`, …). Applied once at model load, not per request — so it lives on the top-level tuning object, not inside per-request `profiles`."),profiles:o(O,Et.partial()).optional().describe("Named tuning presets this model implements. Gezel frontmatter `tuningProfile` selects one; the resolver applies the profile as a layer between installDefault and catalog base. Missing requested profiles walk the canonical fallback chain.")}).describe(`Per-model sampling, reasoning, and output defaults.`),Dt=/^[a-z0-9](?:[a-z0-9._~-]*[a-z0-9])?$/,Ot=String.raw`(?:0|[1-9]\d*)`,kt=String.raw`(?:${Ot}|[xX*])`,At=String.raw`${kt}(?:\.${kt}){0,2}`,jt=String.raw`[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*`,Mt=String.raw`(?:-${jt})?(?:\+${jt})?`,Nt=new RegExp(String.raw`^(?:\^|~|>=|<=|>|<|=)?v?${At}${Mt}$`),Pt=new RegExp(String.raw`^v?${At}${Mt}\s+-\s+v?${At}${Mt}$`),Ft=/^[a-z][a-z0-9._-]{0,127}$/;function It(e){if(typeof e!=`string`||e.length===0||e.length>214||e!==e.trim()||e!==e.toLowerCase())return!1;if(e.startsWith(`@`)){let t=e.slice(1).split(`/`);return t.length===2&&t[0]!==void 0&&t[1]!==void 0&&Dt.test(t[0])&&Dt.test(t[1])}return!e.includes(`/`)&&Dt.test(e)}function Lt(e){if(typeof e!=`string`||e.length===0||e.length>128||e!==e.trim())return!1;if(Ft.test(e)||Pt.test(e))return!0;let t=e.split(`||`);return!t.some(e=>e.trim().length===0)&&t.every(e=>{let t=e.trim().split(/\s+/);return t.length>0&&t.every(e=>Nt.test(e))})}var A=t().refine(It,{message:`must be a lowercase npm registry package name (for example zod or @types/node)`}),j=t().refine(Lt,{message:`must be a registry dist-tag or semver range`}),Rt=u({package:A,version:j.optional()}).strict(),zt=u({package:A,version:j,decision:r([`install`,`always`,`decline`])}),Bt=u({selectedChoices:l(d().int().min(0)).optional(),writeIn:t().optional(),declined:n().optional(),silentSkip:n().optional(),npmInstallDecisions:l(zt).optional(),at:t()}),Vt=u({package:A,version:j}),Ht=r([`script`,`npx`]),Ut=u({path:t().min(1),sha256:t().regex(/^[a-f0-9]{64}$/)}),Wt=u({kind:i(`command-approval`),scope:Ht,name:t().min(1),body:t().optional(),args:l(t()).optional(),inputFiles:l(Ut).max(128).optional()}),Gt=u({kind:i(`tool-permission`),toolName:t(),toolInput:o(t(),f())}),Kt=u({kind:i(`toolset-install-approval`),toolsetId:t(),sourceId:t(),version:t(),targetProjectId:t(),craftbookId:t()}),qt=u({kind:i(`image-generation-approval`),provider:t(),model:t(),promptPreview:t(),estimatedSize:t().optional()}),Jt=u({kind:i(`video-generation-approval`),provider:t(),model:t(),promptPreview:t(),estimatedSize:t().optional()}),Yt=u({kind:i(`schedule-approval`),typeId:t(),craftbookId:t(),runMode:r([`scheduled`,`night-shift`]).optional(),cron:t(),overlap:r([`skip`,`queue`,`concurrent`]).optional()}),Xt=u({kind:i(`night-shift-review`),windowKey:t(),tasksCompleted:d(),reports:l(u({projectId:t(),path:t(),title:t().optional(),actionCount:d()}))}),Zt=r([`gate_exhausted`,`gate_plateau`,`gate_unsatisfiable`,`gate_infrastructure`,`step_stalled`,`budget_exhausted`]),Qt=u({kind:i(`task-paused`),taskRef:t(),stepId:t().optional(),reason:Zt}),$t=a(`kind`,[u({kind:i(`npm-install-approval`),packages:l(Vt).min(1)}),Wt,Gt,Kt,qt,Jt,Yt,Xt,Qt]),en=u({id:t(),projectId:t(),gezelId:t(),sessionId:t(),prompt:t().min(1),choices:l(t()).max(20).optional(),allowWriteIn:n().optional(),multiSelect:n().optional(),taskRef:t().optional(),documentPath:t().optional(),intent:$t.optional(),createdAt:t(),answer:Bt.optional()}),tn=u({make:t().optional(),model:t().optional(),lensModel:t().optional(),dateTimeOriginal:t().optional(),orientation:d().int().min(1).max(8).optional(),software:t().optional(),imageDescription:t().optional()}),nn=u({format:r([`png`,`jpeg`,`gif`,`webp`,`svg`,`unknown`]),width:d().int().positive().optional(),height:d().int().positive().optional(),byteLength:d().int().nonnegative(),sha256:t().regex(/^[a-f0-9]{64}$/),pngText:o(t(),t()).optional(),exif:tn.optional(),gps:u({lat:d(),lon:d()}).optional(),gpsRedacted:n().optional(),likelyScreenshot:n().optional()}),rn=r([`describe`,`ocr`,`ui`,`extract`]),an=r([`auto`,`describe`,`ocr`,`ui`,`extract`]);u({schemaVersion:i(1),sha256:t().regex(/^[a-f0-9]{64}$/),meta:nn,modes:l(rn).min(1),description:t().optional(),ocrText:t().optional(),structured:u({templateId:t().optional(),data:f()}).optional(),engine:r([`llama-cpp`,`mlx`,`mock`,`none`]),modelId:t(),status:r([`ok`,`partial`,`failed`,`static-only`]),failureReason:t().optional(),durationMs:d().int().nonnegative(),at:t()});var on=u({ref:t(),sha256:t().regex(/^[a-f0-9]{64}$/),digest:t(),modelId:t(),modes:l(rn),status:r([`ok`,`partial`,`failed`,`static-only`]),at:t()});u({artifactPath:t().min(1).optional(),data:t().min(1).optional(),mimeType:t().optional(),mode:an.default(`auto`),schema:f().optional(),model:t().optional()}),u({state:r([`ok`,`no-model`,`not-configured`,`error`]),modelId:t().optional(),detail:t().optional()});var sn=p([u({type:i(`progress`),bytesWritten:d().int().nonnegative(),totalBytes:d().int().nonnegative().optional()}),u({type:i(`error`),error:t()}),u({type:i(`done`),id:t()})]);u({models:l(u({id:t(),name:t(),description:t(),license:t(),approxSizeBytes:d().int().nonnegative(),recoScore:d()}))}),u({models:l(u({id:t(),name:t(),approxSizeBytes:d().int().nonnegative(),installedAt:t(),weightsPath:t().optional(),mmprojPath:t().optional()}))});var cn=r([`image_generation`,`video_generation`,`image_recognition`]),ln=u({startedAt:d(),streamedContentChars:d().int().nonnegative(),toolCalls:d().int().nonnegative(),fileMutations:d().int().nonnegative()}),un=u({sessionId:t(),gezelId:t(),projectId:t(),inflight:n(),turnsStarted:d().int().nonnegative(),deltaChunks:d().int().nonnegative(),streamedContentChars:d().int().nonnegative(),wirePulses:d().int().nonnegative(),heartbeats:d().int().nonnegative(),enginePhaseEvents:d().int().nonnegative(),generationSpurts:d().int().nonnegative(),toolCalls:d().int().nonnegative(),toolArgChars:d().int().nonnegative(),fileMutations:d().int().nonnegative(),gpuEvents:d().int().nonnegative(),gpuTaskActive:cn.nullable(),lastStreamActivityAt:d().nullable(),lastToolActivityAt:d().nullable(),lastMutationAt:d().nullable(),lastGpuActivityAt:d().nullable(),lastProgressAt:d().nullable(),currentTurn:ln.nullable()});u({version:i(1),capturedAt:d(),sessions:l(un)});var M=r([`copilot`,`openai`,`anthropic`,`anthropic-cli`,`codex-cli`,`ollama`,`llama-cpp`,`mlx`,`ds4`,`remote`]),dn=r([`male`,`female`,`non-binary`]),fn=u({tool:t().min(1),promptKey:t().min(1).default(`prompt`),defaults:o(t(),f()).optional()}),pn=u({id:t(),text:t().min(1).max(200),adoptedAt:t(),source:r([`levelup`,`manual`]).optional()}),mn=u({frontmatter:u({id:ct.optional(),name:t(),description:t().optional(),role:t().optional(),roleBasedName:t().optional(),gender:dn.optional(),model:t().optional(),provider:M.optional(),reasoningEffort:t().optional(),tuning:k.optional(),tuningProfile:O.optional(),suggestedTuningProfile:O.optional(),tools:l(t()).optional(),tags:l(t()).optional(),fixedFunction:fn.optional(),numCtx:d().int().positive().optional(),autoRecall:n().optional(),font:t().optional(),voice:t().optional(),templateId:t().optional(),templateVersion:t().optional(),sandboxCopilot:n().optional(),claudePermissionMode:D.optional(),codexPermissionMode:it.optional(),iconOverride:n().optional(),traits:l(pn).max(8).optional(),recognition:r([`auto`,`always`,`off`]).optional()}),sections:l(u({heading:t(),template:t().optional(),params:o(t(),t()).optional(),body:t()})),source:t()}),hn=u({id:ct,name:t(),description:t().optional(),role:t().optional(),roleBasedName:t().optional(),gender:dn.optional(),model:t().optional(),provider:M.optional(),reasoningEffort:t().optional(),tuningProfile:O.optional(),suggestedTuningProfile:O.optional(),numCtx:d().int().positive().optional(),autoRecall:n().optional(),font:t().optional(),voice:t().optional(),templateId:t().optional(),templateVersion:t().optional(),sandboxCopilot:n().optional(),claudePermissionMode:D.optional(),codexPermissionMode:it.optional(),fixedFunction:fn.optional(),icon:t().optional(),poppetje:nt.optional(),iconOverride:n().optional(),recognition:r([`auto`,`always`,`off`]).optional(),scope:r([`global`,`project`]).optional(),storageScope:r([`user`,`machine-shared`]).optional(),traits:l(pn).optional(),growth:vt.optional(),updatedAt:t()});hn.extend({parsed:mn,about:t(),toolsMd:t().nullable().default(null)});var gn=u({path:t(),mimeType:t()}),_n=u({path:t(),mimeType:t(),durationSeconds:d().optional(),voice:t().optional()}),vn=u({path:t(),mimeType:t(),posterPath:t().optional()}),yn=u({name:t(),durationMs:d(),success:n(),errorMessage:t().optional(),path:t().optional(),paths:l(t()).optional(),argsSummary:t().optional(),argsFull:t().optional(),resultText:t().optional(),resultTruncated:n().optional(),images:l(gn).optional(),audios:l(_n).optional(),videos:l(vn).optional(),diff:t().optional(),addedLines:d().int().nonnegative().optional(),removedLines:d().int().nonnegative().optional()}),N=u({role:r([`user`,`assistant`]),content:t(),at:t(),from:u({gezelId:t(),gezelName:t()}).optional(),referencedArtifacts:l(t()).optional(),referencedTasks:l(t()).optional(),toolCalls:l(yn).optional(),intents:l(u({label:t(),afterChars:d().int().min(0)})).optional(),pendingQuestionId:t().optional(),synthetic:r([`compaction-summary`,`context-loop-halt`,`turn-aborted`,`growth-announcement`,`keurmeester-notice`]).optional(),hidden:n().optional(),nudge:n().optional(),warnings:l(t()).optional(),reasoning:t().optional(),reasoningDurationMs:d().int().nonnegative().optional(),attemptedToolCalls:l(u({body:t(),reason:t().optional()})).optional(),recognizedImages:l(on).optional()}),bn=u({code:t().max(64).optional(),engine:t().max(64).optional(),incidentId:t().max(64).optional(),panicKind:t().max(64).optional(),exitCode:d().int().nullable().optional(),signal:t().max(32).nullable().optional(),diagnostics:o(t(),p([t(),d(),n()])).optional()}),xn=a(`type`,[u({type:i(`delta`),content:t()}),u({type:i(`reasoning_delta`),content:t()}),u({type:i(`complete`),message:N}),u({type:i(`user_message`),message:N}),u({type:i(`tool`),name:t(),durationMs:d(),success:n(),errorMessage:t().optional(),path:t().optional(),paths:l(t()).optional(),argsSummary:t().optional(),argsFull:t().optional(),resultText:t().optional(),resultTruncated:n().optional(),images:l(gn).optional(),audios:l(_n).optional(),videos:l(vn).optional(),diff:t().optional(),addedLines:d().int().nonnegative().optional(),removedLines:d().int().nonnegative().optional()}),u({type:i(`error`),error:t(),errorDetail:bn.optional()}),u({type:i(`cancelled`)}),u({type:i(`done`)}),u({type:i(`queued`),aheadOf:d().int().min(0)}),u({type:i(`wire_pulse`)}),u({type:i(`tool_args_delta`),name:t(),content:t()}),u({type:i(`heartbeat`),label:t().optional()}),u({type:i(`warning`),message:t(),action:u({kind:i(`settings`),section:r([`llamaCpp`,`mlx`,`ds4`])}).optional()}),u({type:i(`intent`),label:t()}),u({type:i(`queue_enqueued`),queueId:t(),preview:t(),enqueuedAt:t(),nudge:n().optional()}),u({type:i(`queue_removed`),queueId:t(),reason:r([`started`,`canceled`,`rejected`])}),u({type:i(`context_warning`),estimatedTokens:d(),numCtx:d(),model:t()}),u({type:i(`context_compacted`),removedCount:d().int().nonnegative(),model:t()}),u({type:i(`context_loop`),compactionsThisSend:d().int().positive(),reason:t()}),u({type:i(`keurmeester_intervention`),caseId:t(),gezelId:t(),gezelName:t(),action:t(),summary:t()}),u({type:i(`recall_applied`),hitCount:d(),query:t()}),u({type:i(`question_asked`),question:en}),u({type:i(`question_answered`),question:en}),u({type:i(`task_event`),eventId:t(),kind:t(),summary:t(),at:t(),taskRef:t().optional()}),u({type:i(`growth_level_up`),gezelId:t(),gezelName:t(),toLevel:d().int()}),u({type:i(`engine_phase`),provider:r([`llama-cpp`,`mlx`,`ds4`]),phase:r([`starting`,`loading_model`,`prefill`,`generating`,`ready`]),detail:t().optional(),progress:d().min(0).max(1).optional(),ttftMs:d().int().nonnegative().optional()}),u({type:i(`turn_stats`),provider:r([`llama-cpp`,`ollama`,`mlx`,`ds4`]),promptTokens:d().int().nonnegative(),completionTokens:d().int().nonnegative(),durationMs:d().int().nonnegative(),tokensPerSec:d().nonnegative().optional()}),u({type:i(`engine_stats`),provider:r([`llama-cpp`,`mlx`,`ds4`]),ramAllocBytes:d().nonnegative()}),u({type:i(`gpu_swap`),state:r([`started`,`progress`,`ended`]),task:cn,detail:t().optional(),prompt:t().optional(),progress:d().min(0).max(1).optional(),step:d().int().nonnegative().optional(),totalSteps:d().int().positive().optional(),secondsPerStep:d().nonnegative().optional()}),u({type:i(`awaiting_gezel`),state:r([`started`,`ended`]),targetGezelName:t()}),u({type:i(`project_created`),projectId:t(),name:t()}),u({type:i(`project_deleted`),projectId:t(),name:t()}),u({type:i(`gezel_created`),gezelId:t(),name:t()}),u({type:i(`night_shift`),active:n(),source:r([`scheduled`,`manual`]).nullable()}),u({type:i(`meester_status`),state:r([`started`,`ended`,`failed`]),generatedAt:t().optional()}),u({type:i(`index_progress`),phase:r([`scan`,`shadow`,`enrich`,`review`,`digest`]),state:r([`started`,`progress`,`ended`]),projectId:t().optional(),detail:t().optional(),pending:d().int().nonnegative().optional(),gezelId:t().optional(),gezelName:t().optional()})]),Sn=u({sessionId:t(),gezelId:t(),projectId:t(),event:xn}),Cn=r(`gezel.created,gezel.deleted,gezel.renamed,gezel.settings.updated,gezel.about.generated,icon.generated,icon.reverted,poppetje.generated,poppetje.updated,poppetje.rerolled,project.created,project.deleted,project.updated,project.about.updated,project.mission.updated,project.voorman.changed,project.gezel.joined,project.gezel.left,project.suggested-work.enabled,project.suggested-work.disabled,project.properties.updated,report.action.fired,report.action.dismissed,project.status.changed,project.nudge.sent,project.github.linked,project.github.unlinked,project.github.synced,project.review.requested,project.review.settled,project.connector.bound,project.connector.unbound,project.connector.synced,document.created,document.renamed,document.deleted,workspace.write,workspace.delete,workspace.mkdir,workspace.move,workspace.npm.installed,workspace.npm.declined,workspace.script.run,workspace.script.declined,workspace.npx.run,workspace.npx.declined,terminal.command.run,workspace.allow-writes.changed,tool.called,page.tool.invoked,page.reaction.sent,tool.gated,meester.changed,klerk.changed,boekwachter.changed,keurmeester.changed,gilde.updated,v1.chat.completion,keurmeester.intervention,keurmeester.digest.generated,task.created,task.activated,task.updated,task.status.changed,task.assignee.changed,task.step.added,task.step.activated,task.step.completed,task.step.redriven,task.step.stalled,task.step.gated,task.step.routed,task.entry.dispatched,task.craftbook.tier-collapsed,task.tick,task.canceled,task.instance.spawned,task.fanout.materialized,tasknote.appended,tasknote.updated,tasknote.deleted,task.about.updated,task.step.updated,task.step.removed,task.craftbook.reordered,task.craftbook.updated,craftbook.created,craftbook.updated,craftbook.deleted,toolset.config.updated,config.credential.updated,config.engagementMode.changed,memory.auto-recalled,memory.auto-summarized,memory.compacted,memory.lessons-updated,project.digest.generated,project.index.reviewed,meester.status.generated,gezel.level.up,gezel.trait.adopted,gezel.trait.removed,gezel.tuning.adjusted,chat.compacted,gezel.messaged,gezel.message.delivered,gezel.message.delivery_failed,gezel.reply.dropped,chat.mention.fanout,render.generated,user.question.asked,user.question.answered,debug.bridge.failed,channel.configured,channel.message.sent,channel.message.failed,copilot.builtin.denied,credential.used,eval.trial.started,eval.trial.completed`.split(`,`)),wn=u({id:t(),at:t(),kind:Cn,projectId:t().optional(),gezelId:t().optional(),summary:t(),details:o(t(),f()).optional()}),Tn=u({entryType:i(`session`),id:t(),gezelId:t(),projectId:t(),title:t(),createdAt:t(),lastActivityAt:t(),messageCount:d(),durationMs:d(),providerName:M,model:t().optional(),archived:n().optional()}),En=a(`entryType`,[wn.extend({entryType:i(`event`)}),Tn]);u({projectId:t().optional(),gezelId:t().optional(),kinds:l(Cn).optional(),from:t().optional(),to:t().optional(),q:t().optional(),limit:d().int().positive().optional(),include:r([`events`,`entries`]).optional()}),u({entries:l(En)});var P=p([Te,u({kind:i(`prometheusAlerts`),file:t().min(1),minRules:d().int().positive().optional(),maxPageAlerts:d().int().nonnegative().optional(),allowedSeverities:l(t().min(1)).optional(),requiredServices:l(t().min(1)).optional(),requiredRunbookUrls:l(t().min(1)).optional()}).strict(),u({kind:i(`nodeScriptPasses`),script:t().min(1),timeoutMs:d().int().positive().optional(),requiredOutput:l(u({pattern:t().min(1),flags:t().optional(),label:t().optional()}).strict()).optional()}).strict(),u({kind:i(`binaryDocument`),file:t().min(1),artifact:n().optional(),minBytes:d().int().positive().optional()}).strict()]),F=t().min(1).regex(/^[a-z0-9][a-z0-9-]*$/,`mock service ids are lowercase kebab-case`),Dn=t().min(1).regex(/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/,`mock toolset ids are lowercase catalog ids or scoped npm-style ids`),On=u({method:r([`GET`,`POST`,`PUT`,`PATCH`,`DELETE`]).default(`GET`),path:t().min(1),status:d().int().min(100).max(599).default(200),headers:o(t(),t()).optional(),body:f(),latencyMs:d().int().nonnegative().optional()}).strict(),kn=a(`kind`,[u({kind:i(`http`),id:F,description:t().min(1),credential:u({name:t().regex(/^mock\.[a-z0-9][a-z0-9.-]*$/,`mock credentials are named mock.<service-id>`),authScheme:r([`bearer`,`basic`]).optional()}).strict(),routes:l(On).min(1)}).strict(),u({kind:i(`webhook`),id:F,description:t().min(1),path:t().min(1).optional()}).strict(),u({kind:i(`cli`),id:F,description:t().min(1),shim:u({path:t().min(1),content:t()}).strict()}).strict(),u({kind:i(`mcp`),id:F,description:t().min(1),toolsetId:Dn.optional(),tools:l(u({name:t().min(1),description:t().min(1),resultTemplate:f().optional(),resultSequence:l(f()).min(1).optional(),writeFixture:u({surface:r([`workspace`,`artifact`]),pathArgument:t().min(1),fixture:r([`minimal-pptx`,`minimal-docx`,`minimal-pdf`,`minimal-png`])}).strict().optional()}).strict()).min(1)}).strict()]),An=u({path:t().min(1),content:t(),surface:r([`workspace`,`artifact`,`harness`]).optional(),modelInput:n().optional()}).strict(),jn=u({name:t().min(1),role:t().min(1),description:t().optional(),about:t().optional()}).strict(),Mn=u({projectName:t().min(1),about:t().optional(),missionObjectives:t().optional(),files:l(An).default([]),craftbookParams:o(t(),t()).optional(),worker:jn.optional()}).strict(),Nn=u({path:t().min(1),kind:Ue,minBytes:d().int().positive().optional(),checks:l(P).optional()}).strict(),Pn=u({service:F,minRequests:d().int().positive().optional(),requiredPaths:l(t().min(1)).optional(),forbiddenPaths:l(t().min(1)).optional(),requiredTools:l(t().min(1)).optional(),toolCalls:o(t().min(1),u({minCalls:d().int().nonnegative().default(1),maxCalls:d().int().nonnegative().optional()}).strict().refine(e=>e.maxCalls===void 0||e.minCalls<=e.maxCalls,`minCalls must be less than or equal to maxCalls`)).optional()}).strict(),Fn=u({kind:Cn,minEntries:d().int().nonnegative().default(1),maxEntries:d().int().nonnegative().optional(),summaryPattern:t().min(1).optional(),flags:t().optional(),details:o(t(),p([t(),d(),n(),s()])).optional()}).strict(),In=u({summary:t().min(1),deliverables:l(Nn).optional(),checks:l(P).optional(),taskNotes:u({minBytes:d().int().positive().optional(),checks:l(P).optional(),requireCraftbookTask:n().optional()}).strict().optional(),taskGraph:u({checks:l(P).optional(),requireCraftbookTask:n().optional(),requireTerminalStep:n().optional(),requireDraftRef:n().optional(),draft:u({status:r([`draft`,`paused`,`active`,`complete`,`canceled`]).optional(),minDescriptionBytes:d().int().positive().optional(),minOutcomes:d().int().positive().optional(),minSteps:d().int().positive().optional(),requireTerminalVerification:n().optional(),requireGatedBuildSteps:n().optional()}).strict().optional()}).strict().optional(),mocks:l(Pn).optional(),history:l(Fn).optional(),unchangedFixtures:l(t().min(1)).optional()}).strict(),Ln=u({artifact:u({path:t().min(1),kind:r([`html`,`markdown`,`yaml`,`typescript`,`json`,`text`])}).strict(),axes:l(u({name:t().min(1),description:t().min(1)}).strict()).min(1),contextNote:t().optional()}).strict();u({schemaVersion:i(1),title:t().min(1),objective:t().min(1),tags:l(t().min(1)).default([]),prompt:t().min(1),setup:Mn,mocks:l(kn).default([]),success:In,rubric:Ln,qualityFocus:l(t().min(1)).default([]),extensions:o(t(),f()).optional()}).strict().superRefine((e,t)=>{let n=new Set(e.mocks.map(e=>e.id)),r=new Map(e.mocks.map(e=>[e.id,e]));for(let[i,a]of(e.success.mocks??[]).entries()){if(n.has(a.service)||t.addIssue({code:c.custom,path:[`success`,`mocks`,i,`service`],message:`success.mocks[${i}] references unknown mock service "${a.service}"`}),a.requiredTools&&a.requiredTools.length>0){let e=r.get(a.service);if(e&&e.kind!==`mcp`)t.addIssue({code:c.custom,path:[`success`,`mocks`,i,`requiredTools`],message:`success.mocks[${i}].requiredTools requires an mcp service; "${a.service}" is kind "${e.kind}"`});else if(e?.kind===`mcp`){let n=new Set(e.tools.map(e=>e.name));for(let e of a.requiredTools)n.has(e)||t.addIssue({code:c.custom,path:[`success`,`mocks`,i,`requiredTools`],message:`success.mocks[${i}].requiredTools names undeclared tool "${e}" on mcp service "${a.service}"`})}}if(a.toolCalls&&Object.keys(a.toolCalls).length>0){let e=r.get(a.service);if(e&&e.kind!==`mcp`)t.addIssue({code:c.custom,path:[`success`,`mocks`,i,`toolCalls`],message:`success.mocks[${i}].toolCalls requires an mcp service; "${a.service}" is kind "${e.kind}"`});else if(e?.kind===`mcp`){let n=new Set(e.tools.map(e=>e.name));for(let e of Object.keys(a.toolCalls))n.has(e)||t.addIssue({code:c.custom,path:[`success`,`mocks`,i,`toolCalls`,e],message:`success.mocks[${i}].toolCalls names undeclared tool "${e}" on mcp service "${a.service}"`})}}}for(let[n,r]of e.mocks.entries())r.kind===`http`&&r.credential.name!==`mock.${r.id}`&&t.addIssue({code:c.custom,path:[`mocks`,n,`credential`,`name`],message:`http mock "${r.id}" must use credential name "mock.${r.id}"`});let i=new Set(e.setup.files.filter(e=>e.surface===void 0||e.surface===`workspace`).map(e=>e.path));for(let[n,r]of(e.success.unchangedFixtures??[]).entries())i.has(r)||t.addIssue({code:c.custom,path:[`success`,`unchangedFixtures`,n],message:`unchanged fixture "${r}" is not a seeded workspace file`});for(let[n,r]of(e.success.history??[]).entries())r.maxEntries!==void 0&&r.minEntries>r.maxEntries&&t.addIssue({code:c.custom,path:[`success`,`history`,n],message:`minEntries must be less than or equal to maxEntries`})});var Rn=u({id:t().min(1),label:t().min(1),description:t().optional(),kind:r([`gezel`,`model`]).default(`model`),provider:t().min(1),gezelId:t().min(1).optional(),role:t().min(1).optional(),modelLabel:t().min(1).optional(),contextWindow:d().int().positive().optional(),supportsReasoning:n().optional(),supportsTools:n().optional()});u({state:r([`not-configured`,`configured`,`update-needed`,`conflict`,`unavailable`]),models:l(Rn),configuredModel:t().optional(),recommendedModel:t().optional(),reasons:l(t()),message:t().optional(),codexInstalled:n(),codexVersion:t().optional(),codexPath:t().optional(),endpointsEnabled:n(),profileName:t().min(1),profilePath:t().min(1),launchCommand:t().min(1),bridge:u({baseUrl:t().url(),listening:n(),port:d().int().nonnegative()}),canConfigure:n(),canRemove:n()}),u({model:t().min(1)});var zn=t().url().refine(e=>{try{let t=new URL(e);return t.protocol===`https:`&&!t.username&&!t.password&&t.pathname===`/`&&!t.search&&!t.hash}catch{return!1}},{message:`must be an exact HTTPS origin (for example https://api.example.com)`}),Bn=u({url:t().min(1),branch:t().optional(),checkoutDir:t().optional(),lastSyncedAt:t().optional(),defaultBranch:t().optional()}),Vn=u({id:t().min(1),type:t().min(1),sourceId:t().optional(),version:t().optional(),displayName:t().optional(),corpusDir:t().optional(),config:o(t(),f()).default({}),cursor:f().optional(),disabled:n().optional(),lastSyncedAt:t().optional(),lastError:t().optional()}),Hn=u({enabled:n().optional(),rapidIntervalMs:d().int().positive().optional(),slowIntervalMs:d().int().positive().optional(),recentActivityWindowMs:d().int().positive().optional(),rapidAttemptsBeforeBackoff:d().int().positive().optional(),firstNudgeGraceMs:d().int().nonnegative().optional()}),Un=u({lastNudgedAt:t().optional(),consecutiveRapidNudges:d().int().nonnegative().optional()}),Wn=u({overview:n().optional(),tasks:n().optional(),approvals:n().optional(),workspace:n().optional(),artifacts:n().optional(),map:n().optional()}).strict(),Gn=r([`auto`,`allow`,`deny`]),Kn=u({id:t(),version:t(),source:t(),params:o(t(),f()).optional(),appliedAt:t()}),qn=u({id:ct,name:t(),description:t().optional(),workingDir:t().optional(),voormanGezelId:t().optional(),voormanAutoAssignedAt:t().optional(),gezelIds:l(t()).optional(),suggestedWorkDismissed:l(t()).optional(),properties:o(t(),t()).optional(),mode:r([`crew`,`solo`]).optional(),leadLabel:t().optional(),leanProfile:n().optional(),indexingEnabled:n().optional(),github:Bn.optional(),connectors:l(Vn).optional(),nudgeConfig:Hn.optional(),nudgeState:Un.optional(),tabVisibility:Wn.optional(),managedWorkspaceWritePolicy:Gn.optional(),allowGezelWrites:n().optional(),codexPermissionMode:rt.optional(),claudePermissionMode:D.optional(),status:r([`active`,`readonly`,`inactive`,`stable`]).optional(),archived:n().optional(),workspaceScriptTimeoutMs:d().int().min(3e4).max(30*6e4).optional(),grantedCredentials:l(t()).optional(),credentialAllowedOrigins:o(t(),l(zn)).optional(),projectTypeId:t().optional(),detectedProjectType:u({id:t(),score:d(),scannedAt:t()}).optional(),projectType:Kn.optional(),storageScope:r([`user`,`machine-shared`]).optional(),createdAt:t(),updatedAt:t()}),Jn=u({name:t(),version:t()}),Yn=qn.extend({packages:l(Jn),about:t().optional(),missionObjectives:t().optional()});u({name:t(),path:t(),isDirectory:n(),mtimeMs:d().optional()});var Xn=r([`AGENTS.md`,`CLAUDE.md`,`.github/copilot-instructions.md`]),Zn=r([`primary`,`concat`]);u({schemaVersion:i(1).default(1),sourceFile:Xn.optional(),mergeMode:Zn.optional(),aboutHash:t().optional(),derivedAt:t().optional()});var Qn=u({hash:t(),sourceFile:Xn,mergeMode:Zn.optional(),gezelId:t(),userEdited:n().optional()}),$n=u({hash:t(),sourceFile:t()}),er=u({hash:t(),craftbookId:t(),scriptNames:l(t()).default([]),userEdited:n().optional()});u({version:i(1).default(1),gezel:Qn.optional(),about:$n.optional(),craftbooks:o(t(),er).default({})});var tr=u({name:t(),body:t(),confidence:d().min(0).max(1),sourceBlock:t(),origin:r([`static`,`llm`]).optional()}),nr=u({role:t(),about:t()}),rr=u({skillSource:t(),sourceHash:t(),craftbook:He,scripts:l(tr).default([]),persona:nr.optional(),notes:l(t()).optional(),createdAt:t()});u({version:i(1).default(1),items:l(rr).default([])});var ir=r([`draft`,`paused`,`active`,`complete`,`canceled`]),I=r([`skip`,`queue`,`concurrent`]),ar=u({expression:t(),lastTickAt:t().optional(),nextTickAt:t().optional(),overlap:I.optional()}),or=u({title:t().optional(),plan:t().optional(),description:t().optional(),context:o(t(),t()).optional()}),sr=u({count:d().int().positive(),variations:l(or).optional(),materializedAt:t().optional()}),cr=u({count:d().int().positive(),variations:l(or).optional()}),lr=u({enabled:n(),onceADay:n().optional(),lastRunDay:t().optional()}),ur=v.extend({createdAt:t(),completedAt:t().optional(),attemptCount:d().int().nonnegative().optional(),lastActivatedAt:t().optional(),gateAttempts:d().int().nonnegative().optional(),lastGateReject:u({contentHash:t().optional(),messageFingerprint:t(),message:t(),at:t()}).optional(),redriveCount:d().int().nonnegative().optional(),lastRedriveAt:t().optional(),gateAttemptHistory:l(u({at:t(),attempt:d().int().nonnegative(),contentHash:t().optional(),signatureHash:t(),messageFingerprint:t(),failedChecks:l(t()).optional(),frozen:n().optional()})).optional()}),dr=u({id:t().min(1),name:t().min(1),description:t().optional(),version:t().optional(),basedOn:T.optional(),plan:t().optional(),defaultAssignee:m.optional(),steps:l(ur).min(1),entryStepId:t().min(1),triggers:l(t()).optional(),hooks:l(_).optional(),paramSchema:o(t(),f()).optional(),toolsets:l(S).optional(),connectors:l(C).optional(),scripts:w.optional(),spawn:y.optional(),createdAt:t(),updatedAt:t(),renderedForTier:Ie.optional()}),fr=u({role:r([`main`,`spawn`]),catalogId:t(),version:t().optional(),sourceId:t().optional()}),pr=u({id:t(),text:t().min(1),met:n().optional(),evidence:t().optional(),verifiedAt:t().optional()}),mr=u({projectId:t(),num:d().int().positive(),ref:t(),title:t(),description:t().optional(),plan:t().optional(),outcomes:l(pr).optional(),status:ir,assignee:m,assigneeAuto:n().optional(),craftbook:dr,spawnsCraftbook:dr.optional(),sourceCraftbookIds:l(fr).optional(),craftbookParams:o(t(),t()).optional(),spawnsCraftbookParams:o(t(),t()).optional(),activeStepId:t().optional(),parentTaskRef:t().optional(),origin:a(`kind`,[u({kind:i(`project-type-schedule`),typeId:t(),scheduleKey:t()}),u({kind:i(`system-job`),jobId:t(),managedByGezelId:t().optional()}),u({kind:i(`boekwachter-issue`),issueRef:t().regex(/^BW-[1-9]\d*$/),path:t().min(1)}),u({kind:i(`gezel-suggested-craftbook`),templateId:t(),suggestionKey:t()})]).optional(),cron:ar.optional(),nightShift:lr.optional(),fanout:sr.optional(),lastGateHandoff:u({fromStepId:t(),toStepId:t().optional(),message:t(),params:o(t(),f()).optional(),at:t()}).optional(),createdAt:t(),updatedAt:t(),createdBy:m});u({title:t().min(1),description:t().min(40),plan:t().optional(),outcomes:l(pr).optional(),assignee:m.optional(),status:r([`draft`,`active`]).optional(),craftbookId:t().optional(),craftbookSourceId:t().optional(),craftbookVersion:t().optional(),steps:l(E).optional(),entryStepId:t().optional(),craftbookParams:o(t(),t()).optional(),spawnsCraftbookParams:o(t(),t()).optional(),spawnsCraftbookId:t().optional(),spawnsCraftbookSourceId:t().optional(),spawnsCraftbookVersion:t().optional(),spawnsSteps:l(E).optional(),spawnsEntryStepId:t().optional(),parentTaskRef:t().optional(),cron:u({expression:t(),overlap:I.optional()}).optional(),nightShift:u({enabled:n(),onceADay:n().optional()}).optional(),fanout:cr.optional(),createdBy:m.optional(),dispatchEntry:n().optional()}).refine(e=>!!e.craftbookId!=!!(e.steps&&e.steps.length>0),{message:`exactly one of craftbookId or steps must be provided for the main craftbook`,path:[`craftbookId`]}).refine(e=>{let t=!!e.spawnsCraftbookId,n=!!(e.spawnsSteps&&e.spawnsSteps.length>0);return!(t&&n)},{message:`spawnsCraftbookId and spawnsSteps are mutually exclusive`,path:[`spawnsCraftbookId`]}).refine(e=>e.spawnsCraftbookId||e.spawnsSteps&&e.spawnsSteps.length>0?!!e.cron||!!e.fanout:!0,{message:`spawn craftbook only valid when cron or fanout is set`,path:[`spawnsCraftbookId`]}).refine(e=>!e.spawnsCraftbookParams||!!e.spawnsCraftbookId||!!(e.spawnsSteps&&e.spawnsSteps.length>0),{message:`spawn craftbook params require spawnsCraftbookId or spawnsSteps`,path:[`spawnsCraftbookParams`]}).refine(e=>e.status!==`draft`||!e.cron&&!e.fanout,{message:`a draft task cannot have a cron schedule or fanout`,path:[`status`]}).refine(e=>e.dispatchEntry!==!0||e.status!==`draft`&&!e.cron&&!e.fanout,{message:`dispatchEntry is only valid on an immediately-active, non-spawning task (drafts kick off via activate; cron/fanout children dispatch themselves)`,path:[`dispatchEntry`]}),u({title:t().min(1).optional(),description:t().optional(),plan:t().optional(),outcomes:l(pr).nullable().optional(),assignee:m.optional(),cron:u({expression:t(),overlap:I.optional()}).nullable().optional(),nightShift:u({enabled:n(),onceADay:n().optional()}).nullable().optional(),fanout:cr.nullable().optional(),spawnsCraftbookParams:o(t(),t()).nullable().optional()}),u({count:d().int().positive().optional(),variations:l(or).optional()}),u({status:ir}),u({next:t().optional(),force:n().optional()}),u({task:mr,gate:u({decision:i(`reject`),message:t(),attempt:d().int().nonnegative(),maxAttempts:d().int().positive(),paused:n(),infrastructureError:n().optional(),scriptRuns:l(u({scriptName:t(),runId:t().optional(),error:t().optional(),logsTail:t().optional()})).optional()}).optional()}),u({name:t().min(1).optional(),description:t().optional(),prompt:t().optional(),suggestedRole:t().nullable().optional(),assignee:m.nullable().optional(),suggestedGezelId:t().nullable().optional(),onEnter:h.nullable().optional(),onExit:h.nullable().optional(),advanceWhen:Fe.nullable().optional(),gate:Oe.nullable().optional(),next:t().nullable().optional(),branches:l(Pe).nullable().optional(),terminal:n().optional()}),u({task:mr}),u({name:t().min(1).optional(),description:t().nullable().optional(),plan:t().nullable().optional(),defaultAssignee:m.nullable().optional(),entryStepId:t().optional()}),u({id:t().optional(),name:t().min(1),description:t().optional(),prompt:t().optional(),suggestedGezelId:t().optional(),assignee:m.optional()}),u({tasks:l(mr)});var hr=a(`kind`,[u({kind:i(`gezel`),gezelId:t(),name:t()}),u({kind:i(`user`)})]),gr=u({id:t(),at:t(),author:hr,stepId:t().optional(),text:t()});u({notes:l(gr)}),u({text:t().min(1),stepId:t().optional()}),u({note:gr}),u({text:t().min(1)}),u({note:gr});function _r(e){let t=e.lastIndexOf(`/`);if(t<0||t===e.length-1)return null;let n=e.slice(0,t),r=e.slice(t+1);if(!n)return null;let i=Number.parseInt(r,10);return!Number.isFinite(i)||i<=0||String(i)!==r?null:{projectId:n,num:i}}var vr=t().refine(e=>_r(e)!==null,{message:`task ref must use projectId/num form`}),yr=u({family:r([`gemma`,`qwen`,`gpt-oss`,`mistral`,`llama`,`deepseek`,`qwq`,`phi`,`nemotron`,`glm`,`muse`,`other`]),reasoningFormat:r([`think`,`channel`,`inline`,`none`]),toolCallFormat:r([`function-call`,`qwen-xml`,`hermes`,`gemma-special-token`,`json-envelope`])}),br=t().min(1),xr=p([br,u({id:br,config:f().optional()})]),Sr=r([`artifacts`,`workspace`,`type`]);u({source:Sr,path:t().max(4096)}),u({url:t().startsWith(`/preview/`),browserUrl:t().url().optional(),expiresAt:t(),scopePath:t()}),u({path:t().max(4096)}),u({ran:n(),ok:n().optional(),errors:l(t()).optional(),reason:t().optional()}),u({entries:l(u({kind:r([`error`,`unhandledrejection`,`console.error`]),message:t().max(2e3),path:t().max(4096),source:Sr,at:t()})).min(1).max(20)});var L=/^[a-z0-9][a-z0-9.\-:]{1,63}$/,R=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/,Cr=r([`open`,`commercial-restricted`,`custom-restricted`]),z={licenseClass:Cr.optional(),licenseShortName:t().optional(),licenseUrl:t().url().optional()},B={recoScore:d().int().positive().optional()},V={minGezelVersion:t().optional()},H=u({...V,schemaVersion:i(1),id:t().regex(L),name:t().min(1),description:t(),tags:l(t()).default([]),maintainer:u({name:t(),url:t().url().optional()}),logo:t().optional(),license:t().optional(),...z,...B,yankedVersions:l(t()).default([]),minSupportedVersion:t().optional()}),wr=r([`search`,`dev-tools`,`data`,`cloud`,`productivity`,`communication`,`content`,`ai`,`media`,`other`]),Tr=r([`general`,`code`,`communication`,`creative`,`writing`,`growth`,`game`,`data`,`home`,`money`,`events`,`other`]),Er=r([`darwin-arm64`,`darwin-x64`,`linux-arm64`,`linux-x64`,`win32-x64`]),Dr=u({kind:i(`npm-package`),package:t().min(1).max(214).regex(/^(?:@[a-z0-9][a-z0-9._~-]*\/)?[a-z0-9][a-z0-9._~-]*$/),version:t().min(1).max(128).regex(/^v?\d+\.\d+\.\d+(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/),sha256:t().regex(/^[a-f0-9]{64}$/),entry:t().min(1).max(512).refine(e=>!e.includes(`\\`)&&!e.includes(`\0`)&&!e.startsWith(`/`)&&e.split(`/`).every(e=>e!==``&&e!==`.`&&e!==`..`),`entry must be a contained POSIX-style relative path`),args:l(t().max(4096).refine(e=>!e.includes(`\0`))).max(64).default([]),envHints:l(t().regex(/^[A-Z_][A-Z0-9_]{0,63}$/)).max(64).default([])}),Or=a(`kind`,[Dr,u({kind:i(`http-mcp`),url:t().url(),transport:r([`streamable-http`,`sse`]).default(`streamable-http`),authHint:r([`none`,`bearer`,`oauth`]).default(`none`),envHints:l(t()).default([])}),u({kind:i(`stdio-mcp-binary`),binaries:o(Er,u({url:t().url(),sha256:t().regex(/^[a-f0-9]{64}$/)})),args:l(t()).default([]),envHints:l(t()).default([])}),u({kind:i(`builtin`),toolsetGroupId:t()}),u({kind:i(`custom-mcp`),serverName:t().min(1).max(256),transport:r([`stdio`,`streamable-http`,`sse`]),source:a(`kind`,[u({kind:i(`project-file`),relativePath:r([`.gezel/mcp.json`,`.vscode/mcp.json`,`.mcp.json`])}),u({kind:i(`imported`),sourceName:t().min(1).max(512).optional()})]),command:t().min(1).max(4096).optional(),args:l(t().max(16384)).max(256).default([]),cwd:t().max(4096).optional(),envFile:t().max(4096).optional(),url:t().max(16384).optional(),envKeys:l(t().min(1).max(256)).max(256).default([]),headerKeys:l(t().min(1).max(256)).max(256).default([])}).superRefine((e,t)=>{e.source.kind!==`project-file`&&(e.transport===`stdio`&&!e.command&&t.addIssue({code:`custom`,path:[`command`],message:`imported stdio MCP servers require a command`}),e.transport!==`stdio`&&!e.url&&t.addIssue({code:`custom`,path:[`url`],message:`imported HTTP MCP servers require a URL`}))})]),kr=u({id:t(),label:t(),description:t().optional(),type:r([`string`,`enum`,`url`,`number`,`boolean`]),secret:n().default(!1),required:n().default(!1),default:t().optional(),options:l(t()).optional(),multiline:n().default(!1),pattern:t().optional(),placeholder:t().optional(),envVar:t().optional()}),Ar=H.extend({kind:i(`toolset`),category:wr.optional()});u({...V,schemaVersion:i(1),version:t().regex(R),releasedAt:t(),runtime:Or,tools:l(u({name:t(),description:t().default(``)})).default([]),config:l(kr).default([]),requirements:u({node:t().optional(),platforms:l(Er).optional()}).optional(),notes:t().optional()});var jr=u({...V,schemaVersion:i(1),kind:i(`toolset`),id:t().regex(L),name:t().min(1),description:t(),tags:l(t()).default([]),maintainer:u({name:t(),url:t().url().optional()}),logo:t().optional(),license:t().optional(),version:t(),releasedAt:t(),runtime:Or,tools:l(u({name:t(),description:t().default(``)})).default([]),config:l(kr).default([]),requirements:u({node:t().optional(),platforms:l(Er).optional()}).optional(),notes:t().optional(),availableVersions:l(t()).default([]),category:wr.optional()}),Mr=H.extend({kind:i(`gezel-template`),role:t(),meesterCandidate:n().default(!1)}),Nr=u({craftbookId:t(),runMode:r([`night-shift`,`scheduled`]),cron:t().optional(),overlap:r([`skip`,`queue`,`concurrent`]).optional(),params:o(t(),t()).optional(),reason:t().optional()}).refine(e=>e.runMode!==`scheduled`||!!e.cron,{message:`scheduled suggestions require cron`});u({...V,schemaVersion:i(1),version:t().regex(R),releasedAt:t(),about:t(),suggestedProvider:M.optional(),suggestedModel:t().optional(),suggestedTools:l(t()).default([]),notes:t().optional(),frontmatter:o(t(),f()).optional(),nameSuggestions:l(t()).optional(),suggestedCraftbooks:l(Nr).optional()});var Pr=u({...V,schemaVersion:i(1),kind:i(`gezel-template`),id:t().regex(L),name:t().min(1),description:t(),tags:l(t()).default([]),maintainer:u({name:t(),url:t().url().optional()}),logo:t().optional(),license:t().optional(),version:t(),releasedAt:t(),role:t(),about:t(),suggestedProvider:M.optional(),suggestedModel:t().optional(),suggestedTools:l(t()).default([]),meesterCandidate:n().default(!1),notes:t().optional(),availableVersions:l(t()).default([]),frontmatter:o(t(),f()).optional(),nameSuggestions:l(t()).optional(),suggestedCraftbooks:l(Nr).optional()}),Fr=r([`project-starter`,`maintenance-review`,`general`]),Ir=H.extend({kind:i(`craftbook-template`),role:Fr.default(`general`),workflow:t().optional()});u({...V,schemaVersion:i(1),version:t().regex(R),releasedAt:t(),about:t(),steps:l(v).min(1),entryStepId:t().min(1),defaultAssignee:m.optional(),basedOn:T.optional(),plan:t().optional(),notes:t().optional(),spawn:y.optional(),triggers:l(t()).optional(),hooks:l(_).optional(),bundledScripts:l(t()).optional(),paramSchema:o(t(),f()).optional(),command:t().regex(/^[a-z][a-z0-9-]*$/).optional(),requirements:l(b).optional(),runModes:x.optional(),toolsets:l(S).optional(),connectors:l(C).optional()});var Lr=u({...V,schemaVersion:i(1),kind:i(`craftbook-template`),id:t().regex(L),name:t().min(1),description:t(),tags:l(t()).default([]),maintainer:u({name:t(),url:t().url().optional()}),logo:t().optional(),license:t().optional(),version:t(),releasedAt:t(),role:Fr.default(`general`),workflow:t().optional(),about:t(),steps:l(v).min(1),entryStepId:t().min(1),defaultAssignee:m.optional(),basedOn:T.optional(),plan:t().optional(),notes:t().optional(),spawn:y.optional(),availableVersions:l(t()).default([]),triggers:l(t()).optional(),hooks:l(_).optional(),scripts:w.optional(),bundledScripts:l(t()).optional(),paramSchema:o(t(),f()).optional(),command:t().regex(/^[a-z][a-z0-9-]*$/).optional(),requirements:l(b).optional(),runModes:x.optional(),toolsets:l(S).optional(),connectors:l(C).optional()}),Rr=u({templateId:t(),voorman:n().default(!1)}),zr=u({id:t(),sourceId:t().optional(),need:r([`required`,`suggested`]).default(`suggested`),autoAllow:l(t()).default([]),reason:t().optional()}),Br=u({gezel:t(),prompt:t().min(1),hideSeed:n().optional()}),Vr=u({name:t().regex(/^[a-z][a-z0-9_]*$/),description:t(),script:t(),inputs:o(t(),f()).optional(),bind:o(t(),f()).optional(),reaction:Br.optional()}),Hr=u({runMode:r([`scheduled`,`night-shift`]).default(`scheduled`),cron:t().optional(),craftbook:t(),consent:r([`ask`,`auto`,`disabled`]).default(`ask`),overlap:r([`skip`,`queue`,`concurrent`]).optional()}).refine(e=>e.runMode!==`scheduled`||!!e.cron,{message:`scheduled project-type schedules require cron`}),Ur=u({source:Sr,path:t().min(1),subtree:n().optional()}),Wr=u({entry:t(),api:i(1).optional(),reads:l(Ur).optional(),tools:l(t().regex(/^[a-z][a-z0-9_]*$/)).optional()}),Gr={extends:t().optional(),meesterManaged:n().optional(),tabVisibility:Wn.optional(),mode:r([`crew`,`solo`]).optional(),leadLabel:t().min(1).optional(),leanProfile:n().optional(),indexingEnabled:n().optional(),params:o(t(),f()).optional(),nameTemplate:t().min(1).optional(),aboutTemplate:t().optional(),missionTemplate:t().optional(),gezels:l(Rr).default([]),toolsets:l(zr).default([]),craftbooks:l(t()).default([]),scripts:w.optional(),tools:l(Vr).default([]),pages:Wr.optional(),schedules:l(Hr).default([]),workspaceSeed:l(t()).default([]),artifactsSeed:l(t()).default([]),notes:t().optional()},Kr=H.extend({kind:i(`project-type`),category:Tr.optional()});u({...V,schemaVersion:i(1),version:t().regex(R),releasedAt:t(),...Gr});var qr=u({...V,schemaVersion:i(1),kind:i(`project-type`),id:t().regex(L),name:t().min(1),description:t(),tags:l(t()).default([]),category:Tr.optional(),maintainer:u({name:t(),url:t().url().optional()}),logo:t().optional(),license:t().optional(),version:t(),releasedAt:t(),...Gr,availableVersions:l(t()).default([])}),Jr=r([`mcp`,`script`,`spectral`,`native`]),Yr=p([u({kind:i(`mapping`),map:o(t(),f())}),u({kind:i(`script`),script:t()}),u({kind:i(`native`)})]),Xr=u({name:t(),consentScope:t()}),Zr={driver:Jr,configSchema:o(t(),f()).optional(),secretShape:o(t(),f()).optional(),source:o(t(),f()),normalize:Yr.default({kind:`native`}),actions:l(Xr).default([]),completeness:r([`mirror`,`window`]).optional(),allowedOrigins:l(t()).optional(),notes:t().optional()},Qr=H.extend({kind:i(`connector-type`)});u({...V,schemaVersion:i(1),version:t().regex(R),releasedAt:t(),...Zr});var $r=u({...V,schemaVersion:i(1),kind:i(`connector-type`),id:t().regex(L),name:t().min(1),description:t(),tags:l(t()).default([]),maintainer:u({name:t(),url:t().url().optional()}),logo:t().optional(),license:t().optional(),version:t(),releasedAt:t(),...Zr,availableVersions:l(t()).default([])}),ei=r([`general`,`coding`,`reasoning`,`vision`,`embedding`]),ti=u({tag:t()}),ni=u({name:t(),sha256:t().regex(/^[a-f0-9]{64}$/),sizeBytes:d().int().positive()}),ri=u({huggingfaceRepo:t().regex(/^[A-Za-z0-9_\-.]+\/[A-Za-z0-9_\-.]+$/),revision:t().optional(),filename:t().optional(),sha256:t().regex(/^[a-f0-9]{64}$/).optional(),shards:l(ni).min(2).optional(),approxSizeBytes:d().int().positive(),residentBytes:d().int().positive().optional(),quantization:t().optional(),mmproj:u({filename:t(),sha256:t().regex(/^[a-f0-9]{64}$/),sizeBytes:d().int().positive()}).optional(),draftModel:u({filename:t(),sha256:t().regex(/^[a-f0-9]{64}$/),sizeBytes:d().int().positive()}).optional()}).refine(e=>(!!e.filename&&!!e.sha256)!==(Array.isArray(e.shards)&&e.shards.length>=2),{message:`llamaCpp source must set exactly one of (filename + sha256) or shards[] (>=2)`}),ii=u({huggingfaceRepo:t().regex(/^[A-Za-z0-9_\-.]+\/[A-Za-z0-9_\-.]+$/),revision:t().optional(),filename:t().optional(),sha256:t().regex(/^[a-f0-9]{64}$/).optional(),shards:l(ni).min(2).optional(),approxSizeBytes:d().int().positive(),residentBytes:d().int().positive().optional(),kvBytesPerToken:d().int().positive().optional(),residentCtxTokens:d().int().positive().optional(),quantization:t().optional(),cacheExpertsBytes:d().int().positive().optional(),ssdStreaming:n().optional(),maxLaunchCtx:d().int().positive().optional()}).refine(e=>(!!e.filename&&!!e.sha256)!==(Array.isArray(e.shards)&&e.shards.length>=2),{message:`ds4 source must set exactly one of (filename + sha256) or shards[] (>=2)`}),ai=u({huggingfaceRepo:t().regex(/^[A-Za-z0-9_\-.]+\/[A-Za-z0-9_\-.]+$/),revision:t().optional(),files:l(u({name:t(),sha256:t().regex(/^[a-f0-9]{64}$/),sizeBytes:d().int().positive()})).min(1),approxSizeBytes:d().int().positive(),residentBytes:d().int().positive().optional(),quantization:t().optional(),chatTemplate:t().optional(),disabledReason:t().optional()}),oi=H.extend({kind:i(`chat-model`),parameterSize:t(),supportsTools:n(),contextWindow:d().int().positive().optional(),kvBytesPerTokenF16:d().positive().optional(),kvFixedBytesF16:d().nonnegative().optional(),upstream:t().url().optional(),category:ei.optional(),style:yr.optional(),behaviors:l(xr).optional(),tuning:k.optional()});u({...V,schemaVersion:i(1),version:t().regex(R),releasedAt:t(),approxSizeBytes:d().int().positive(),ollama:ti.optional(),llamaCpp:ri.optional(),mlx:ai.optional(),ds4:ii.optional(),notes:t().optional()});var si=u({sniffThresholds:u({inlineJsMinBytes:d().int().min(1e3).optional(),htmlMinBytes:d().int().min(1e3).optional()}).optional()}),ci=u({...V,schemaVersion:i(1),kind:i(`chat-model`),id:t().regex(L),name:t().min(1),description:t(),tags:l(t()).default([]),maintainer:u({name:t(),url:t().url().optional()}),logo:t().optional(),license:t().optional(),...z,...B,version:t(),releasedAt:t(),parameterSize:t(),approxSizeBytes:d().int().positive(),supportsTools:n(),contextWindow:d().int().positive().optional(),kvBytesPerTokenF16:d().positive().optional(),kvFixedBytesF16:d().nonnegative().optional(),upstream:t().url().optional(),category:ei.optional(),style:yr.optional(),behaviors:l(xr).optional(),tuning:k.optional(),evalHints:si.optional(),ollama:ti.optional(),llamaCpp:ri.optional(),mlx:ai.optional(),ds4:ii.optional(),notes:t().optional(),availableVersions:l(t()).default([])}),li=r([`general`,`artistic`,`photographic`]),ui=r([`low`,`mid`,`high`,`workstation`]),di=u({role:r([`vae`,`clip_l`,`clip_g`,`t5xxl`,`llm`]),downloadUrl:t().url(),sha256:t().regex(/^[a-f0-9]{64}$/),approxSizeBytes:d().int().positive()}),fi=H.extend({kind:i(`image-model`),recommendedSteps:d().int().positive().default(20),widthRange:u({min:d().int().positive(),max:d().int().positive()}).optional(),heightRange:u({min:d().int().positive(),max:d().int().positive()}).optional(),upstream:t().url().optional(),category:li.optional(),weightsKind:r([`checkpoint`,`diffusion-model`]).default(`checkpoint`),supportsImg2Img:n().optional(),hardwareTier:ui,minRamGB:d().positive(),commercialUse:n()});u({...V,schemaVersion:i(1),version:t().regex(R),releasedAt:t(),downloadUrl:t().url(),sha256:t().regex(/^[a-f0-9]{64}$/),approxSizeBytes:d().int().positive(),quantization:t().optional(),auxiliaryFiles:l(di).default([]),notes:t().optional()});var pi=u({...V,schemaVersion:i(1),kind:i(`image-model`),id:t().regex(L),name:t().min(1),description:t(),tags:l(t()).default([]),maintainer:u({name:t(),url:t().url().optional()}),logo:t().optional(),license:t().optional(),...z,...B,version:t(),releasedAt:t(),downloadUrl:t().url(),sha256:t().regex(/^[a-f0-9]{64}$/),approxSizeBytes:d().int().positive(),quantization:t().optional(),recommendedSteps:d().int().positive().default(20),widthRange:u({min:d().int().positive(),max:d().int().positive()}).optional(),heightRange:u({min:d().int().positive(),max:d().int().positive()}).optional(),upstream:t().url().optional(),category:li.optional(),weightsKind:r([`checkpoint`,`diffusion-model`]).default(`checkpoint`),supportsImg2Img:n().optional(),auxiliaryFiles:l(di).default([]),hardwareTier:ui,minRamGB:d().positive(),commercialUse:n(),notes:t().optional(),availableVersions:l(t()).default([])}),mi=r([`ltx`,`ltx2`,`wan`]),hi=u({strategy:r([`diffusers-tree`,`single-file`]).default(`diffusers-tree`),pipelineClass:t().optional(),singleFileName:t().optional(),transformerClass:t().optional(),vaeDtype:r([`float32`,`bfloat16`]).optional(),audio:n().default(!1)}),gi=u({huggingfaceRepo:t().regex(/^[A-Za-z0-9_\-.]+\/[A-Za-z0-9_\-.]+$/),revision:t().optional(),files:l(u({name:t(),sha256:t().regex(/^[a-f0-9]{64}$/),sizeBytes:d().int().positive(),repo:t().regex(/^[A-Za-z0-9_\-.]+\/[A-Za-z0-9_\-.]+$/).optional(),revision:t().optional()})).min(1),approxSizeBytes:d().int().positive(),quantization:t().optional()}),U=u({min:d().int().positive(),max:d().int().positive()}),_i=H.extend({kind:i(`video-model`),family:mi,load:hi.optional(),recommendedSteps:d().int().positive().default(40),guidanceScale:d().positive().optional(),defaultNumFrames:d().int().positive().default(97),numFramesRange:U.optional(),defaultFps:d().int().positive().default(24),fpsRange:U.optional(),maxDurationSeconds:d().positive().optional(),widthRange:U.optional(),heightRange:U.optional(),defaultWidth:d().int().positive().optional(),defaultHeight:d().int().positive().optional(),supportsImageToVideo:n().default(!1),upstream:t().url().optional(),hardwareTier:ui,minVramGB:d().positive(),commercialUse:n()});u({...V,schemaVersion:i(1),version:t().regex(R),releasedAt:t(),source:gi,notes:t().optional()});var vi=u({...V,schemaVersion:i(1),kind:i(`video-model`),id:t().regex(L),name:t().min(1),description:t(),tags:l(t()).default([]),maintainer:u({name:t(),url:t().url().optional()}),logo:t().optional(),license:t().optional(),...z,...B,version:t(),releasedAt:t(),family:mi,load:hi.optional(),source:gi,approxSizeBytes:d().int().positive(),recommendedSteps:d().int().positive().default(40),guidanceScale:d().positive().optional(),defaultNumFrames:d().int().positive().default(97),numFramesRange:U.optional(),defaultFps:d().int().positive().default(24),fpsRange:U.optional(),maxDurationSeconds:d().positive().optional(),widthRange:U.optional(),heightRange:U.optional(),defaultWidth:d().int().positive().optional(),defaultHeight:d().int().positive().optional(),supportsImageToVideo:n().default(!1),upstream:t().url().optional(),hardwareTier:ui,minVramGB:d().positive(),commercialUse:n(),notes:t().optional(),availableVersions:l(t()).default([])});a(`kind`,[Ar,Mr,Ir,Kr,Qr,oi,fi,_i]);var yi=a(`kind`,[jr,Pr,Lr,qr,$r,ci,pi,vi]),bi=r([`toolset`,`gezel-template`,`craftbook-template`,`project-type`,`connector-type`,`chat-model`,`image-model`,`video-model`]),xi=u({sourceId:t(),kind:bi,manifest:yi,logoUrl:t().optional(),iconSvg:t().optional()});u({items:l(xi)}),xi.extend({readme:t().optional(),about:t().optional()}),u({versions:l(u({version:t(),releasedAt:t(),yanked:n()}))});var Si={toolsetId:t(),sourceId:t(),version:t(),installedAt:t(),installPath:t().optional()},Ci=u({...Si,runtime:Or}),wi=Dr.extend({sha256:t().regex(/^(?:sha256-[A-Za-z0-9+/]{43}=|sha384-[A-Za-z0-9+/]{64}|sha512-[A-Za-z0-9+/]{86}==)$/)});p([Ci,u({...Si,sourceId:i(`system`),runtime:wi})]),u({toolsetId:t(),values:o(t(),t()).default({}),updatedAt:t()});var Ti=u({kind:bi,id:t(),version:t(),path:t(),sha256:t().regex(/^[a-f0-9]{64}$/)});u({schemaVersion:i(1),name:t().min(1),description:t().default(``),creator:t().optional(),createdAt:t().optional(),minSupportedVersion:t().optional(),items:l(Ti).min(1),provenance:u({source:t().optional(),exportedFromProject:t().optional()}).optional()});var Ei=r([`llama-cpp`,`mlx`,`ds4`]),Di=u({path:t().min(1).max(1024).refine(e=>!e.includes(`\\`)&&!e.includes(`\0`)&&!e.startsWith(`/`)&&e.split(`/`).every(e=>e!==``&&e!==`.`&&e!==`..`),`bundle path must be a contained POSIX-style relative path`),sizeBytes:d().int().nonnegative().max(2**53-1),sha256:t().regex(/^[a-f0-9]{64}$/),role:r([`model`,`installed-manifest`,`catalog-manifest`,`catalog-file`])}),Oi=u({name:t().min(1),shortName:t().min(1).optional(),class:Cr.optional(),url:t().url().optional()}),ki=u({schemaVersion:i(1),kind:i(`gezel-model`),id:t().regex(L),name:t().min(1).max(256),engine:Ei,createdAt:t().datetime(),createdBy:i(`gezel`),catalogVersion:t().optional(),approxSizeBytes:d().int().nonnegative().max(2**53-1),license:Oi.optional(),files:l(Di).min(2).max(16384)});u({importId:t().uuid(),manifest:ki,alreadyInstalled:n(),warnings:l(t())});var Ai=r([`current`,`default`,`development`]),ji=u({source:Ai,sourceLabel:t().min(1).max(128),engine:Ei,id:t().regex(L),name:t().min(1).max(256),approxSizeBytes:d().int().nonnegative().max(2**53-1),catalogVersion:t().min(1),moving:n().default(!1)});u({available:n(),candidates:l(ji)}),u({source:Ai,engine:Ei,id:t().regex(L)}),u({ok:i(!0),engine:Ei,id:t().regex(L),localRemoved:n(),warning:t().min(1).optional()});var Mi=u({label:t().min(1),path:t().min(1)}),Ni=u({id:t(),kind:r([`command`,`output`]),content:t(),at:t(),resolvedFrom:t().optional(),stdout:t().optional(),stderr:t().optional(),exitCode:d().int().optional(),durationMs:d().int().nonnegative().optional(),truncated:n().optional(),errorMessage:t().optional(),fileReferences:l(Mi).optional(),cwd:t().optional()});u({threads:l(u({version:i(1),id:t(),projectId:t(),workingDir:t(),createdAt:t(),lastActivityAt:t(),archived:n().optional(),messages:l(Ni)}).pick({id:!0,projectId:!0,workingDir:!0,createdAt:!0,lastActivityAt:!0,archived:!0}).extend({lastCommand:t().optional()}))}),u({workingDir:t(),input:t().min(1),columns:d().int().min(20).max(500).optional()}),u({threadId:t(),runId:t()});var Pi=a(`kind`,[u({kind:i(`message`),projectId:t(),threadId:t(),workingDir:t(),message:re(()=>Ni),runId:t().optional()}),u({kind:i(`workingDirChanged`),projectId:t(),threadId:t(),newWorkingDir:t()}),u({kind:i(`runStarted`),projectId:t(),threadId:t(),runId:t(),commandMessageId:t(),at:t(),cwd:t()}),u({kind:i(`outputChunk`),projectId:t(),threadId:t(),runId:t(),chunk:t()}),u({kind:i(`inputRequested`),projectId:t(),threadId:t(),runId:t(),promptLine:t(),mode:r([`text`,`password`,`yes-no`])}),u({kind:i(`openFile`),projectId:t(),threadId:t(),path:t(),source:i(`workspace`)})]),Fi=u({threadId:t(),projectId:t(),workingDir:t(),threadCreatedAt:t(),threadLastActivityAt:t(),threadArchived:n().optional(),messageId:t(),msgKind:r([`command`,`output`]),content:t(),at:t(),resolvedFrom:t().optional(),stdout:t().optional(),stderr:t().optional(),exitCode:d().int().optional(),durationMs:d().int().nonnegative().optional(),truncated:n().optional(),errorMessage:t().optional(),fileReferences:l(Mi).optional(),cwd:t().optional()}),Ii=u({kind:r([`file`,`chat`]),filePath:t().optional(),checks:l(Te).optional(),scripts:l(De).optional()}),Li=u({version:i(1),id:t(),gezelId:t(),projectId:t(),providerName:M,model:t().optional(),modelSource:r([`capability-routing`]).optional(),nightShift:n().optional(),engineKey:t().optional(),reasoningEffort:t().optional(),title:t(),createdAt:t(),lastActivityAt:t(),archived:n().optional(),messages:l(N),providerState:u({copilotSessionId:t().optional(),openaiPreviousResponseId:t().optional(),claudeCliSessionId:t().optional(),codexCliThreadId:t().optional()}),aboutSnapshot:t().optional(),resumeFailed:n().optional(),deliverableGatePlateau:u({signatureHash:t(),count:d().int().nonnegative(),stage:d().int().min(0).max(3),at:t()}).optional(),lastTurnError:t().optional(),lastTurnErrorDetail:bn.optional(),taskRef:t().optional(),stepId:t().optional(),lastImageGeneration:u({prompt:t(),negativePrompt:t().optional(),artifactPath:t(),seed:d().int().optional(),model:t().optional(),at:t()}).optional(),craftbookRef:t().optional(),consultationMode:n().optional(),expectedDeliverable:Ii.optional(),scriptTools:l(Vr).optional(),numCtx:d().int().positive().optional(),recall:u({at:t(),query:t(),hits:l(u({text:t(),scope:r([`gezel`,`project`,`workspace`]),day:t(),score:d(),kind:r([`fact`,`decision`,`pref`,`status`]).optional()}))}).optional(),summarizedAt:t().optional(),summarizedUpTo:d().int().nonnegative().optional(),extractedUpTo:d().int().nonnegative().optional(),compactionCount:d().int().nonnegative().optional(),lastCompactedAt:t().optional()}).pick({id:!0,gezelId:!0,projectId:!0,providerName:!0,model:!0,title:!0,createdAt:!0,lastActivityAt:!0,archived:!0,lastTurnError:!0,taskRef:!0,stepId:!0}).extend({lastHumanActivityAt:t().optional(),lastMessagePreview:t().max(200).optional(),involvedGezelIds:l(t()).optional()});u({gezelId:t(),projectId:t().optional(),taskRef:t().optional(),stepId:t().optional(),craftbookRef:t().optional()}),u({sessions:l(Li)}),u({message:t().min(1),mentions:l(t().min(1)).max(10).optional(),passiveCcGezelIds:l(t().min(1)).max(5).optional(),nudge:n().optional()}),u({accepted:i(!0),sessionId:t()});var Ri=u({queueId:t(),text:t(),preview:t(),enqueuedAt:t(),nudge:n()});u({sessionId:t(),entries:l(Ri)}),u({message:t().min(1)}),u({updated:i(!0),entry:Ri}),u({message:t().min(1)}),u({messages:l(u({sessionId:t(),gezelId:t(),projectId:t(),sessionTitle:t(),sessionCreatedAt:t(),sessionLastActivityAt:t(),sessionArchived:n().optional(),sessionProviderName:M,sessionModel:t().optional(),sessionLastTurnError:t().optional(),taskRef:t().optional(),stepId:t().optional(),handoffFrom:u({gezelId:t(),sessionId:t()}).optional(),role:r([`user`,`assistant`]),content:t(),at:t(),from:u({gezelId:t(),gezelName:t()}).optional(),nudge:n().optional(),referencedArtifacts:l(t()).optional(),referencedTasks:l(t()).optional(),toolCalls:l(yn).optional(),intents:l(u({label:t(),afterChars:d().int().min(0)})).optional(),pendingQuestionId:t().optional(),warnings:l(t()).optional(),reasoning:t().optional(),reasoningDurationMs:d().int().nonnegative().optional(),attemptedToolCalls:l(u({body:t(),reason:t().optional()})).optional()})),hasMore:n(),nextCursor:t().optional(),terminalEntries:l(Fi).optional()});var zi=r([`up-to-date`,`updated`,`incompatible`,`error`,`blocked`]),Bi=u({at:t(),outcome:zi,message:t().optional(),version:t().optional(),regressions:l(u({kind:t(),id:t()})).max(25).optional()});u({enabled:n(),mode:r([`bundled`,`live`,`overridden`]),bundledVersion:t(),activeVersion:t().nullable(),lastCheck:Bi.nullable(),updateInProgress:n()});var Vi=r([`nudge_budget_exhausted`,`context_loop`,`gate_exhausted`,`step_redrive_exhausted`,`turn_aborted`,`deliverable_plateau`]),Hi=a(`kind`,[u({kind:i(`corrective_prompt`),prompt:t().min(1)}),u({kind:i(`rewrite_step`),stepId:t().min(1),prompt:t().min(1),name:t().optional(),deliverable:t().optional()}),u({kind:i(`rewrite_craftbook`),document:t().min(1),rationale:t().min(1)}),u({kind:i(`takeover_step`),instruction:t().min(1)}),u({kind:i(`stand_down`),reason:t().min(1)})]),Ui=r([`silent_stall`,`tool_loop`,`capability_ceiling`,`task_shape`,`context_pressure`,`unknown`]),Wi=u({diagnosis:t().min(1),failureClass:Ui,action:Hi,confidence:r([`low`,`medium`,`high`])}),Gi=u({record:i(`case.opened`),caseId:t().min(1),ts:t().min(1),trigger:Vi,sessionId:t().optional(),gezelId:t().min(1),projectId:t().optional(),taskRef:t().optional(),stepId:t().optional(),providerName:t().min(1),model:t().optional(),modelTier:t().optional(),consultProviderName:t().min(1),consultModel:t().optional(),signals:o(t(),f()),verdict:Wi.optional(),applied:n(),consultDurationMs:d().int().nonnegative(),promptChars:d().int().nonnegative(),responseChars:d().int().nonnegative(),debug:u({prompt:t(),rawResponse:t()}).optional()}),Ki=r([`unblocked`,`re_triggered`,`gave_up`,`takeover_completed`,`takeover_failed`,`unknown`]);a(`record`,[Gi,u({record:i(`case.closed`),caseId:t().min(1),ts:t().min(1),outcome:Ki,turnsObserved:d().int().nonnegative()})]);var qi=u({label:t().max(60),target:a(`kind`,[u({kind:i(`project`),projectId:t()}),u({kind:i(`task`),projectId:t(),taskRef:t()}),u({kind:i(`view`),view:r([`projects`,`gezels`,`documents`,`settings`])})])}),Ji=u({projectId:t(),taskRef:t(),title:t()}),Yi=u({headline:t().max(120),cta:qi.optional(),report:t(),generatedAt:t(),trigger:r([`auto`,`manual`]),actions:l(Ji).default([])});u({headline:t(),cta:qi.optional(),report:t(),actions:l(u({projectId:t(),title:t(),description:t()})).optional()}),u({lastRunAt:t().optional(),inputHash:t().optional(),runDay:t().optional(),runsOnDay:d().int().nonnegative().optional(),recentActionKeys:l(t()).optional()}),u({lastActivityAt:t()}),u({report:Yi.nullable(),budget:u({runsToday:d().int().nonnegative(),maxRunsPerDay:d().int().positive(),lastRunAt:t().nullable()}),running:n()});var Xi=r([`info`,`minor`,`major`]),Zi=u({severity:Xi,category:t().min(1).max(40),message:t().min(1).max(300),line:d().int().positive().optional()}),Qi=r([`open`,`in_progress`,`resolved`,`dismissed`]),$i=r([`not_an_issue`,`duplicate`,`wont_fix`]),W=Zi.extend({ref:t().regex(/^BW-[1-9]\d*$/),id:t().min(1),fingerprint:t().min(1),path:t().min(1),status:Qi,seen:n(),stale:n(),taskRef:t().optional(),dismissalReason:$i.optional(),createdAt:t(),lastSeenAt:t(),lastCheckedAt:t().optional(),seenAt:t().optional(),resolvedAt:t().optional(),dismissedAt:t().optional()});u({notes_md:t().min(1),issues:l(Zi),health:d().int().min(1).max(10),health_reason:t().min(1)});var ea=u({notesMd:t(),issues:l(Zi),health:d().int().min(1).max(10),healthReason:t(),model:t().nullable(),provider:t().nullable().optional(),gezelId:t().nullable().optional(),gezelName:t().nullable().optional(),appVersion:t().nullable().optional(),reviewedAt:t().nullable()});u({github:Bn.optional(),exists:n(),originMatches:n().optional(),branch:t().optional(),defaultBranch:t().optional(),ahead:d().int().optional(),behind:d().int().optional(),dirty:n().optional(),changesCount:d().int().optional(),conflictedCount:d().int().optional(),mergeInProgress:n().optional(),hasUpstream:n().optional(),hasPat:n(),credentialSource:r([`pat`,`env`,`gh`,`none`])}),u({ok:i(!0),checkoutDir:t(),branch:t().optional(),adopted:n()}),u({branch:t().min(1),create:n().optional()}),u({local:l(t()),remote:l(t()),current:t().optional()}),u({ok:i(!0),fetched:n()}),u({message:t().min(1),allowEmpty:n().optional()}),u({ok:i(!0),sha:t(),filesChanged:d().int()}),u({ok:i(!0),pushed:n(),rejected:r([`non-fast-forward`,`auth`,`unknown`]).optional()});var ta=u({number:d().int(),title:t(),author:t(),headRef:t(),baseRef:t(),draft:n(),updatedAt:t(),url:t()});u({pulls:l(ta)}),ta.extend({body:t(),state:t(),merged:n(),mergeable:n().nullable().optional(),additions:d().int(),deletions:d().int(),changedFiles:d().int()}),u({files:l(u({filename:t(),status:t(),additions:d().int(),deletions:d().int(),changes:d().int(),patch:t().optional(),previousFilename:t().optional()}))}),u({comments:l(u({id:d(),author:t(),body:t(),createdAt:t(),kind:r([`issue`,`review`]),path:t().optional()}))}),u({number:d().int(),diff:t()}),u({body:t().min(1)}),u({id:d(),url:t()}),u({title:t().min(1),body:t().optional(),head:t().min(1),base:t().min(1),draft:n().optional()}),u({number:d().int(),url:t()}),u({runs:l(u({id:d(),name:t(),status:t(),conclusion:t().nullable(),createdAt:t(),url:t()}))}),u({state:r([`success`,`failure`,`pending`,`unknown`]),checks:l(u({name:t(),status:t(),conclusion:t().nullable(),url:t().optional()}))});var na=r([`modified`,`added`,`deleted`,`renamed`,`conflicted`]),ra=u({path:t(),oldPath:t().optional(),kind:na,additions:d().int().optional(),deletions:d().int().optional(),binary:n().optional()});u({changes:l(ra),total:d().int(),truncated:n()}),u({path:t(),kind:na,oldPath:t().optional(),binary:n(),truncated:n(),diff:t().optional(),additions:d().int().optional(),deletions:d().int().optional()}),u({paths:l(t().min(1)).min(1).optional(),all:n().optional()}).refine(e=>!!e.all!=!!e.paths?.length,{message:"Pass exactly one of `paths` or `all`."}),u({ok:i(!0),discarded:d().int()});var ia=u({sha:t(),shortSha:t(),author:t(),email:t().optional(),date:t(),subject:t(),filesChanged:d().int(),additions:d().int(),deletions:d().int()});u({commits:l(ia),hasMore:n()}),u({sha:t(),shortSha:t(),author:t(),date:t(),subject:t(),files:l(u({path:t(),additions:d().int().optional(),deletions:d().int().optional(),binary:n().optional()})),diff:t().optional(),truncated:n()}),u({state:r([`synced`,`needs-save`,`conflicts`,`auth`,`offline`,`error`]),pulled:d().int(),pushed:d().int(),merged:n().optional(),branch:t().optional(),conflictedFiles:l(t()).optional(),message:t().optional()});var aa=r([`both-modified`,`both-added`,`deleted-by-us`,`deleted-by-them`]),oa=u({path:t(),kind:aa});u({inMerge:n(),conflicts:l(oa)}),u({path:t(),base:t().optional(),ours:t().optional(),theirs:t().optional(),binary:n(),tooLarge:n()}),u({path:t().min(1),choice:r([`mine`,`theirs`,`custom`]),content:t().optional()}).refine(e=>e.choice!==`custom`||e.content!==void 0,{message:"`content` is required when choice is `custom`."}),u({ok:i(!0),remaining:d().int()}),u({message:t().optional()}),u({ok:i(!0),sha:t()}),u({ok:i(!0)}),u({message:t()}),u({path:t().min(1)}),u({path:t(),merged:t()});var sa=r([`commit`,`pr`]),ca=r([`running`,`complete`,`canceled`,`error`]),la=u({id:t().min(1),kind:sa,status:ca,createdAt:t(),settledAt:t().optional(),outcome:r([`complete`,`canceled`]).optional(),error:t().optional(),taskRef:t().min(1),gezelId:t().optional(),branch:t(),headSha:t(),baseRef:t().optional(),baseSha:t().optional(),filesChanged:d().int(),additions:d().int().optional(),deletions:d().int().optional(),commitCount:d().int().optional(),filesTruncated:n(),diffTruncated:n(),manifestPath:t(),diffPath:t(),reportPath:t()}).extend({taskStatus:r([`draft`,`paused`,`active`,`complete`,`canceled`]).optional(),needsAttention:n().optional(),activeStepName:t().optional(),stepsTotal:d().int().optional(),stepsComplete:d().int().optional(),assigneeName:t().optional()});u({kind:sa}),u({ok:i(!0),review:la}),u({reviews:l(la)}),u({ok:i(!0),review:la}),u({version:i(1),reviewId:t().min(1),kind:sa,projectId:t().min(1),createdAt:t(),branch:t(),headSha:t(),baseRef:t(),baseSha:t(),files:l(ra),totalFiles:d().int(),filesTruncated:n(),diffFile:t(),diffChars:d().int(),diffTruncated:n(),commits:l(ia).optional(),commitsTruncated:n().optional(),notes:l(t())});var G=r([`webhook`]),ua=u({url:t().url(),method:r([`POST`,`PUT`]).optional(),headers:o(t(),t()).optional(),bodyTemplate:t().optional(),bodyContentType:t().optional()}),da=u({default:G.optional(),webhook:ua.optional()});u({name:G,configured:n(),ready:n(),lastError:t().optional(),detail:o(t(),f()).optional()}),u({channel:G.optional(),message:t().min(1),metadata:o(t(),f()).optional()}),p([u({ok:i(!0),id:t().optional(),channel:G}),u({ok:i(!1),error:t(),channel:G.optional()})]);var fa=r([`llama-server`,`ds4-server`,`sd-server`,`whisper-server`,`uv`]),pa=a(`type`,[u({type:i(`progress`),bytesWritten:d().nonnegative(),totalBytes:d().nonnegative()}),u({type:i(`retrying`),attempt:d().int().positive(),maxAttempts:d().int().positive(),delayMs:d().nonnegative(),reason:t()}),u({type:i(`verifying`),what:r([`sha256`,`signature`])}),u({type:i(`done`),binPath:t(),cached:n()}),u({type:i(`error`),error:t()})]),ma=u({name:fa,installed:n(),path:t().optional()});u({release:t(),pinned:n(),platformKey:t().nullable(),llamaBackend:r([`cuda`,`vulkan`,`metal`,`cpu`]).optional(),engines:l(ma)});var ha=u({id:t(),name:t(),kind:t(),lineStart:d().int().positive(),lineEnd:d().int().positive(),signature:t().optional(),parent:t().optional()});u({path:t().min(1)}),u({path:t(),lang:t().nullable(),summary:t().nullable().optional(),symbols:l(ha),totalLines:d().int().nonnegative(),engine:r([`index`,`live`,`unavailable`]),truncated:n(),review:ea.optional()}),u({name:t().min(1),kind:t().optional(),maxResults:d().int().positive().max(200).optional()}),u({matches:l(ha.extend({path:t()})),truncated:n(),engine:r([`index`,`unavailable`])}),u({name:t().min(1),path:t().optional()}),u({found:n(),path:t().optional(),name:t().optional(),kind:t().optional(),lineStart:d().int().positive().optional(),lineEnd:d().int().positive().optional(),signature:t().optional(),source:t().optional()}),u({name:t().min(1),glob:t().optional(),maxResults:d().int().positive().max(500).optional()}),u({references:l(u({path:t(),line:d().int().positive(),text:t()})),truncated:n(),engine:r([`ripgrep`,`javascript`])}),u({path:t().min(1)});var ga=u({ruleId:t(),category:t(),severity:r([`critical`,`high`,`medium`,`low`,`info`]),line:d().int().positive().nullable(),title:t(),source:t()}),_a=u({path:t(),viaBinding:n()}),va=u({name:t(),kind:t(),lineStart:d().int().positive(),lineEnd:d().int().positive(),signature:t().optional(),parent:t().optional(),importedBy:l(_a),importedByTruncated:n(),uses:l(u({name:t(),from:t(),inRepo:n()})),usedInFileBy:l(t()),findings:l(ga),summary:t().optional()});u({path:t(),lang:t().nullable(),totalLines:d().int().nonnegative(),summary:t().nullable(),importedBy:l(u({path:t(),names:l(t())})),importedByTruncated:n(),imports:l(u({specifier:t(),resolvedPath:t().nullable(),names:l(t()),default:n(),namespace:n()})),fileFindings:l(ga),symbols:l(va),symbolsTruncated:n(),engine:r([`index`,`live`,`unavailable`]),review:ea.optional()}),u({path:t().min(1)}),u({path:t(),found:n(),pending:n().optional(),review:ea.optional(),trackedIssues:l(W).optional(),eligible:n().optional()}),u({severity:Xi.optional(),category:t().optional(),path:t().optional(),status:Qi.optional(),includeClosed:n().optional(),maxResults:d().int().positive().max(1e3).optional()}),u({issues:l(W),counts:u({total:d().int().nonnegative(),bySeverity:o(t(),d().int().nonnegative()),byCategory:o(t(),d().int().nonnegative())}),truncated:n(),indexed:n(),reviewedFiles:d().int().nonnegative(),eligibleFiles:d().int().nonnegative(),reviewers:l(u({model:t().nullable(),provider:t().nullable(),gezelName:t().nullable(),files:d().int().nonnegative()})).optional()}),u({ref:t().regex(/^BW-[1-9]\d*$/)}),u({issue:W}),u({ref:t().regex(/^BW-[1-9]\d*$/),status:Qi.optional(),seen:n().optional(),dismissalReason:$i.optional()}).refine(e=>e.status!==void 0||e.seen!==void 0,{message:`status or seen is required`}).refine(e=>e.status===`dismissed`?e.dismissalReason!==void 0:e.dismissalReason===void 0,{message:`dismissalReason is required only when status is dismissed`}),u({issue:W}),u({ref:t().regex(/^BW-[1-9]\d*$/),gezelId:t().min(1),message:t().min(1)}),u({issue:W,taskRef:t().min(1),gezelId:t().min(1),gezelName:t().min(1),enqueued:n()}),u({path:t().optional()}),u({root:t(),languages:l(u({lang:t(),fileCount:d().int().nonnegative()})),areas:l(u({path:t(),fileCount:d().int().nonnegative(),purpose:t().optional()})),entryPoints:l(t()),keyFiles:l(t()),fileCount:d().int().nonnegative(),indexed:n(),architecture:t().optional(),health:u({reviewedFiles:d().int().nonnegative(),eligibleFiles:d().int().nonnegative(),avgHealth:d(),majorIssues:d().int().nonnegative(),minorIssues:d().int().nonnegative(),worstFiles:l(u({path:t(),health:d().int().min(1).max(10),reason:t().optional()})).max(5)}).optional()});var ya=r([`user`,`machine-engine`,`legacy-full`]);u({ok:i(!0),version:t(),serviceRole:ya.optional(),machineEngineConnected:n().optional(),startedAt:t(),nodeVersion:t().optional(),platform:t().optional(),llamaCppBackend:r([`cuda`,`vulkan`,`metal`,`cpu`]).optional(),llamaCppDetectedBackend:r([`cuda`,`vulkan`,`metal`,`cpu`]).optional(),llamaCppDetectedVendor:r([`amd`,`nvidia`,`intel`]).optional(),llamaCppQuarantinedBackends:l(r([`cuda`,`vulkan`,`metal`,`cpu`])).optional(),childProcessSpawn:r([`ok`,`denied`]).optional()});var ba=r([`vram`,`unified`,`ram`]),xa=u({provider:t(),modelId:t(),reservedBytes:d().nonnegative(),replicaCount:d().int().positive()}),Sa=r([`machine-engine`,`app-engine`,`development-engine`,`gezel-engine`,`external`]),Ca=u({pid:d().int().positive(),name:t().optional(),dedicatedBytes:d().nonnegative(),owner:Sa}),wa=u({provider:t(),modelId:t(),replicaIdx:d().int().nonnegative(),running:n(),active:n(),pid:d().int().positive().optional(),lastUsedAt:d().nonnegative().nullable(),unloadAt:d().nonnegative().nullable(),idleTimeoutMs:d().nonnegative(),releaseReason:r([`idle`,`memory-pressure`]).nullable()});u({kind:ba,totalBytes:d().nonnegative(),usedBytes:d().nonnegative().nullable(),gezelBytesEstimated:d().nonnegative(),gezelBytesObserved:d().nonnegative().nullable(),gezelInfraBytes:d().nonnegative(),gezelModelWeightsBytes:d().nonnegative(),gezelModelCacheBytes:d().nonnegative(),engineReservedBytes:d().nonnegative(),engineBudgetBytes:d().nonnegative().nullable(),enginePools:u({kind:r([`unified`,`discrete-gpu`,`system-ram`]),vramBytes:d().nonnegative(),ramShareBytes:d().nonnegative(),fastBytes:d().nonnegative()}).nullable().optional(),engineRamSpillover:u({allowed:n(),auto:n(),overridden:n(),coResidencyBytes:d().nonnegative()}).optional(),residentModels:l(xa),engineLifecycles:l(wa).optional(),gpuProcesses:l(Ca).optional(),gezelEngineProcessCount:d().int().nonnegative(),orphanedGezelEngineProcessCount:d().int().nonnegative(),otherBytes:d().nonnegative().nullable(),cachedBytes:d().nonnegative().nullable().optional(),freeBytes:d().nonnegative().nullable(),sampledAt:t(),source:r([`device-health`,`system-memory`,`capacity-only`]),deviceNames:l(t())}),u({sizeBytes:d().int().positive().max(10*1024**4)}),u({known:n(),ok:n(),freeBytes:d().nonnegative(),requiredBytes:d().positive(),storageLocation:i(`Gezel model storage`)}),u({version:t(),sampledAt:t(),runtime:u({nodeVersion:t(),platform:t(),arch:t(),osRelease:t(),platformKey:t().nullable()}),hardware:u({totalRamBytes:d().nonnegative(),gpuVramBytes:d().nonnegative().nullable(),gpuMemoryKind:r([`discrete`,`integrated`,`unified`,`none`,`unknown`]).optional(),usableBytes:d().nonnegative(),budgetBytes:d().nonnegative().optional(),source:r([`darwin-unified`,`gpu-nvidia`,`gpu-vulkan`,`gpu-integrated`,`system-ram-fallback`]),gpuVendor:r([`amd`,`nvidia`,`intel`]).optional(),description:t(),tier:r([`tiny`,`small`,`medium`,`large`]),gpuDevices:l(u({name:t(),totalMiB:d().nonnegative(),computeCapability:t().optional(),driverVersion:t().optional()}))}),engine:u({nativeRelease:t(),nativePinned:n(),installedEngines:l(fa),llamaCppBackend:r([`cuda`,`vulkan`,`metal`,`cpu`]).optional(),llamaCppDetectedBackend:r([`cuda`,`vulkan`,`metal`,`cpu`]).optional(),llamaCppBackendOverride:r([`auto`,`cuda`,`vulkan`,`metal`,`cpu`]).optional(),llamaCppRevision:t().optional(),llamaCppBuildBackend:t().optional(),cudaArchitectures:l(t()).optional(),cudaToolkit:t().optional()}),models:u({defaultProvider:M,defaultModel:t().optional(),installed:l(u({id:t(),provider:r([`llama-cpp`,`mlx`,`ds4`]),parameterSize:t().optional()}))}),localEngines:l(u({provider:r([`llama-cpp`,`mlx`,`ds4`]),model:t().optional(),pid:d().optional(),startedAt:t().optional(),contextPerSlot:d().optional(),contextTotal:d().optional(),slots:d().optional(),kvCacheType:t().optional(),backend:t().optional()})).optional()}),u({home:t(),scope:r([`machine`,`user`]),version:t(),startedAt:t(),firstRunCompleted:n(),usage:u({gezelCount:d().int().nonnegative(),projectCount:d().int().nonnegative(),sessionCount:d().int().nonnegative(),everUsed:n()}),provider:M.optional(),defaultModel:t().optional(),memory:u({totalBytes:d().nonnegative(),freeBytes:d().nonnegative()}),engines:l(u({key:t(),residentBytes:d().nonnegative()}))});var Ta=u({kind:r([`pat`,`oauth`]),login:t().optional(),name:t().optional(),avatarUrl:t().optional(),scopes:l(t()).optional(),acquiredAt:t().optional()}),Ea=u({documents:t().min(1).optional(),gezels:t().min(1).optional(),projects:t().min(1).optional()}),Da=u({level:r([`super-lockdown`,`lockdown`,`free`,`custom`]),allowFileEdits:n(),allowExternalChat:n(),allowExternalServices:n(),allowScriptExecution:n(),allowAppNetwork:n()}),Oa=u({mode:r([`off`,`observe`,`guard`]).optional(),maxStartTemperatureC:d().min(40).max(110).optional(),resumeTemperatureC:d().min(35).max(105).optional(),minThermalMarginC:d().min(0).max(40).optional(),pollIntervalMs:d().int().min(500).max(6e4).optional(),maxWaitMs:d().int().min(0).max(36e5).optional(),consecutiveHealthySamples:d().int().min(1).max(20).optional(),onTelemetryFailure:r([`allow`,`block`]).optional()}),ka=u({format:r([`docx`,`pdf`,`pptx`,`md`,`html`]),themeId:t().min(1),transformStyle:t().min(1),pageSize:r([`letter`,`a4`]),htmlStyle:r([`rendered`,`plain`]),htmlBundle:r([`single`,`zip`])}),Aa=r([`adaptive`,`model-max`]);u({policy:Aa}),u({overrides:o(t(),d().int().positive())}),u({contextTokens:d().int().min(32768).max(4194304).nullable()});var ja=u({enabled:n().default(!1),bindAddress:t().optional(),port:d().int().positive().optional(),priority:r([`equal`,`below-local`,`above-local`]).optional(),reserveLocalGb:d().nonnegative().optional(),allowModels:l(t()).optional(),limits:u({maxConcurrentPerDevice:d().int().positive().optional(),maxChatPerDevice:d().int().positive().optional(),requestsPerMinute:d().int().positive().optional()}).optional()}),Ma=u({provider:M.optional(),hosting:r([`auto`,`machine-service`,`per-user`]).optional(),service:u({url:t(),token:t()}).optional(),localEngineIdleTimeoutMs:d().int().min(6e4).optional(),deviceSafety:Oa.optional(),roleBasedNameOnlyMode:n().optional(),showPoppetjes:n().optional(),narrateAssistantReplies:n().optional(),githubToken:t().optional(),githubAuth:Ta.optional(),oauthClients:o(t(),u({clientId:t()})).optional(),openaiApiKey:t().optional(),openaiOrganization:t().optional(),anthropicApiKey:t().optional(),googleAiApiKey:t().optional(),imageProvider:r([`sd-cpp`,`google-ai`,`openai`,`mock`]).optional(),defaultImageModel:u({"google-ai":t().optional(),openai:t().optional()}).optional(),imageGenerationConfirmation:p([i(`always-allow`),i(`ask`),u({mode:i(`snooze`),until:t()})]).optional(),gpuMemoryPolicy:r([`auto`,`coexist`,`swap`]).optional(),videoProvider:r([`diffusers`,`mock`]).optional(),defaultVideoModel:t().optional(),videoGenerationConfirmation:p([i(`always-allow`),i(`ask`),u({mode:i(`snooze`),until:t()})]).optional(),recognitionProvider:r([`llama-cpp`,`mlx`,`mock`]).optional(),defaultRecognitionModel:t().optional(),recognition:u({mode:r([`auto`,`always`,`off`]).optional(),modes:l(rn).optional(),maxImagesPerTurn:d().int().min(1).max(16).optional(),timeoutMsPerImage:d().int().min(5e3).optional(),maxDigestChars:d().int().min(200).optional(),maxMegapixels:d().positive().optional()}).optional(),nativeVision:o(t(),n()).optional(),webhookBearerToken:t().optional(),webhookBasicAuth:t().optional(),braveSearchApiKey:t().optional(),tavilyApiKey:t().optional(),ollamaBaseUrl:t().optional(),autoStartOllama:n().optional(),defaultModel:u({copilot:t().optional(),openai:t().optional(),anthropic:t().optional(),"anthropic-cli":t().optional(),"codex-cli":t().optional(),ollama:t().optional(),"llama-cpp":t().optional(),mlx:t().optional(),ds4:t().optional(),remote:t().optional()}).optional(),defaultReasoningEffort:u({copilot:t().optional(),openai:t().optional(),anthropic:t().optional(),"anthropic-cli":t().optional(),"codex-cli":t().optional(),ollama:t().optional(),"llama-cpp":t().optional(),mlx:t().optional(),ds4:t().optional(),remote:t().optional()}).optional(),modelTuning:o(t(),k).optional(),modelFitness:o(t(),f()).optional(),remoteServing:ja.optional(),fileReviews:u({enabled:n().default(!0),disabledKinds:l(t()).optional()}).optional(),modelTuningProfile:o(t(),t()).optional(),meesterGezelId:t().optional(),klerkGezelId:t().optional(),boekwachterGezelId:t().optional(),keurmeesterGezelId:t().optional(),openaiEndpoints:u({enabled:n().optional(),servingGezelId:t().optional(),supportingBehaviors:n().optional(),emulateOllama:n().optional()}).optional(),ollamaNumCtx:d().int().positive().optional(),ollamaStreamingIdleSec:d().int().positive().optional(),ollamaPreFirstByteIdleSec:d().int().positive().optional(),ollamaTurnTimeoutMin:d().int().positive().optional(),ollamaNumPredict:d().int().positive().optional(),ollamaThink:n().optional(),llamaCppModelPath:t().optional(),llamaCppBaseUrl:t().optional(),llamaCppNumCtx:d().int().positive().optional(),llamaCppContextSizing:Aa.optional(),modelContextOverrides:o(t(),d().int().positive()).optional(),ds4BaseUrl:t().optional(),ds4ModelPath:t().optional(),ds4NumCtx:d().int().positive().optional(),ds4SsdStreaming:n().optional(),ds4CacheExpertsGb:d().positive().optional(),llamaCppStreamingIdleSec:d().int().positive().optional(),llamaCppPreFirstByteIdleSec:d().int().positive().optional(),llamaCppBackendOverride:r([`auto`,`cuda`,`vulkan`,`metal`,`cpu`]).optional(),autoDownloadEngines:n().optional(),engineSignaturePolicy:r([`off`,`prefer`,`require`]).optional(),llamaCppKvCacheType:r([`f16`,`q8_0`,`q4_0`]).optional(),llamaCppMlock:n().optional(),llamaCppFlashAttn:p([n(),r([`on`,`off`,`auto`])]).optional(),llamaCppNGpuLayers:d().int().min(-1).optional(),llamaCppCpuMoe:n().optional(),llamaCppNCpuMoe:d().int().min(0).optional(),llamaCppCacheReuse:d().int().min(0).optional(),llamaCppSwaFull:n().optional(),llamaCppThreads:d().int().positive().optional(),llamaCppBatchSize:d().int().positive().optional(),llamaCppSpecType:r([`none`,`draft-mtp`,`draft-eagle3`,`draft-dflash`,`draft-simple`,`ngram-mod`,`ngram-simple`,`ngram-map-k`,`ngram-map-k4v`,`ngram-cache`]).optional(),llamaCppDraftModelPath:t().optional(),llamaCppSpecDraftNMax:d().int().positive().optional(),llamaCppExtraArgs:o(t(),p([t(),d(),n()])).optional(),llamaCppUbatchSize:d().int().positive().optional(),mlxBaseUrl:t().optional(),mlxModelPath:t().optional(),mlxNumCtx:d().int().positive().optional(),mlxPackageSpec:t().optional(),mlxKvBits:d().int().min(0).max(8).optional(),mlxPrefillStepSize:d().int().positive().optional(),localEngineMemoryGb:d().positive().nullable().optional(),allowRamSpillover:n().nullable().optional(),localEngineReplicas:o(t(),d().int().min(0)).optional(),localEngineReplicasMax:d().int().positive().optional(),pythonRuntime:u({source:r([`system-uv`,`system-python`,`bundled-uv`]),installerPath:t().optional(),uvVersion:t().optional(),pythonVersion:t().optional(),resolvedAt:t().optional()}).optional(),firstRunCompleted:n().optional(),securityPolicy:Da.optional(),firstRunInstallError:t().optional(),copilotTurnTimeoutMin:d().int().positive().optional(),providerConcurrency:u({copilot:d().int().min(1).optional(),openai:d().int().min(1).optional(),anthropic:d().int().min(1).optional(),"anthropic-cli":d().int().min(1).optional(),"codex-cli":d().int().min(1).optional(),ollama:d().int().min(1).optional(),"llama-cpp":d().int().min(1).optional(),mlx:d().int().min(1).optional(),ds4:d().int().min(1).optional()}).optional(),cacheBudgetMb:u({mlx:d().int().min(64).optional(),"llama-cpp":d().int().min(64).optional()}).optional(),mlxDiskCacheBudgetMb:d().int().min(0).optional(),llamaCppDiskCacheBudgetMb:d().int().min(0).optional(),layeredPrefixCache:u({enabled:n().optional()}).optional(),batchedInference:u({enabled:n().optional()}).optional(),providerQueue:u({affinity:n().optional()}).optional(),taskRunner:u({tickIntervalMs:d().int().min(500).optional()}).optional(),taskBudget:u({enabled:n().optional(),softNudge:n().optional(),hardPause:n().optional(),scale:d().positive().optional(),limits:o(r([`tiny`,`small`,`medium`,`large`,`cloud`]),u({softTurns:d().int().positive().optional(),hardTurns:d().int().positive().optional(),softOutputTokens:d().int().positive().optional(),hardOutputTokens:d().int().positive().optional()}).partial()).optional()}).optional(),stuckStep:u({enabled:n().optional(),stallMs:d().int().positive().optional(),maxRedrives:d().int().positive().optional()}).optional(),autoRecall:u({enabled:n().optional(),topK:d().int().positive().optional(),minScore:d().optional()}).optional(),summarization:u({enabled:n().optional(),provider:M.optional(),model:t().optional(),minUserTurns:d().int().positive().optional(),idleHours:d().positive().optional()}).optional(),memory:u({maintenance:u({enabled:n().optional(),olderThanDays:d().int().min(2).optional(),minEntries:d().int().positive().optional()}).optional(),lessons:u({enabled:n().optional(),maxChars:d().int().positive().optional(),lookbackDays:d().int().positive().optional()}).optional()}).optional(),searchIndex:u({enabled:n().optional(),sessions:n().optional(),history:n().optional(),documents:n().optional()}).optional(),digest:u({enabled:n().optional()}).optional(),gildeUpdates:u({enabled:n().optional()}).optional(),meesterStatus:u({enabled:n().optional(),maxRunsPerDay:d().int().min(1).max(24).optional(),changeWindowHours:d().positive().optional()}).optional(),growth:u({enabled:n().optional()}).optional(),keurmeester:u({enabled:n().optional(),providerName:t().optional(),model:t().optional(),allowTakeover:n().optional(),maxConsultsPerSession:d().int().positive().optional(),maxConsultsPerTask:d().int().positive().optional(),cooldownMs:d().int().positive().optional()}).optional(),projectNudge:u({enabled:n().optional(),rapidIntervalMs:d().int().positive().optional(),slowIntervalMs:d().int().positive().optional(),recentActivityWindowMs:d().int().positive().optional(),rapidAttemptsBeforeBackoff:d().int().positive().optional(),firstNudgeGraceMs:d().int().nonnegative().optional()}).optional(),debugMode:n().optional(),showAdvancedFeatures:n().optional(),resetTemplatesOnStartup:n().optional(),aiEngagementMode:r([`proactive`,`scheduled`,`reactive`,`off`]).optional(),showSystemTray:n().optional(),autoUpdateChecks:n().optional(),quitOnClose:n().optional(),themePref:r([`system`,`light`,`dark`]).optional(),documentExportOptions:ka.optional(),sidebarSide:r([`left`,`right`]).optional(),homeGreetingCollapsed:n().optional(),workshopTempo:r([`gezellig`,`bedrijvig`,`druk`,`dolle-boel`]).optional(),nightShift:u({enabled:n().optional(),window:u({startHour:d().int().min(0).max(23),endHour:d().int().min(0).max(23)}).optional(),keepAwakeWhileRunning:n().optional(),wakeOnStart:n().optional(),modelOverride:u({enabled:n().optional(),provider:M.optional(),model:t().optional()}).optional()}).optional(),toolFilterMode:r([`always`,`never`,`small-model`]).optional(),channels:da.optional(),sandboxCopilot:n().optional(),anthropicCli:u({binaryPath:t().optional(),manageRuntimeFiles:n().optional(),defaultPermissionMode:D.optional(),extraModels:l(u({id:t(),name:t()})).optional(),poolSize:d().int().min(1).max(32).optional(),workerIdleSec:d().int().min(60).max(3600).optional()}).optional(),codexCli:u({binaryPath:t().optional(),manageRuntimeFiles:n().optional(),defaultPermissionMode:it.optional(),defaultReasoningEffort:r([`minimal`,`low`,`medium`,`high`,`xhigh`,`max`,`ultra`]).optional(),extraModels:l(u({id:t(),name:t()})).optional(),extraConfigOverrides:o(t(),t()).optional()}).optional(),executionDensity:r([`auto`,`flat`,`scaffold`]).optional(),playwrightHeadless:n().optional(),fetchUrl:u({allow:l(t()).optional(),deny:l(t()).optional()}).optional(),webSearch:u({provider:r([`brave`,`wikipedia`,`tavily`,`mock`]).optional(),fallbackProvider:r([`brave`,`wikipedia`,`tavily`]).optional(),defaultLimit:d().int().min(1).max(20).optional(),allow:l(t()).optional(),deny:l(t()).optional()}).optional(),projectMru:l(u({id:t(),at:d()})).optional(),recentTabs:l(a(`kind`,[u({kind:i(`project`),id:t(),at:d(),order:d()}),u({kind:i(`gezel`),id:t(),at:d(),order:d()}),u({kind:i(`document`),path:t(),at:d(),order:d()}),u({kind:i(`task`),ref:t(),at:d(),order:d()}),u({kind:i(`area`),area:r([`projects`,`gezels`,`documents`,`tasks`,`scripts`,`history`,`settings`,`benchmarks`]),at:d(),order:d()})])).optional(),externalFolders:Ea.optional()}),Na=r([`projects`,`gezels`,`documents`,`tasks`,`craftbooks`,`scripts`,`history`,`settings`,`benchmarks`,`handboek`]);a(`kind`,[u({kind:i(`project`),id:t(),at:d(),order:d(),pinned:n().optional()}),u({kind:i(`gezel`),id:t(),at:d(),order:d(),pinned:n().optional()}),u({kind:i(`document`),path:t(),at:d(),order:d(),pinned:n().optional()}),u({kind:i(`task`),ref:t(),at:d(),order:d(),pinned:n().optional()}),u({kind:i(`area`),area:Na,at:d(),order:d(),pinned:n().optional()}),u({kind:i(`script`),projectId:t(),name:t(),scope:r([`standard`,`user`]).optional(),at:d(),order:d(),pinned:n().optional()}),u({kind:i(`craftbook`),id:t(),source:r([`bundled`,`local`,`project`]).optional(),at:d(),order:d(),pinned:n().optional()}),u({kind:i(`craftbook-script`),craftbookId:t(),name:t(),at:d(),order:d(),pinned:n().optional()})]),Ma.extend({ollamaThink:n().nullable().optional(),firstRunInstallError:t().nullable().optional(),service:u({url:t(),token:t()}).nullable().optional(),llamaCppBaseUrl:t().nullable().optional(),llamaCppModelPath:t().nullable().optional(),llamaCppBackendOverride:r([`auto`,`cuda`,`vulkan`,`metal`,`cpu`]).nullable().optional(),llamaCppKvCacheType:r([`f16`,`q8_0`,`q4_0`]).nullable().optional(),llamaCppFlashAttn:p([n(),r([`on`,`off`,`auto`])]).nullable().optional(),llamaCppSpecType:r([`none`,`draft-mtp`,`draft-eagle3`,`draft-dflash`,`draft-simple`,`ngram-mod`,`ngram-simple`,`ngram-map-k`,`ngram-map-k4v`,`ngram-cache`]).nullable().optional(),llamaCppCpuMoe:n().nullable().optional(),llamaCppSwaFull:n().nullable().optional(),mlxBaseUrl:t().nullable().optional(),mlxModelPath:t().nullable().optional(),mlxPackageSpec:t().nullable().optional(),mlxKvBits:d().int().min(0).max(8).nullable().optional(),externalFolders:u({documents:t().min(1).nullable().optional(),gezels:t().min(1).nullable().optional(),projects:t().min(1).nullable().optional()}).nullable().optional()}),u({gezels:l(hn)}),u({name:t().min(1),description:t().optional(),role:t().optional(),gender:dn.optional(),model:t().optional(),about:t().optional()}),u({state:_t,nextLevelXp:d().int(),activeTraits:l(pn),driftedTraitIds:l(t())}),u({proposalId:t().min(1)}),u({proposalId:t().min(1).optional()}),u({source:t()}),u({source:t()}),u({name:t().min(1)}),u({defaults:o(t(),f()).nullable()}),u({provider:M.nullable().optional(),model:t().nullable().optional(),reasoningEffort:t().nullable().optional(),numCtx:d().int().positive().nullable().optional(),autoRecall:n().nullable().optional(),font:t().nullable().optional(),sandboxCopilot:n().nullable().optional(),claudePermissionMode:D.nullable().optional(),codexPermissionMode:it.nullable().optional(),tuning:k.nullable().optional(),tuningProfile:O.nullable().optional(),iconOverride:n().nullable().optional(),recognition:r([`auto`,`always`,`off`]).nullable().optional()}),u({instruction:t().optional()}),u({role:t().optional()}),u({provider:M,models:l(u({id:t(),name:t(),supportsReasoning:n().optional(),reasoningEfforts:l(t()).optional(),defaultReasoningEffort:t().optional(),contextWindow:d().optional(),supportsTools:n().optional(),parameterSize:t().optional()}))}),u({svg:t()});var Pa=u({timestamp:t(),svg:t()});u({current:t().nullable(),history:l(Pa)}),u({timestamp:t()}),u({poppetje:nt}),u({seed:d().int().optional()});var Fa=r([`about`,`chat-composer`,`task-description`,`generic`]);u({text:t(),context:Fa.optional(),instruction:t().optional(),isSelection:n().optional(),subject:t().optional(),parentContext:t().optional()}),u({text:t()}),u({mode:r([`rewrite`,`insert`]).default(`rewrite`),text:t().default(``),instruction:t().optional(),context:Fa.optional(),subject:t().optional(),parentContext:t().optional(),textBefore:t().optional(),textAfter:t().optional()}),a(`type`,[u({type:i(`status`),phase:r([`queued`,`started`]),detail:t().optional()}),u({type:i(`thinking-delta`),text:t()}),u({type:i(`output-delta`),text:t()}),u({type:i(`done`),text:t()}),u({type:i(`error`),error:t()})]),u({path:t().min(1),content:t()});var Ia=t().trim().min(1).max(1024).refine(e=>{let t=e.replace(/\\/g,`/`);return!t.startsWith(`/`)&&!/^[A-Za-z]:\//.test(t)&&t.split(`/`).every(e=>e!==`..`)},{message:`must be a relative path without .. segments`}),La=a(`kind`,[u({kind:i(`documents`)}),u({kind:i(`project-artifacts`),projectId:t().trim().min(1)})]);u({markdown:t().max(5e6),selectedFile:Ia,format:r([`mp4`,`gif`]),source:La}),u({path:t().min(1)}),u({fromPath:t().trim().min(1),toPath:t().trim().min(1)}),u({gezelId:t(),messages:l(N)}),u({message:t().min(1),projectId:t().optional(),expectedDeliverable:Ii.optional()}),u({accepted:i(!0),gezelId:t()}),u({fromGezelId:t().min(1),fromSessionId:t().optional(),projectId:t().optional(),text:t().min(1),expectedDeliverable:Ii.optional()}),u({accepted:i(!0),sessionId:t(),toGezelId:t(),toGezelName:t(),deduplicated:n().optional()}),u({jobTitle:t().min(1),preferredName:t().optional()}),u({gezelId:t(),name:t(),role:t(),action:r([`reused`,`created-from-gilde`,`created-bespoke`]),matchScore:d().optional(),templateId:t().optional(),alternatives:l(t()).optional()}),u({candidates:l(u({id:t(),label:t(),description:t().optional(),roleBasedName:t().optional(),group:r([`voorman`,`assignees`,`team`]).optional()}))}),u({projects:l(u({projectId:t(),projectName:t(),precedence:r([`voorman`,`assignment`,`session`,`fallback`]),lastActivityAt:t().optional()}))}),u({projectId:t(),gezelId:t(),sessionId:t(),prompt:t().min(1),choices:l(t()).max(20).optional(),allowWriteIn:n().optional(),multiSelect:n().optional(),taskRef:vr.optional(),documentPath:t().optional()}),u({questionId:t(),deduped:n().optional()}),u({projectId:t(),gezelId:t(),sessionId:t(),toolName:t().min(1),toolInput:o(t(),f())}),a(`behavior`,[u({behavior:i(`allow`),updatedInput:o(t(),f())}),u({behavior:i(`deny`),message:t()})]),u({fromGezelId:t().min(1),fromSessionId:t().min(1),toGezelIdOrName:t().min(1),projectId:t().optional(),question:t().min(1),timeoutMs:d().int().positive().optional(),taskRef:t().optional(),stepId:t().optional(),expectedDeliverable:Ii.optional()}),a(`outcome`,[u({outcome:i(`reply`),text:t(),toGezelId:t(),toGezelName:t(),sessionId:t()}),u({outcome:i(`error`),reason:r([`cycle`,`depth`,`self`,`not-found`,`engagement-off`,`timeout`,`target-error`,`target-deleted`,`delivery-failed`]),message:t()})]),u({selectedChoices:l(d().int().min(0)).optional(),writeIn:t().optional(),declined:n().optional(),silentSkip:n().optional(),npmInstallDecisions:l(zt).optional()}),u({questions:l(en)}),u({kind:r([`artifact`,`document`,`workspace`]),path:t().min(1).max(4096)}),u({path:t().min(1)}),a(`mode`,[u({mode:i(`text`),content:t()}),u({mode:i(`markdown`),content:t(),sidecarPath:t().min(1)}),u({mode:i(`media`),mediaKind:r([`image`,`video`,`audio`])}),u({mode:i(`binary`)})]),a(`kind`,[u({kind:i(`found`),content:t(),path:t(),fuzzy:n()}),u({kind:i(`ambiguous`),candidates:l(t())}),u({kind:i(`missing`)})]),u({lines:u({start:d().int().min(1),count:d().int().min(0)}).optional(),head:d().int().min(0).optional(),tail:d().int().min(0).optional()}),a(`kind`,[u({kind:i(`found`),content:t(),path:t(),fuzzy:n(),linesReturned:d().int().nonnegative(),totalLines:d().int().nonnegative(),bytesReturned:d().int().nonnegative(),totalBytes:d().int().nonnegative(),hasMore:n()}),u({kind:i(`ambiguous`),candidates:l(t())}),u({kind:i(`missing`)})]),u({path:t().min(1),pattern:t().min(1),caseInsensitive:n().optional(),contextLines:d().int().min(0).max(10).optional(),maxMatches:d().int().min(1).max(100).optional()}),a(`kind`,[u({kind:i(`found`),matches:l(u({lineNumber:d().int().min(1),line:t(),contextBefore:l(t()).optional(),contextAfter:l(t()).optional()})),totalMatches:d().int().nonnegative(),totalLines:d().int().nonnegative(),truncated:n(),path:t(),fuzzy:n()}),u({kind:i(`ambiguous`),candidates:l(t())}),u({kind:i(`missing`)}),u({kind:i(`invalid-pattern`),error:t()})]);var Ra=u({phase:r([`idle`,`installing-toolsets`,`downloading-browser`,`ready`,`setup-incomplete`,`error`]),currentToolset:t().optional(),browserProgress:u({bytesDownloaded:d(),bytesTotal:d().nullable()}).optional(),error:t().optional(),updatedAt:t()}),za=u({phase:r([`idle`,`provisioning`,`ready`,`error`]),message:t().optional(),error:t().optional(),updatedAt:t()}),Ba=p([u({kind:i(`stdout`),line:t()}),u({kind:i(`stderr`),line:t()}),u({kind:i(`exit`),code:d()}),u({kind:i(`error`),message:t()})]),Va=a(`type`,[u({type:i(`phase`),phase:r([`resolving`,`downloading`,`extracting`,`installing-deps`,`publishing`])}),u({type:i(`progress`),bytesWritten:d().nonnegative(),totalBytes:d().nonnegative()}),u({type:i(`retrying`),attempt:d().int().positive(),maxAttempts:d().int().positive(),delayMs:d().nonnegative(),reason:t()}),u({type:i(`log`),line:t()}),u({type:i(`done`),installPath:t(),version:t()}),u({type:i(`error`),error:t()})]);u({toolsetId:t(),version:t(),startedAt:t(),phase:r([`resolving`,`downloading`,`extracting`,`installing-deps`,`publishing`]),bytesWritten:d().nonnegative(),totalBytes:d().nonnegative(),retrying:u({attempt:d().int().positive(),maxAttempts:d().int().positive(),delayMs:d().nonnegative(),reason:t()}).optional(),log:l(t()),finished:n(),error:t().optional(),installPath:t().optional()}),u({available:n(),source:r([`env`,`managed`,`path`]).nullable(),managed:r([`current`,`outdated`,`absent`,`damaged`]),damagedReason:t().optional(),installedVersion:t().optional(),pinnedVersion:t(),installDir:t().optional(),cliPath:t().optional(),updateAvailable:n()}),u({projects:l(qn.extend({architecture:t().optional()}))});var Ha=u({name:t().min(1),description:t().optional(),about:t().optional().describe(`A few paragraphs about who this project is for, what's in scope, what's explicitly out of scope. First thing any gezel reads when they join the project.`),missionObjectives:t().optional().describe(`Concrete success criteria — usually a bullet list. What does "done" look like?`),mode:r([`crew`,`solo`]).optional(),indexingEnabled:n().optional(),github:u({url:t().url()}).optional()});u({name:t().min(1).optional(),description:t().optional(),workingDir:t().nullable().optional(),voormanGezelId:t().nullable().optional(),about:t().optional(),missionObjectives:t().optional(),github:p([s(),u({url:t().url().optional(),branch:t().optional()})]).optional(),managedWorkspaceWritePolicy:Gn.optional(),allowGezelWrites:n().optional(),codexPermissionMode:rt.optional(),claudePermissionMode:D.optional(),nudgeConfig:Hn.optional(),tabVisibility:Wn.optional(),indexingEnabled:n().optional(),status:r([`active`,`readonly`,`inactive`,`stable`]).optional(),archived:n().optional(),workspaceScriptTimeoutMs:d().int().min(3e4).max(30*6e4).optional(),grantedCredentials:l(t()).optional(),credentialAllowedOrigins:o(t(),l(zn)).optional(),projectTypeId:t().nullable().optional(),properties:o(t(),t()).optional()});var Ua=u({typeId:t().min(1),version:t().optional(),params:o(t(),f()).optional()}),Wa=u({ref:t(),craftbook:t(),cron:t(),consent:r([`ask`,`auto`,`disabled`]),status:r([`active`,`paused`]),created:n()}),Ga=u({typeId:t(),version:t(),source:t(),gezelsCreated:l(u({id:t(),name:t(),templateId:t(),voorman:n()})),scriptsInstalled:l(t()),workspaceSeeded:l(t()),toolsetsInstalled:l(t()),toolsBound:l(t()),craftbooksInstalled:l(t()),schedulesCreated:l(Wa),aboutRendered:n(),missionRendered:n(),deferred:u({toolsets:l(t()),craftbooks:l(t()),pages:n(),schedules:d()})});Ha.pick({name:!0,description:!0,mode:!0}).extend({projectType:Ua}),u({project:Yn,applied:Ga}),u({name:A,version:j.optional()}).strict(),u({packages:l(Rt).min(1).max(50).optional(),package:A.optional(),version:j.optional(),gezelId:t().optional(),sessionId:t().optional()}).strict().superRefine((e,t)=>{let n=e.packages!==void 0,r=e.package!==void 0;n===r&&t.addIssue({code:`custom`,message:`provide exactly one of packages or package`}),!r&&e.version!==void 0&&t.addIssue({code:`custom`,path:[`version`],message:`version requires the singular package field`})}),u({project:Yn,log:t()}),u({scripts:o(t(),t()),packageManager:t().optional()}),u({ok:n(),code:d(),stdout:t(),stderr:t(),stdoutTruncated:n(),stderrTruncated:n(),timedOut:n(),error:t().optional(),approvalPending:n().optional(),questionId:t().optional(),declined:t().optional(),resolvedBinPath:t().optional()}),u({script:t().min(1),args:l(t()).optional(),timeoutMs:d().int().positive().optional(),gezelId:t().optional(),sessionId:t().optional()}),u({bin:t().min(1),args:l(t()).optional(),timeoutMs:d().int().positive().optional(),gezelId:t().optional(),sessionId:t().optional()}),u({npmApproved:l(u({package:t(),version:t(),at:t(),approvedBy:r([`user`,`shipped`])})),npmDeclined:l(u({package:t(),version:t(),at:t()})),scriptApprovals:o(t(),r([`approved`,`declined`])),npxApprovals:o(t(),r([`approved`,`declined`])),npmShipped:l(u({package:t(),allowedVersions:l(t())}))}),u({error:t(),details:f().optional()}),u({url:t().url(),method:r([`GET`,`HEAD`,`POST`,`PUT`,`PATCH`,`DELETE`]).optional(),headers:o(t(),t()).optional(),body:t().optional(),timeoutMs:d().int().positive().max(12e4).optional(),maxBytes:d().int().positive().max(50*1024*1024).optional()}),u({status:d().int(),statusText:t(),headers:o(t(),t()),body:t().optional(),bodyBase64:t().optional(),mimeType:t().optional(),truncated:n()}),u({query:t().min(1).max(400),limit:d().int().min(1).max(20).optional(),freshness:r([`day`,`week`,`month`,`year`]).optional(),country:t().length(2).optional(),language:t().min(2).max(8).optional()});var Ka=u({title:t(),url:t(),snippet:t(),domain:t(),publishedAt:t().optional(),source:r([`brave`,`wikipedia`,`tavily`,`mock`])});u({query:t().min(1).max(400),limit:d().int().min(1).max(20).optional(),language:t().min(2).max(8).optional()}),u({results:l(Ka),source:r([`brave`,`wikipedia`,`tavily`,`mock`]),query:t(),durationMs:d().int().nonnegative()}),u({files:l(u({path:t().min(1).max(4096),startLine:d().int().min(1).max(1e7).optional(),endLine:d().int().min(1).max(1e7).optional()}).superRefine((e,t)=>{let n=e.startLine??1;e.endLine!==void 0&&e.endLine<n&&t.addIssue({code:c.custom,path:[`endLine`],message:`endLine must be greater than or equal to startLine`}),e.endLine!==void 0&&e.endLine-n+1>400&&t.addIssue({code:c.custom,path:[`endLine`],message:`a read range may contain at most 400 lines`})})).min(1).max(8)}),u({results:l(a(`status`,[u({status:i(`ok`),path:t(),content:t(),startLine:d().int().positive(),endLine:d().int().nonnegative(),linesReturned:d().int().nonnegative(),bytesReturned:d().int().nonnegative(),scannedBytes:d().int().nonnegative(),totalLines:d().int().nonnegative().optional(),totalBytes:d().int().nonnegative(),eof:n(),completeFile:n(),hasMore:n(),nextStartLine:d().int().positive().optional(),truncated:n(),truncationReason:r([`line-limit`,`output-limit`]).optional()}),u({status:i(`error`),path:t(),code:r([`path-not-found`,`path-safety`,`not-file`,`binary-file`,`unsupported-encoding`,`range-out-of-bounds`,`line-too-long`,`scan-limit`,`deadline`,`read-failed`,`aggregate-limit`]),error:t(),scannedBytes:d().int().nonnegative().optional()})])),truncated:n(),totalBytesReturned:d().int().nonnegative(),totalScannedBytes:d().int().nonnegative()}),u({pattern:t().min(1).max(4e3),path:t().max(4096).optional(),glob:t().min(1).max(512).optional(),includeGlobs:l(t().min(1).max(512)).max(32).optional(),excludeGlobs:l(t().min(1).max(512)).max(32).optional(),caseInsensitive:n().optional(),literal:n().optional(),contextLines:d().int().min(0).max(5).optional(),resultMode:r([`matches`,`files`,`count`]).optional(),cursor:d().int().min(0).max(1e4).optional(),maxResults:d().int().positive().max(200).optional(),timeoutMs:d().int().min(100).max(3e4).optional()});var qa=u({line:d().int().positive(),text:t()}),Ja=u({path:t(),line:d().int().positive(),text:t(),before:l(qa).optional(),after:l(qa).optional()});u({mode:r([`matches`,`files`,`count`]).default(`matches`),matches:l(Ja),files:l(t()).default([]),count:d().int().nonnegative().default(0),truncated:n(),truncationReason:r([`limit`,`output`]).optional(),nextCursor:d().int().nonnegative().optional(),engine:r([`ripgrep`,`javascript`])}),u({glob:t().min(1),path:t().optional(),caseInsensitive:n().optional(),maxResults:d().int().positive().max(5e3).optional()}),u({files:l(t()),truncated:n()});var K=u({x:d(),y:d(),w:d(),h:d()}),Ya=u({id:t(),parentId:t().nullable(),rect:K,label:t(),depth:d().int().nonnegative(),fileCount:d().int().nonnegative(),weight:d().nonnegative(),color:t().optional(),labelPlate:K.optional(),displayLabel:t().optional()}),Xa=u({findings:d().int().nonnegative(),maxSeverity:r([`critical`,`high`,`medium`,`low`,`info`]).nullable(),fanIn:d().int().nonnegative(),fanOut:d().int().nonnegative(),vibe:r([`lush`,`tidy`,`plain`,`scruffy`,`blighted`]),zone:r([`residential`,`commercial`,`civic`,`industrial`]),importance:d().min(0).max(1).optional(),churn:d().int().nonnegative().optional()}),Za=r([`hamlet`,`village`,`town`,`city`]),Qa=u({id:t(),districtId:t(),rect:K,label:t(),weight:d().nonnegative(),kind:t().nullable().optional(),lang:t().nullable().optional(),state:r([`live`,`new`,`tombstoned`]),buildingCount:d().int().nonnegative(),phantom:n().optional(),placedAt:t().nullable().optional(),lot:K.optional(),health:Xa.optional(),levels:d().int().min(1).max(5).optional(),landmark:n().optional(),lastTouchedAt:t().optional(),urbanity:d().min(0).max(1).optional(),settlement:Za.optional()}),$a=u({id:t(),blockId:t(),rect:K,height:d().nonnegative(),lines:d().int().positive().optional(),lineStart:d().int().positive().optional(),lineEnd:d().int().positive().optional(),label:t(),kind:t()}),eo=u({id:t(),rect:K,tier:d().int().min(0).max(3),districtId:t().nullable()}),to=u({id:t(),districtId:t().nullable(),rect:K,kind:r([`plaza`,`green`]),blockId:t().optional()}),no=u({a:t(),b:t(),affinity:d(),source:r([`import`,`embedding`,`mixed`]),bidirectional:n()}),ro=u({blockId:t(),change:r([`added`,`modified`,`deleted`,`renamed`]),additions:d().int().nonnegative(),deletions:d().int().nonnegative(),fromPath:t().optional()}),io=u({prNumber:d().int().optional(),title:t().optional(),changedBlocks:l(ro)}),ao=u({center:u({x:d(),y:d()}),radius:d().positive(),ceiling:d().min(0).max(1),peak:d().min(0).max(1),median:d().min(0).max(1),settlement:Za,fileCount:d().int().nonnegative()}),oo=r([`core`,`tests`,`all`]);u({domain:r([`code`,`docs`,`data`]).optional(),scope:oo.optional(),pr:d().int().positive().optional()}),u({domain:t(),root:t(),bounds:K,builtAt:t(),indexed:n(),districts:l(Ya),blocks:l(Qa),buildings:l($a),roads:l(no),streets:l(eo).optional(),plazas:l(to).optional(),overlay:io.optional(),urbanity:ao.optional(),signals:u({gitAvailable:n(),churnWindowDays:d().int().positive()}).optional()}),u({query:t().min(1),maxResults:d().int().positive().max(100).optional()}),u({results:l(u({sourcePath:t(),markdownPath:t(),lineStart:d().int().positive(),snippet:t()})),engine:r([`fts`,`unavailable`]),truncated:n()}),u({path:t().min(1)}),u({found:n(),sourcePath:t().optional(),markdownPath:t().optional(),markdown:t().optional(),truncated:n()}),u({query:t().min(1),mode:r([`auto`,`semantic`,`keyword`]).optional(),maxResults:d().int().positive().max(100).optional()}),u({results:l(u({path:t(),lineStart:d().int().positive(),lineEnd:d().int().positive(),kind:t(),name:t().optional(),snippet:t(),score:d(),source:r([`vector`,`fts`])})),engine:r([`hybrid`,`semantic`,`fts`,`unavailable`]),truncated:n()});var q=r([`critical`,`high`,`medium`,`low`,`info`]),so=r([`builtin`,`semgrep`,`osv`,`gitleaks`]),co=r([`open`,`in_progress`,`resolved`]),lo=u({fingerprint:t().min(1),path:t(),line:d().int().positive().nullable(),ruleId:t(),category:t(),severity:q,source:so,title:t(),evidence:t().optional(),status:co,taskRef:vr.optional()}),uo=u({total:d().int().nonnegative(),bySeverity:o(t(),d().int().nonnegative()),byCategory:o(t(),d().int().nonnegative()),bySource:o(t(),d().int().nonnegative())});u({useExternalTools:n().optional()}),u({ran:n(),engines:l(t()),toolsAvailable:u({semgrep:n(),osvScanner:n(),gitleaks:n(),npm:n()}),findingCounts:uo,dependencies:d().int().nonnegative(),advisories:d().int().nonnegative()}),u({severity:q.optional(),category:t().optional(),path:t().optional(),source:so.optional(),maxResults:d().int().positive().max(1e3).optional()}),u({findings:l(lo),counts:uo,truncated:n(),indexed:n()}),u({fingerprint:t().min(1)}),u({resolved:n()}),u({fingerprint:t().min(1)}),u({finding:lo,taskRef:vr,gezelId:t(),gezelName:t(),enqueued:n()}),u({entryPoints:l(t()),routes:l(t()),authBoundaries:l(t()),secretTouchpoints:l(t()),taintSources:l(u({path:t(),count:d().int().positive()}))}).extend({root:t(),indexed:n()}),u({dependencies:l(u({name:t(),ecosystem:t(),version:t().nullable(),direct:n(),advisoryIds:l(t()),maxSeverity:q.nullable(),license:t().nullable()})),total:d().int().nonnegative(),withAdvisories:d().int().nonnegative(),scanned:n()}),u({indexed:n(),scanned:n(),findings:uo,attackSurface:u({entryPoints:d().int().nonnegative(),routes:d().int().nonnegative(),authBoundaries:d().int().nonnegative(),secretTouchpoints:d().int().nonnegative(),taintSources:d().int().nonnegative()}),dependencies:u({total:d().int().nonnegative(),withAdvisories:d().int().nonnegative()}),systemicCandidates:l(u({category:t(),fileCount:d().int().positive(),findingCount:d().int().positive(),severity:q}))}),u({file:t().min(1),maxHops:d().int().positive().max(8).optional()}),u({file:t(),found:n(),upstream:l(t()),downstream:l(t()),taintSources:l(lo),sinks:l(lo),note:t()});var fo=u({kind:r([`project`,`gezel`,`file`,`document`,`content`,`symbol`,`memory`,`session`]),id:t(),title:t(),subtitle:t().optional(),snippet:t().optional(),projectId:t().optional(),projectName:t().optional(),path:t().optional(),source:r([`workspace`,`artifacts`]).optional(),line:d().int().positive().optional(),gezelId:t().optional(),score:d()});u({query:t().min(1).max(400),mode:r([`names`,`full`]).optional(),maxResults:d().int().positive().max(100).optional()}),u({results:l(fo),truncated:n()}),u({q:t().min(1).max(400),gezel:t().optional(),project:t().optional(),maxResults:d().int().positive().max(100).optional()}),u({results:l(u({sessionId:t(),gezelId:t(),projectId:t(),title:t(),snippet:t(),messageStart:d().int().positive(),lastActivityAt:t(),archived:n()})),engine:r([`fts`,`unavailable`])}),u({q:t().min(1).max(400),maxResults:d().int().positive().max(100).optional()}),u({results:l(u({path:t(),lineStart:d().int().positive(),snippet:t()})),engine:r([`fts`,`unavailable`])}),u({query:t().min(1),maxResults:d().int().positive().max(100).optional()}),u({results:l(u({path:t(),width:d().int().optional(),height:d().int().optional(),format:t().optional(),caption:t().optional(),score:d()})),engine:r([`fts`,`unavailable`]),truncated:n()}),u({path:t().min(1),maxResults:d().int().positive().max(100).optional()}),u({results:l(u({path:t(),score:d()})),engine:r([`vector`,`unavailable`]),truncated:n()}),u({path:t().optional()}),u({path:t(),imageCount:d().int().nonnegative(),formats:l(u({format:t(),count:d().int()})),dimensions:u({minWidth:d().int(),maxWidth:d().int(),minHeight:d().int(),maxHeight:d().int()}).nullable(),samples:l(t()),captioned:d().int().nonnegative()}),u({query:t().optional(),kind:t().optional(),maxResults:d().int().positive().max(200).optional()}),u({entities:l(u({id:d().int(),kind:t(),label:t(),canonical:t(),mentions:d().int().nonnegative()})),engine:r([`index`,`unavailable`])}),u({entity:t().min(1),maxResults:d().int().positive().max(500).optional()}),u({found:n(),entity:u({kind:t(),label:t()}).optional(),mentions:l(u({path:t(),line:d().int().optional(),date:t().optional()}))}),u({leftPath:t().optional(),leftText:t().optional(),rightPath:t().optional(),rightText:t().optional(),contextLines:d().int().min(0).max(20).optional()}).refine(e=>(e.leftPath||e.leftText)&&(e.rightPath||e.rightText),{message:`Provide {leftPath|leftText} and {rightPath|rightText}.`}),u({diff:t(),identical:n()}),u({path:t().min(1),artifact:n().optional()}),u({path:t(),mimeType:t(),base64:t(),bytes:d().int().nonnegative()}),u({path:t().min(1),maxEntries:d().int().positive().max(5e3).optional()});var po=u({name:t(),size:d().int().nonnegative(),isDirectory:n()});u({format:r([`zip`,`tar`,`tar.gz`]),entries:l(po),truncated:n()}),u({path:t().min(1),outputPath:t().min(1)}),u({format:r([`zip`,`tar`,`tar.gz`]),extractedCount:d().int().nonnegative(),destination:t()}),u({subcommand:r([`status`,`log`,`diff`,`show`,`blame`,`branch`,`rev-parse`,`ls-files`]),args:l(t()).max(32).optional(),timeoutMs:d().int().positive().max(12e4).optional()}),u({code:d().int(),stdout:t(),stderr:t(),stdoutTruncated:n(),timedOut:n()}),u({deviceCode:t(),userCode:t(),verificationUri:t(),interval:d().int().positive(),expiresIn:d().int().positive()});var mo=u({login:t(),name:t().optional(),avatarUrl:t().optional()});u({deviceCode:t()}),a(`status`,[u({status:i(`pending`)}),u({status:i(`slow_down`)}),u({status:i(`expired`)}),u({status:i(`denied`),error:t().optional()}),u({status:i(`success`),identity:mo,scopes:l(t()).optional()}),u({status:i(`not_configured`),error:t()})]),p([mo.extend({signedIn:i(!0)}),u({signedIn:i(!1)})]),u({repos:l(u({fullName:t(),url:t(),description:t().optional(),private:n().optional(),pushedAt:t().optional()}))}),u({url:t()}),u({owner:t(),repo:t(),canonicalUrl:t(),defaultBranch:t().optional(),description:t().optional(),topics:l(t()).optional(),language:t().optional(),readme:t(),readmeTruncated:n()}),u({name:t().min(1),repoUrl:t(),description:t().optional(),topics:l(t()).optional(),readme:t()}),u({about:t(),missionObjectives:t()}),u({path:t().min(1)}),u({name:t(),about:t().optional(),source:t().optional()});var ho=u({name:t(),kind:r([`npm-script`,`workspace-script`,`vscode-launch`,`bin`]),source:t(),run:t(),description:t().optional()}),go=u({version:d().int(),scannedAt:t(),root:t(),durationMs:d().int(),fileCount:d().int(),commandCount:d().int(),shapeCount:d().int().optional()}),_o=u({name:t(),char:t().length(1).optional(),type:r([`boolean`,`option`]),description:t().optional(),required:n().optional(),default:t().optional(),options:l(t()).optional(),multiple:n().optional()}),vo=u({name:t(),description:t().optional(),required:n().optional(),default:t().optional(),options:l(t()).optional()}),yo=u({source:i(`oclif`),package:t(),packageVersion:t().optional(),summary:t().optional(),description:t().optional(),subcommands:l(u({name:t(),fullName:t(),summary:t().optional()})).optional(),flags:l(_o).optional(),args:l(vo).optional(),usage:t().optional(),examples:l(t()).optional()});u({shapes:o(t(),yo)}),u({state:r([`fresh`,`stale`,`indexing`,`never`,`disabled`]),meta:go.optional(),aiScanPending:n().optional(),aiDrive:r([`background`,`full`]).optional(),enrichment:u({eligible:d().int().nonnegative(),summarized:d().int().nonnegative(),embedded:d().int().nonnegative(),pending:d().int().nonnegative(),skipped:d().int().nonnegative().optional(),shadowsPending:d().int().nonnegative().optional(),embedModel:t().optional(),reviews:u({eligible:d().int().nonnegative(),reviewed:d().int().nonnegative(),stale:d().int().nonnegative(),pending:d().int().nonnegative()}).optional()}).optional()}),u({maxFiles:d().int().positive().max(25).optional(),budgetMs:d().int().positive().max(6e4).optional(),areas:n().optional(),reviews:n().optional(),intensity:r([`background`,`full`]).optional()}),u({paused:n(),files:d().int().nonnegative(),summarized:d().int().nonnegative(),embedded:d().int().nonnegative(),pending:d().int().nonnegative(),areasUpdated:d().int().nonnegative(),architectureUpdated:n(),reviewed:d().int().nonnegative().optional(),reviewPending:d().int().nonnegative().optional(),drained:n(),started:n().optional(),alreadyRunning:n().optional(),mode:r([`background`,`full`]).optional()});var bo=u({ref:t(),title:t(),projectName:t(),stepName:t().optional()});u({background:l(u({id:t(),title:t(),detail:t(),projectName:t().optional()})),active:l(bo),upcoming:l(bo)});var xo=u({ref:t(),title:t(),projectId:t(),projectName:t(),completedAt:t().optional()}),So=u({projectId:t(),projectName:t(),path:t(),title:t(),writtenAt:t().optional(),actionCounts:u({total:d(),suggested:d(),fired:d(),applied:d(),dismissed:d()})});u({windowKey:t(),windowStart:t(),windowEnd:t(),tasksCompleted:l(xo),reports:l(So)}),u({meta:go,commands:l(ho),shapes:o(t(),yo).optional()}),u({skills:l(u({name:t(),source:t(),origin:r([`claude`,`gstack`,`agents`,`other`]),description:t().optional(),triggers:l(t()).optional(),version:t().optional(),body:t(),generated:n().optional(),hasShellScripts:n(),files:l(u({relPath:t(),kind:r([`section`,`reference`,`template`,`script`,`bin`,`other`]),bytes:d().int().nonnegative()})).optional()}))}),u({instructions:l(u({source:t(),origin:r([`agents`,`claude`,`copilot`]),content:t(),hash:t(),mtimeMs:d()}))}),u({sessionId:t(),providerName:t(),model:t().optional(),modelTier:r([`tiny`,`small`,`medium`,`large`,`cloud`]),parameterSize:t().optional(),leaksUntaggedReasoning:n(),reasoningEffort:t().optional(),numCtx:d().optional(),systemPrompt:t(),volatileContext:t().optional(),customToolsMd:n(),registeredTools:l(t()),turnStatus:r([`idle`,`in-progress`,`queued`]),recentMessages:l(u({role:r([`user`,`assistant`,`system`,`tool`]),content:t(),reasoning:t().optional(),warnings:l(t()).optional(),synthetic:r([`compaction-summary`,`context-loop-halt`,`turn-aborted`,`growth-announcement`,`keurmeester-notice`]).optional(),attemptedToolCalls:l(u({body:t(),reason:t().optional()})).optional(),toolCalls:l(u({name:t(),argsSummary:t().optional(),success:n(),errorMessage:t().optional()})).optional()})),diagnostics:u({sessionRecordPath:t(),logsDir:t(),engineLogGlob:t().optional()}).optional(),generatedAt:t()}),u({source:t().min(1),dest:t().min(1),gezelId:t().optional(),sessionId:t().optional()}),u({ok:i(!0),source:t(),dest:t(),bytes:d().int().nonnegative()}),u({url:t().url(),dest:t().optional(),branch:t().min(1).optional(),gezelId:t().optional(),sessionId:t().optional()}),u({ok:i(!0),path:t(),files:d().int().nonnegative(),bytes:d().int().nonnegative()}),u({url:t().url(),baseRef:t().min(1),headRef:t().min(1),dest:t().optional(),diffPath:t().min(1).optional(),gezelId:t().optional(),sessionId:t().optional()}),u({ok:i(!0),path:t(),diffPath:t(),baseSha:t(),headSha:t(),files:d().int().nonnegative(),bytes:d().int().nonnegative(),diffBytes:d().int().nonnegative(),filesChanged:d().int().nonnegative()}),u({path:t().min(1),find:t().min(1),replace:t(),occurrence:p([d().int().positive(),i(`all`)]).optional(),gezelId:t().optional(),sessionId:t().optional()}),u({path:t().min(1),diff:t().min(1),gezelId:t().optional(),sessionId:t().optional()}),u({path:t().min(1),marker:t().min(1),content:t(),where:r([`before`,`after`]).optional(),gezelId:t().optional(),sessionId:t().optional()}),u({path:t().min(1),startLine:d().int().positive(),endLine:d().int().positive(),content:t(),gezelId:t().optional(),sessionId:t().optional()}),u({ok:i(!0),path:t(),diff:t(),addedLines:d().int().nonnegative(),removedLines:d().int().nonnegative(),diffTruncated:n().optional()}),u({tools:l(u({name:t(),description:t(),parameters:o(t(),f())}))}),u({args:o(t(),f()).optional()}),u({text:t(),images:l(u({base64:t(),mimeType:t()}))});var Co=r([`NW`,`N`,`NE`,`W`,`C`,`E`,`SW`,`S`,`SE`]),wo=u({path:t().min(1),region:Co,cx:d().min(0).max(1),cy:d().min(0).max(1)}),To=u({path:t().min(1),region:Co.optional(),rect:K.optional(),style:t().optional()}),Eo=u({k:r([`block`,`street`,`plate`,`plaza`]),id:t(),p:t().nullable().optional(),h:t().nullable().optional(),r:ne([d(),d(),d(),d()]),w:d().optional(),a:t().nullable().optional(),d:t().nullable().optional()}),Do=u({cx:d(),cy:d(),r:d().positive(),impRef:d().min(0)}),Oo=u({layoutVersion:d().int().positive(),anchors:l(wo).default([]),journal:l(Eo).default([]),downtown:Do.optional()});u({schemaVersion:d().int().positive().default(1),about:t().default(`Gezel Village placement memory. Committing this file keeps the village stable across machines and index rebuilds. anchors/overrides are safe to hand-edit; journal is machine-maintained. Deliberately free of provenance timestamps so an unchanged rebuild produces no diff.`),overrides:l(To).default([]),domains:o(t(),Oo).default({})});var J=u({ok:n(),detail:t()}),ko=r([`probed`,`failed`,`deferred`,`blocked`]),Ao=r([`install`,`manual`]);u({schemaVersion:i(1),provider:t(),modelId:t(),status:ko,admitted:n(),genTokensPerSec:d().nullable(),shortPromptGenTokensPerSec:d().nullable().optional(),representativeContext:u({targetPromptTokens:d().int().positive(),promptTokens:d().int().nonnegative().nullable(),cachedPromptTokens:d().int().nonnegative().nullable(),completionTokens:d().int().nonnegative().nullable(),durationMs:d().nonnegative().nullable(),ttftMs:d().nonnegative().nullable(),promptTokensPerSec:d().positive().nullable(),genTokensPerSec:d().positive().nullable()}).optional(),createdAt:t(),durationMs:d().int().nonnegative(),trigger:Ao,sha256:t().optional(),catalogVersion:t().optional(),contextWindow:d().int().optional(),host:u({totalRamBytes:d(),gpuVramBytes:d().nullable(),source:t()}),checks:u({spawn:J,toolRoundTrip:J,throughput:J,reasoningBudget:J,contextFit:J})}),u({scope:a(`kind`,[u({kind:i(`gezel`),gezelId:t()}),u({kind:i(`project`),projectId:t()}),u({kind:i(`shared`)}),u({kind:i(`system`)})]),text:t().min(1).max(2*1024*1024),sourceName:t().min(1).max(512).optional()});var jo=u({serverName:t().optional(),message:t()});u({ok:i(!0),imported:l(t()),warnings:l(jo).default([])});var Mo=r([`fire-craftbook`,`create-task`,`apply-edits`]),No={id:t().regex(/^[a-z0-9][a-z0-9_-]*$/i).optional(),title:t().min(1),reason:t().optional(),projectId:t().optional()},Po=a(`kind`,[u({kind:i(`fire-craftbook`),...No,craftbookId:t().min(1),params:o(t(),t()).optional()}),u({kind:i(`create-task`),...No,prompt:t().min(1),role:t().optional()}),u({kind:i(`apply-edits`),...No,edits:l(u({path:t().min(1),diffArtifact:t().min(1)})).min(1)})]),Fo=r([`suggested`,`fired`,`applied`,`failed`,`dismissed`]),Io=u({actionId:t(),reportPath:t(),kind:Mo,contentHash:t(),firstSeenAt:t(),state:Fo,taskRef:t().optional(),firedAt:t().optional(),settledAt:t().optional(),outcome:r([`complete`,`canceled`]).optional(),results:l(u({path:t(),ok:n(),error:t().optional()})).optional()}),Lo=u({index:d().int(),message:t(),raw:t()});u({actions:l(u({action:Po,id:t(),contentHash:t(),state:Fo,taskRef:t().optional(),firedAt:t().optional(),settledAt:t().optional(),outcome:r([`complete`,`canceled`]).optional(),results:l(u({path:t(),ok:n(),error:t().optional()})).optional(),contentChanged:n().optional()})),issues:l(Lo),stale:l(Io)}),u({path:t().min(1),actionId:t().min(1),params:o(t(),t()).optional()}),u({record:Io,taskRef:t().optional()}),u({path:t().min(1),actionId:t().min(1)});var Ro=a(`kind`,[u({kind:i(`gezel-template`),templateId:t(),gezelId:t().optional(),gezelName:t().optional(),role:t().optional()}),u({kind:i(`project-type`),typeId:t(),scheduleKey:t()})]),zo=r([`suggested`,`enabled`,`paused`,`dismissed`]);u({items:l(u({key:t(),source:Ro,craftbookId:t(),craftbookName:t().optional(),description:t().optional(),reason:t().optional(),runMode:r([`night-shift`,`scheduled`]),cron:t().optional(),overlap:I.optional(),paramSchema:o(t(),f()).optional(),params:o(t(),t()).optional(),state:zo,taskRef:t().optional(),pendingQuestionId:t().optional(),orphaned:n().optional()}))}),u({key:t(),params:o(t(),t()).optional()}),u({key:t()}),u({key:t(),dismissed:n()});var Bo=r([`workspace`,`artifacts`]),Y={__gezelPage:i(1)};a(`kind`,[u({...Y,kind:i(`hello`)}),u({...Y,kind:i(`invoke`),id:t().min(1).max(64),tool:t().regex(/^[a-z][a-z0-9_]*$/),input:o(t(),f()).optional()}),u({...Y,kind:i(`read`),id:t().min(1).max(64),op:r([`read`,`list`,`stat`]),source:Bo,path:t().min(1),as:r([`text`,`json`,`bytes`]).optional(),maxBytes:d().int().positive().optional()}),u({...Y,kind:i(`watch`),id:t().min(1).max(64),source:Bo,path:t().min(1)}),u({...Y,kind:i(`unwatch`),id:t().min(1).max(64)}),u({...Y,kind:i(`refresh`)})]);var Vo=r([`not-allowed`,`invalid-input`,`script-error`,`timeout`,`unavailable`,`rate-limited`]);a(`kind`,[u({...Y,kind:i(`init`),api:i(1),theme:u({mode:r([`light`,`dark`])}),limits:u({maxInflight:d().int().positive(),maxReadBytes:d().int().positive()})}),u({...Y,kind:i(`result`),id:t(),ok:n(),output:f().optional(),error:t().optional(),errorCode:Vo.optional(),runId:t().optional(),reaction:u({delivered:n(),gezelId:t().optional(),reason:t().optional()}).optional()}),u({...Y,kind:i(`read-result`),id:t(),ok:n(),error:t().optional(),errorCode:Vo.optional(),content:t().optional(),encoding:r([`utf8`,`base64`]).optional(),entries:l(u({name:t(),kind:r([`file`,`dir`]),size:d().nonnegative(),mtime:d().nonnegative()})).optional(),etag:t().optional(),size:d().nonnegative().optional(),mtime:d().nonnegative().optional()}),u({...Y,kind:i(`change`),watchId:t(),path:t(),etag:t()}),u({...Y,kind:i(`theme`),theme:u({mode:r([`light`,`dark`])})})]),u({api:i(1),projectId:t(),source:i(`type`),entry:t(),typeName:t(),params:o(t(),f()),tools:l(t())});var Ho=t().min(1).describe(`CSS color — hex (#rgb, #rgba, #rrggbb, #rrggbbaa) or the keyword "transparent".`),Uo={x:d().optional(),y:d().optional(),width:d().positive().optional(),height:d().positive().optional(),opacity:d().min(0).max(1).optional()},Wo=a(`kind`,[u({kind:i(`svg`),svg:t().min(1).describe(`SVG markup. <script>/<foreignObject>/event handlers are stripped.`),rotate:d().optional().describe(`Degrees of rotation around the layer center.`),...Uo}),u({kind:i(`html`),html:t().min(1).describe(`HTML fragment rendered inside a sandboxed iframe.`),...Uo}),u({kind:i(`pixels`),rows:l(t()).min(1).describe("Pixel grid as a JSON array of strings; one row per string, one character per cell. Every character must appear as a key in `palette`."),palette:o(t(),Ho).describe('Map from single-character keys in `rows` to CSS colors. Mnemonic letters ("r"=red, "w"=white, "g"=green) are encouraged. Use "transparent" for empty cells.'),scale:d().int().positive().optional().describe(`Pixel size in output px. Defaults to a value that fits the canvas.`),...Uo}),u({kind:i(`image`),artifactPath:t().min(1).describe(`Path to a previously-written artifact, relative to the project artifacts/ root.`),...Uo}),u({kind:i(`text`),text:t().min(1),x:d(),y:d(),font:t().optional(),size:d().positive().optional(),color:Ho.optional(),weight:d().int().optional(),opacity:d().min(0).max(1).optional()})]);u({projectId:t().optional().describe(`Project to save the artifact under. Defaults to "default".`),width:d().int().positive().max(4096),height:d().int().positive().max(4096),layers:l(Wo).min(1).max(64),background:Ho.optional().describe(`Canvas background color. Defaults to transparent.`),filename:t().optional().describe(`Artifact filename (without extension) saved under artifacts/renders/. Defaults to a timestamped name.`),format:r([`png`,`jpeg`]).optional().describe(`Output format. Defaults to png.`)}),u({path:t().describe(`Project-relative path, e.g. "renders/sprite-1234.png".`),url:t().describe(`HTTP URL to the saved artifact, authed like every other artifact route.`),width:d().int().positive(),height:d().int().positive(),bytes:d().int().nonnegative(),mimeType:t(),base64:t().describe(`Base64-encoded image data, ready to feed into a vision input.`),engine:r([`playwright`,`resvg`]).describe(`Which render engine produced the image.`)});var Go=p([u({data:t().min(1),mimeType:t().default(`image/png`)}),u({artifactPath:t().min(1)})]);u({prompt:t().min(1),negativePrompt:t().optional(),model:t().optional(),width:d().int().positive().optional(),height:d().int().positive().optional(),steps:d().int().positive().optional(),seed:d().int().optional(),inputImages:l(Go).optional(),strength:d().min(0).max(1).optional(),projectId:t().optional(),gezelId:t().optional(),sessionId:t().optional(),inline:n().optional(),saveAs:t().optional()});var Ko=u({model:t(),seed:d().int(),steps:d().int(),widthPx:d().int().positive(),heightPx:d().int().positive(),durationMs:d().int().nonnegative(),img2imgSkippedReason:t().optional()});u({artifactPath:t(),workspacePath:t().nullable(),meta:Ko,b64Png:t().optional()}),u({models:l(u({id:t(),name:t(),approxSizeBytes:d().int().nonnegative(),installedAt:t(),kind:r([`local`,`cloud`]).optional(),supportsImg2Img:n().optional()})),defaultModel:t().optional()}),u({engine:u({status:r([`ok`,`unreachable`,`not-configured`]),baseUrl:t(),error:t().optional(),kind:r([`local`,`cloud`]).optional(),provider:t().optional()}),modelCount:d().int().nonnegative()}),u({pulls:l(u({id:t(),startedAt:t(),bytesWritten:d().int().nonnegative(),totalBytes:d().int().nonnegative(),retrying:u({attempt:d().int().positive(),maxAttempts:d().int().positive(),delayMs:d().int().nonnegative(),reason:t()}).optional(),finished:n(),error:t().optional()}))});var qo=a(`type`,[u({type:i(`progress`),bytesWritten:d().int().nonnegative(),totalBytes:d().int().nonnegative().optional()}),u({type:i(`retrying`),attempt:d().int().positive(),maxAttempts:d().int().positive(),delayMs:d().int().nonnegative(),reason:t()}),u({type:i(`error`),error:t()}),u({type:i(`done`),id:t()})]),Jo=p([u({data:t().min(1),mimeType:t().default(`image/png`)}),u({artifactPath:t().min(1)})]);u({prompt:t().min(1),negativePrompt:t().optional(),model:t().optional(),width:d().int().positive().optional(),height:d().int().positive().optional(),numFrames:d().int().positive().optional(),fps:d().int().positive().optional(),steps:d().int().positive().optional(),seed:d().int().optional(),inputImage:Jo.optional(),projectId:t().optional(),gezelId:t().optional(),sessionId:t().optional(),inline:n().optional(),saveAs:t().optional()});var Yo=u({model:t(),seed:d().int(),steps:d().int(),widthPx:d().int().positive(),heightPx:d().int().positive(),numFrames:d().int().positive(),fps:d().int().positive(),durationMs:d().int().nonnegative(),mimeType:t()});u({artifactPath:t(),workspacePath:t().nullable(),meta:Yo,b64Poster:t().optional()}),u({models:l(u({id:t(),name:t(),approxSizeBytes:d().int().nonnegative(),installedAt:t(),kind:r([`local`,`cloud`]).optional()})),defaultModel:t().optional()});var Xo=r([`cuda`,`mps`,`cpu`]);u({engine:u({status:r([`ok`,`unreachable`,`not-configured`]),baseUrl:t(),error:t().optional(),kind:r([`local`,`cloud`]).optional(),provider:t().optional(),accelerator:Xo.optional()}),modelCount:d().int().nonnegative()}),u({pulls:l(u({id:t(),startedAt:t(),bytesWritten:d().int().nonnegative(),totalBytes:d().int().nonnegative(),file:t().optional(),fileIndex:d().int().nonnegative().optional(),fileCount:d().int().positive().optional(),retrying:u({attempt:d().int().positive(),maxAttempts:d().int().positive(),delayMs:d().int().nonnegative(),reason:t()}).optional(),finished:n(),error:t().optional()}))});var Zo=a(`type`,[u({type:i(`progress`),fileIndex:d().int().nonnegative(),fileCount:d().int().positive(),file:t(),bytesWritten:d().int().nonnegative(),totalBytes:d().int().nonnegative(),bytesWrittenAll:d().int().nonnegative(),totalBytesAll:d().int().nonnegative()}),u({type:i(`retrying`),file:t(),attempt:d().int().positive(),maxAttempts:d().int().positive(),delayMs:d().int().nonnegative(),reason:t()}),u({type:i(`verifying`),file:t()}),u({type:i(`error`),error:t()}),u({type:i(`done`),id:t()})]);u({audio:p([u({data:t().min(1).describe(`Base64-encoded audio bytes.`),mimeType:t().default(`audio/wav`)}),u({artifactPath:t().min(1).describe("Project-relative artifact path under `audio/` or `audio/uploaded/`.")})]),model:t().optional(),language:t().optional(),projectId:t().optional()});var Qo=u({start:d(),end:d(),text:t()});u({text:t(),language:t().optional(),segments:l(Qo).optional(),durationMs:d().int().nonnegative()}),u({text:t().min(1),voice:t().optional(),model:t().optional(),speed:d().min(.25).max(4).optional(),projectId:t().optional(),sessionId:t().optional(),gezelId:t().optional(),inline:n().optional()});var $o=u({voice:t(),model:t(),sampleRate:d().int().positive(),durationSeconds:d().nonnegative(),durationMs:d().int().nonnegative()});u({artifactPath:t(),meta:$o,b64Wav:t().optional()}),u({models:l(u({id:t(),name:t(),approxSizeBytes:d().int().nonnegative(),installedAt:t()}))});var es=u({id:t(),name:t(),description:t(),approxSizeBytes:d().int().nonnegative(),kind:r([`stt`,`tts`]),license:t().optional(),...z,...B});u({stt:l(es),tts:l(es)}),u({voices:l(u({id:t(),name:t(),language:t(),gender:r([`female`,`male`,`neutral`]).optional(),modelId:t()}))});var ts=u({status:r([`ok`,`unreachable`,`not-configured`,`no-model`]),baseUrl:t().optional(),error:t().optional(),provider:t().optional(),modelCount:d().int().nonnegative()});u({stt:ts,tts:ts});var ns=a(`type`,[u({type:i(`progress`),bytesWritten:d().int().nonnegative(),totalBytes:d().int().nonnegative().optional()}),u({type:i(`error`),error:t()}),u({type:i(`done`),id:t()})]),rs=r([`conceptual`,`gezel-roles`,`craftbooks`,`project-types`,`technical`,`whats-new`]);r([`app`,`site`,`agent`]);var is=u({id:t().min(1),title:t().min(1),order:d()}),as=u({id:t().min(1),title:t().min(1),area:rs,order:d(),summary:t().optional(),generated:n(),siteVisible:n().optional(),subcategory:is.optional()});u({areas:l(u({area:rs,title:t(),entries:l(as)}))});var os=u({path:t().min(1),gezelId:t().min(1),name:t(),roleLabel:t().optional(),variant:r([`full`,`headshot`,`icon`]),poppetje:nt}),ss=u({blockId:t(),hash:t().regex(/^[a-f0-9]{64}$/),durationMs:d().int().nonnegative(),silent:n().optional()});u({articleId:t(),voice:t(),model:t(),segments:l(ss)}),u({results:l(u({id:t().min(1),title:t().min(1),area:rs,summary:t().optional(),markdown:t(),figures:l(os).default([]),generated:n(),defaultDuration:d().positive().optional()}))});var cs=e({GezelApiError:()=>Q,GezelClient:()=>As,SsePayloadError:()=>fs,SsePrematureEofError:()=>ds,SseResponseError:()=>ps,SseStreamStaleError:()=>us,consumeSseJson:()=>hs,streamAllChatEvents:()=>vs,streamChatEvents:()=>gs,streamCopilotLogin:()=>Ss,streamMlxRuntimeStatus:()=>xs,streamProjectChatEvents:()=>_s,streamSystemToolsetStatus:()=>bs,streamTerminalEvents:()=>ys}),ls=2*6e4,us=class extends Error{constructor(e){super(`SSE stream stale: no bytes from server in ${e}ms`),this.name=`SseStreamStaleError`}},ds=class extends Error{constructor(e=`SSE operation`){super(`${e} ended before a terminal event was received`),this.name=`SsePrematureEofError`}},fs=class extends Error{constructor(e){super(e),this.name=`SsePayloadError`}},ps=class extends Error{constructor(e,t){super(`SSE stream failed: ${e} ${t}`.trim()),this.status=e,this.name=`SseResponseError`}status};async function*X(e,t,n,r={}){let i=await(e.fetch??fetch).bind(globalThis)(e.url,{method:e.method??`GET`,headers:{Accept:`text/event-stream`,...e.headers},signal:e.signal,body:e.body});if(!i.ok||!i.body)throw new ps(i.ok?0:i.status,i.statusText);let a=i.body.getReader(),o=new TextDecoder,s=``,c=e.keepaliveTimeoutMs??0,l=!1,u=e=>{let n=e.split(/\r?\n/).filter(e=>e.startsWith(`data:`)).map(e=>e.slice(5).trimStart());if(n.length===0)return null;let i=n.join(`
2
- `);if(i.trim()===``)return null;let a;try{a=JSON.parse(i)}catch{if(r.strictPayloads)throw new fs(`SSE event contained invalid JSON`);return console.warn(`[sse] skipping non-JSON payload:`,i.slice(0,200)),null}let o=t.safeParse(a);if(!o.success){let e=a&&typeof a==`object`&&`type`in a?String(a.type):`<no type>`;if(r.strictPayloads)throw new fs(`SSE event ${e} failed schema validation: ${o.error.issues.map(e=>`${e.path.join(`.`)}: ${e.message}`).join(`; `)}`);return console.error(`[sse] DROPPED event (type=${e}) \u2014 failed schema validation. This usually means a schema/version mismatch between packages; rebuild all of them. Issues:`,o.error.issues),null}return o.data};try{for(;;){let{value:e,done:t}=await ms(a,c);if(t){if(s+=o.decode(),s.trim()!==``){let e=u(s);e&&(yield e,n?.(e)&&(l=!0))}if(r.requireTerminal&&!l)throw new ds(r.label);return}s+=o.decode(e,{stream:!0});let i=/\r?\n\r?\n/.exec(s);for(;i;){let e=s.slice(0,i.index);s=s.slice(i.index+i[0].length);let t=u(e);if(t&&(yield t,n?.(t))){l=!0;return}i=/\r?\n\r?\n/.exec(s)}}}finally{await a.cancel().catch(()=>{}),a.releaseLock()}}async function ms(e,t){if(t<=0)return e.read();let n;try{return await Promise.race([e.read(),new Promise((e,r)=>{n=setTimeout(()=>r(new us(t)),t)})])}finally{n&&clearTimeout(n)}}async function hs(e){let{schema:t,onEvent:n,isTerminal:r,label:i,...a}=e;for await(let e of X({keepaliveTimeoutMs:ls,...a},t,r,{strictPayloads:!0,requireTerminal:!0,label:i}))n(e)}function gs(e){return X(e,xn,e=>e.type===`done`,{requireTerminal:!0,label:`Chat stream`})}function _s(e){return X({keepaliveTimeoutMs:1e4,...e},Sn)}function vs(e){return X({keepaliveTimeoutMs:1e4,...e},Sn)}function ys(e){return X({keepaliveTimeoutMs:1e4,...e},Pi)}function bs(e){return X(e,Ra)}function xs(e){return X(e,za)}function Ss(e){return X({method:`POST`,...e},Ba,e=>e.kind===`exit`||e.kind===`error`,{requireTerminal:!0,label:`Copilot login stream`})}var Z={keepaliveTimeoutMs:40*6e4,staleMessage:`Download stopped: server has gone quiet.`},Q=class extends Error{constructor(e,t,n){super(e),this.status=t,this.details=n,this.name=`GezelApiError`}status;details};function Cs(e){if(!(e instanceof Error))return String(e);let t=e.cause;return t instanceof Error&&t.message&&t.message!==e.message?`${e.message} (${t.message})`:t&&typeof t==`object`&&`code`in t?`${e.message} (${String(t.code)})`:e.message}async function $(e){let{staleMessage:t,...n}=e;try{await hs(n)}catch(e){throw e instanceof Q?e:new Q(e instanceof us&&t?t:e instanceof Error?e.message:`SSE stream failed`,e instanceof ps?e.status:0,{cause:e instanceof Error?e.name:`unknown`})}}var ws=u({file:t(),expected:t(),actual:t()}),Ts=a(`type`,[u({type:i(`progress`),bytesWritten:d(),totalBytes:d()}),u({type:i(`retrying`),attempt:d().int().positive(),maxAttempts:d().int().positive(),delayMs:d().nonnegative(),reason:t()}),u({type:i(`verifying`)}),u({type:i(`extracting-metadata`)}),u({type:i(`companion`),kind:i(`image-recognition`),id:t(),name:t(),bytesWritten:d().nonnegative(),totalBytes:d().nonnegative(),error:t().optional()}),u({type:i(`done`),id:t(),warning:t().optional()}),u({type:i(`error`),error:t(),mismatch:ws.optional()})]),Es=a(`type`,[u({type:i(`progress`),fileIndex:d().int().nonnegative(),fileCount:d().int().positive(),file:t(),bytesWritten:d().nonnegative(),totalBytes:d().nonnegative(),bytesWrittenAll:d().nonnegative(),totalBytesAll:d().nonnegative()}),u({type:i(`retrying`),attempt:d().int().positive(),maxAttempts:d().int().positive(),delayMs:d().nonnegative(),reason:t(),file:t()}),u({type:i(`verifying`),file:t()}),u({type:i(`extracting-metadata`)}),u({type:i(`done`),id:t(),warning:t().optional()}),u({type:i(`error`),error:t(),mismatch:ws.optional()})]),Ds=a(`type`,[u({type:i(`spawned`),trialId:t().optional(),runDir:t().optional()}),u({type:i(`log`),line:t()}),u({type:i(`done`),result:u({trialId:t(),scenarioId:t(),modelId:t(),startedAt:t(),finishedAt:t(),durationMs:d(),success:n(),reason:t(),failureMode:t().optional(),runDir:t()})}),u({type:i(`error`),error:t()})]),Os=a(`type`,[u({type:i(`status`),phase:r([`queued`,`started`]),detail:t().optional()}),u({type:i(`thinking-delta`),text:t()}),u({type:i(`output-delta`),text:t()}),u({type:i(`done`),text:t()}),u({type:i(`error`),error:t()})]),ks=a(`type`,[u({type:i(`progress`),chunk:u({status:t(),digest:t().optional(),total:d().optional(),completed:d().optional()})}),u({type:i(`error`),error:t()}),u({type:i(`done`)})]),As=class{baseUrl;token;fetchImpl;constructor(e){this.baseUrl=e.baseUrl.replace(/\/$/,``),this.token=e.token;let t=e.fetch??fetch;this.fetchImpl=t.bind(globalThis)}async request(e,t,n,r,i){let a;try{a=await this.fetchImpl(`${this.baseUrl}${t}`,{method:e,headers:{Authorization:`Bearer ${this.token}`,...n===void 0?{}:{"Content-Type":`application/json`},...r??{}},body:n===void 0?void 0:JSON.stringify(n),...i?{signal:i}:{}})}catch(n){let r=Cs(n);throw new Q(`Gezel API transport unavailable on ${e} ${t}: ${r}`,0,{kind:`transport`,cause:r})}if(!a.ok){let n;try{let e=await a.text();if(e.length===0)n=void 0;else try{n=JSON.parse(e)}catch{n=e}}catch(e){n=e instanceof Error?e.message:String(e)}throw new Q(`Gezel API error ${a.status} on ${e} ${t}`,a.status,n)}if(a.status!==204)return await a.json()}health(e){return this.request(`GET`,`/api/health`,void 0,void 0,e)}getUsage(){return this.request(`GET`,`/api/usage`)}getQueueStatus(){return this.request(`GET`,`/api/queues`)}cancelProviderQueueItem(e,t){return this.request(`DELETE`,`/api/queues/${encodeURIComponent(e)}/${t}`)}moveProviderQueueItem(e,t,n){return this.request(`POST`,`/api/queues/${encodeURIComponent(e)}/${t}/move`,{direction:n})}getCacheStats(){return this.request(`GET`,`/api/cache/stats`)}evictSessionCache(e){return this.request(`POST`,`/api/cache/evict`,{sessionId:e})}clearProviderCache(e){return this.request(`POST`,`/api/cache/clear`,{provider:e})}warmSessionCache(e){return this.request(`POST`,`/api/cache/warm`,{sessionId:e})}getConfig(){return this.request(`GET`,`/api/config`)}updateConfig(e){return this.request(`PUT`,`/api/config`,e)}getCodexSetupStatus(){return this.request(`GET`,`/api/codex-setup`)}configureCodex(e){return this.request(`PUT`,`/api/codex-setup`,e)}removeCodexSetup(){return this.request(`DELETE`,`/api/codex-setup`)}getGildeUpdateStatus(){return this.request(`GET`,`/api/gilde-updates`)}checkGildeUpdates(){return this.request(`POST`,`/api/gilde-updates/check`)}getNightShiftStatus(){return this.request(`GET`,`/api/night-shift/status`)}setNightShiftManual(e){return this.request(`POST`,`/api/night-shift/manual`,{action:e})}getNightShiftTasks(){return this.request(`GET`,`/api/night-shift/tasks`)}getNightShiftReview(){return this.request(`GET`,`/api/night-shift/review`)}listSuggestedWork(e){return this.request(`GET`,`/api/projects/${encodeURIComponent(e)}/suggested-work`)}enableSuggestedWork(e,t){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/suggested-work/enable`,t)}disableSuggestedWork(e,t){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/suggested-work/disable`,{key:t})}dismissSuggestedWork(e,t,n){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/suggested-work/dismiss`,{key:t,dismissed:n})}getReportActions(e,t){return this.request(`GET`,`/api/projects/${encodeURIComponent(e)}/report-actions?path=${encodeURIComponent(t)}`)}fireReportAction(e,t){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/report-actions/fire`,t)}dismissReportAction(e,t){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/report-actions/dismiss`,t)}getMeesterStatus(){return this.request(`GET`,`/api/meester-status`)}runMeesterStatus(){return this.request(`POST`,`/api/meester-status/run`)}getFolders(){return this.request(`GET`,`/api/folders`)}planFolderMove(e){return this.request(`POST`,`/api/folders/plan`,e)}startFolderMove(e){return this.request(`POST`,`/api/folders/move`,e)}getFolderMoveStatus(e){return this.request(`GET`,`/api/folders/move/${encodeURIComponent(e)}`)}cancelFolderMove(e){return this.request(`POST`,`/api/folders/move/${encodeURIComponent(e)}/cancel`)}resetFolder(e){return this.request(`POST`,`/api/folders/reset`,{scope:e})}createNewMeester(e={}){return this.request(`POST`,`/api/config/meester`,e)}createNewKlerk(e={}){return this.request(`POST`,`/api/config/klerk`,e)}createNewBoekwachter(e={}){return this.request(`POST`,`/api/config/boekwachter`,e)}createNewKeurmeester(e={}){return this.request(`POST`,`/api/config/keurmeester`,e)}testProvider(e){return this.request(`GET`,`/api/models/test?provider=${encodeURIComponent(e)}`)}listProviderModels(e,t){let n=t?.refresh?`&refresh=1`:``;return this.request(`GET`,`/api/models?provider=${encodeURIComponent(e)}${n}`)}listChannels(){return this.request(`GET`,`/api/channels`)}sendChannelMessage(e){return this.request(`POST`,`/api/channels/send`,e)}testChannel(e){return this.request(`POST`,`/api/channels/${encodeURIComponent(e)}/test`)}listOAuthClients(){return this.request(`GET`,`/api/oauth-clients`)}putOAuthClient(e,t){return this.request(`PUT`,`/api/oauth-clients/${encodeURIComponent(e)}`,t)}deleteOAuthClient(e){return this.request(`DELETE`,`/api/oauth-clients/${encodeURIComponent(e)}`)}createProjectPreviewUrl(e,t){return this.createPreviewUrl(`artifacts`,e,t)}createProjectWorkspacePreviewUrl(e,t){return this.createPreviewUrl(`workspace`,e,t)}createProjectTypePreviewUrl(e,t){return this.createPreviewUrl(`type`,e,t)}async createPreviewUrl(e,t,n){let r=await this.request(`POST`,`/api/projects/${encodeURIComponent(t)}/preview-capability`,{source:e,path:n});return{...r,url:new URL(r.url,this.baseUrl).toString()}}checkProjectPage(e,t){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/page-check`,{path:t})}reportProjectPreviewLog(e,t){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/preview-log`,{entries:t})}async uploadProjectAttachment(e,t,n){let r=`${this.baseUrl}/api/projects/${encodeURIComponent(e)}/attachments`,i=t instanceof Blob||t instanceof Uint8Array?t:new Uint8Array(t),a=await this.fetchImpl(r,{method:`POST`,headers:{"content-type":n,Authorization:`Bearer ${this.token}`},body:i});if(!a.ok){let e=await a.text().catch(()=>``);throw Error(`upload failed (${a.status}): ${e}`)}return a.json()}listProjectAttachments(e){return this.request(`GET`,`/api/projects/${encodeURIComponent(e)}/attachments`)}deleteProjectAttachment(e,t){return this.request(`DELETE`,`/api/projects/${encodeURIComponent(e)}/attachments/${encodeURIComponent(t)}`)}async fetchProjectAttachment(e,t){let n=`${this.baseUrl}/api/projects/${encodeURIComponent(e)}/attachments/${encodeURIComponent(t)}`,r=await this.fetchImpl(n,{headers:{Authorization:`Bearer ${this.token}`}});if(!r.ok)throw Error(`attachment fetch failed: ${r.status}`);return r.blob()}async uploadSessionImage(e,t,n,r){let i=`${this.baseUrl}/api/projects/${encodeURIComponent(e)}/sessions/${encodeURIComponent(t)}/images`,a=n instanceof Blob||n instanceof Uint8Array?n:new Uint8Array(n),o=await this.fetchImpl(i,{method:`POST`,headers:{"content-type":r,Authorization:`Bearer ${this.token}`},body:a});if(!o.ok){let e=await o.text().catch(()=>``);throw Error(`upload failed (${o.status}): ${e}`)}return o.json()}listSessionImages(e,t){return this.request(`GET`,`/api/projects/${encodeURIComponent(e)}/sessions/${encodeURIComponent(t)}/images`)}deleteSessionImage(e,t,n){return this.request(`DELETE`,`/api/projects/${encodeURIComponent(e)}/sessions/${encodeURIComponent(t)}/images/${encodeURIComponent(n)}`)}async fetchProjectArtifactBlob(e,t){let n=`${this.baseUrl}/api/projects/${encodeURIComponent(e)}/artifacts/read?path=${encodeURIComponent(t)}&raw=1`,r=await this.fetchImpl(n,{headers:{Authorization:`Bearer ${this.token}`}});if(!r.ok)throw Error(`artifact fetch failed: ${r.status}`);return r.blob()}async fetchProjectWorkspaceBlob(e,t){let n=`${this.baseUrl}/api/projects/${encodeURIComponent(e)}/workspace/read?path=${encodeURIComponent(t)}&raw=1`,r=await this.fetchImpl(n,{headers:{Authorization:`Bearer ${this.token}`}});if(!r.ok)throw Error(`workspace fetch failed: ${r.status}`);return r.blob()}async fetchSessionImage(e,t,n){let r=`${this.baseUrl}/api/projects/${encodeURIComponent(e)}/sessions/${encodeURIComponent(t)}/images/${encodeURIComponent(n)}`,i=await this.fetchImpl(r,{headers:{Authorization:`Bearer ${this.token}`}});if(!i.ok)throw Error(`image fetch failed: ${i.status}`);return i.blob()}getCopilotUser(){return this.request(`GET`,`/api/system/copilot-user`)}startGitHubLogin(){return this.request(`POST`,`/api/system/github-login/start`,{})}pollGitHubLogin(e){return this.request(`POST`,`/api/system/github-login/poll`,{deviceCode:e})}gitHubLogout(){return this.request(`POST`,`/api/system/github-logout`,{})}getGitHubIdentity(){return this.request(`GET`,`/api/system/github-identity`)}listGitHubRepos(){return this.request(`GET`,`/api/system/github-repos`)}previewGitHubRepo(e,t){return this.request(`POST`,`/api/system/github-repo-preview`,{url:e},void 0,t)}previewProjectAbout(e,t){return this.request(`POST`,`/api/projects/preview-about`,e,void 0,t)}previewFolder(e){return this.request(`POST`,`/api/projects/preview-folder`,{path:e})}listCatalogItems(e){return this.request(`GET`,`/api/catalog/${e}`)}listProjectCraftbooks(e){return this.request(`GET`,`/api/projects/${encodeURIComponent(e)}/craftbooks`)}getCatalogItem(e,t,n){let r=new URLSearchParams;n?.source&&r.set(`source`,n.source),n?.version&&r.set(`version`,n.version);let i=r.toString()?`?${r.toString()}`:``;return this.request(`GET`,`/api/catalog/${e}/${encodeURIComponent(t)}${i}`)}listCatalogItemVersions(e,t,n){let r=n?`?source=${encodeURIComponent(n)}`:``;return this.request(`GET`,`/api/catalog/${e}/${encodeURIComponent(t)}/versions${r}`)}async fetchCatalogFile(e){let t=await this.fetchImpl(`${this.baseUrl}${e}`,{headers:{Authorization:`Bearer ${this.token}`}});if(!t.ok)throw Error(`catalog file fetch failed: ${t.status}`);return t.blob()}createGezelFromTemplate(e,t){return this.request(`POST`,`/api/catalog/gezel-template/${encodeURIComponent(e)}/install`,t)}installToolset(e,t){return this.request(`POST`,`/api/catalog/toolset/${encodeURIComponent(e)}/install`,t)}importCustomMcpConfig(e){return this.request(`POST`,`/api/catalog/custom-toolsets/import`,e)}getToolsetConfig(e){return this.request(`GET`,`/api/toolset/${encodeURIComponent(e)}/config`)}updateToolsetConfig(e,t){return this.request(`PUT`,`/api/toolset/${encodeURIComponent(e)}/config`,t)}uninstallToolset(e,t){return this.request(`DELETE`,`/api/catalog/toolset/${encodeURIComponent(e)}/install?${js(t)}`)}listInstalledToolsets(e){return this.request(`GET`,`/api/catalog/installed-toolsets?${js(e)}`)}ollamaStatus(){return this.request(`GET`,`/api/ollama/status`)}ollamaProbe(){return this.request(`GET`,`/api/ollama/probe`)}ollamaDetect(){return this.request(`GET`,`/api/ollama/detect`)}ollamaStart(){return this.request(`POST`,`/api/ollama/start`)}listPendingOllamaPulls(){return this.request(`GET`,`/api/ollama/pending-pulls`)}clearPendingOllamaPull(e){return this.request(`DELETE`,`/api/ollama/pending-pulls/${encodeURIComponent(e)}`)}getMemoryProfile(){return this.request(`GET`,`/api/system/memory`)}getMachineMemoryUsage(){return this.request(`GET`,`/api/system/memory/usage`)}checkModelDownloadSpace(e){return this.request(`POST`,`/api/system/model-download-preflight`,e)}getSystemDiagnostics(e){return this.request(`GET`,`/api/system/diagnostics`,void 0,void 0,e)}getSystemHomeInfo(e){return this.request(`GET`,`/api/system/home`,void 0,void 0,e)}deleteOllamaModel(e){return this.request(`DELETE`,`/api/ollama/models/${encodeURIComponent(e)}`)}listLlamaCppModels(){return this.request(`GET`,`/api/llama-cpp/models`)}listIncompleteLlamaCppModels(){return this.request(`GET`,`/api/llama-cpp/incomplete`)}async exportModelBundle(e,t){let n=`${this.baseUrl}/api/model-bundles/${encodeURIComponent(e)}/${encodeURIComponent(t)}/export`,r=await this.fetchImpl(n,{headers:{Authorization:`Bearer ${this.token}`}});if(!r.ok){let e=await r.text().catch(()=>``);throw Error(`model export failed (${r.status}): ${e}`)}return r}async scanModelBundle(e){let t=e instanceof Blob||e instanceof ReadableStream||e instanceof Uint8Array?e:new Uint8Array(e),n=t instanceof ReadableStream,r=await this.fetchImpl(`${this.baseUrl}/api/model-bundles/imports/scan`,{method:`POST`,headers:{Authorization:`Bearer ${this.token}`,"Content-Type":`application/vnd.gezel.model+zip`},body:t,...n?{duplex:`half`}:{}});if(!r.ok){let e=await r.json().catch(()=>null);throw Error(e?.error??`model bundle scan failed (${r.status})`)}return r.json()}confirmModelBundleImport(e,t=!1){return this.request(`POST`,`/api/model-bundles/imports/confirm`,{importId:e,replace:t})}cancelModelBundleImport(e){return this.request(`DELETE`,`/api/model-bundles/imports/${encodeURIComponent(e)}`)}listSharedModelMigrationCandidates(e){let t=e?`?engine=${encodeURIComponent(e)}`:``;return this.request(`GET`,`/api/model-migrations/candidates${t}`)}moveModelToShared(e){return this.request(`POST`,`/api/model-migrations/move`,e)}listModelFitness(){return this.request(`GET`,`/api/model-fitness`)}runModelFitnessProbe(e,t){return this.request(`POST`,`/api/model-fitness/${encodeURIComponent(e)}/${encodeURIComponent(t)}/probe`)}listDs4Models(){return this.request(`GET`,`/api/ds4/models`)}listDs4ContextPlans(){return this.request(`GET`,`/api/ds4/context-plans`)}listIncompleteDs4Models(){return this.request(`GET`,`/api/ds4/incomplete`)}listDs4ActiveInstalls(){return this.request(`GET`,`/api/ds4/active-installs`)}deleteDs4Model(e){return this.request(`DELETE`,`/api/ds4/models/${encodeURIComponent(e)}`)}getDs4Log(e){let t=typeof e==`number`?`?bytes=${e}`:``;return this.request(`GET`,`/api/ds4/log${t}`)}getLlamaCppLog(e){let t=typeof e==`number`?`?bytes=${e}`:``;return this.request(`GET`,`/api/llama-cpp/log${t}`)}async installLlamaCppModel(e,t,n,r){return this.installGgufSse(`llama-cpp`,e,t,n,r)}async installDs4Model(e,t,n,r){return this.installGgufSse(`ds4`,e,t,n,r)}async installGgufSse(e,t,n,r,i){let a=i?.skipSha?`?skipSha=1`:``,o=`${this.baseUrl}/api/${e}/models/${encodeURIComponent(t)}/install${a}`;await $({...Z,url:o,method:`POST`,headers:{Authorization:`Bearer ${this.token}`},signal:r,fetch:this.fetchImpl,schema:Ts,onEvent:n,isTerminal:e=>e.type===`done`||e.type===`error`,label:`Install stream for "${t}"`})}deleteLlamaCppModel(e){return this.request(`DELETE`,`/api/llama-cpp/models/${encodeURIComponent(e)}`)}cancelLlamaCppModelInstall(e){return this.request(`DELETE`,`/api/llama-cpp/models/${encodeURIComponent(e)}/install`)}cancelDs4ModelInstall(e){return this.request(`DELETE`,`/api/ds4/models/${encodeURIComponent(e)}/install`)}listEvalScenarios(){return this.request(`GET`,`/api/eval/scenarios`)}getEvalAvailability(){return this.request(`GET`,`/api/eval/availability`)}listEvalResults(e){let t=new URLSearchParams;e?.scenarioId&&t.set(`scenario`,e.scenarioId),e?.limit!=null&&t.set(`limit`,String(e.limit));let n=t.toString()?`/api/eval/results?${t.toString()}`:`/api/eval/results`;return this.request(`GET`,n)}async runEval(e,t,n){await $({url:`${this.baseUrl}/api/eval/run`,method:`POST`,headers:{Authorization:`Bearer ${this.token}`,"Content-Type":`application/json`},body:JSON.stringify(e),signal:n,fetch:this.fetchImpl,schema:Ds,onEvent:t,isTerminal:e=>e.type===`done`||e.type===`error`,label:`Eval stream`})}listLlamaCppActiveInstalls(){return this.request(`GET`,`/api/llama-cpp/active-installs`)}listMlxModels(){return this.request(`GET`,`/api/mlx/models`)}listIncompleteMlxModels(){return this.request(`GET`,`/api/mlx/incomplete`)}async installMlxModel(e,t,n,r){let i=r?.skipSha?`?skipSha=1`:``,a=`${this.baseUrl}/api/mlx/models/${encodeURIComponent(e)}/install${i}`;await $({...Z,url:a,method:`POST`,headers:{Authorization:`Bearer ${this.token}`},signal:n,fetch:this.fetchImpl,schema:Es,onEvent:t,isTerminal:e=>e.type===`done`||e.type===`error`,label:`Install stream for "${e}"`})}deleteMlxModel(e){return this.request(`DELETE`,`/api/mlx/models/${encodeURIComponent(e)}`)}cancelMlxModelInstall(e){return this.request(`DELETE`,`/api/mlx/models/${encodeURIComponent(e)}/install`)}listMlxActiveInstalls(){return this.request(`GET`,`/api/mlx/active-installs`)}getMlxRuntime(){return this.request(`GET`,`/api/mlx/runtime`)}resetMlxRuntime(){return this.request(`POST`,`/api/mlx/runtime/reset`)}getEngineStatus(){return this.request(`GET`,`/api/engines/status`)}getEngineRetention(){return this.request(`GET`,`/api/engines/retention`)}updateEngineRetention(e){return this.request(`PUT`,`/api/engines/retention`,{idleTimeoutMs:e})}updateEngineMemoryBudget(e){return this.request(`PUT`,`/api/engines/memory-budget`,{localEngineMemoryGb:e})}updateEngineRamSpillover(e){return this.request(`PUT`,`/api/engines/ram-spillover`,{allowRamSpillover:e})}unloadIdleEngine(e){return this.request(`POST`,`/api/engines/unload`,e)}getLlamaCppContextSizing(){return this.request(`GET`,`/api/engines/llama-cpp/context-sizing`)}updateLlamaCppContextSizing(e){return this.request(`PUT`,`/api/engines/llama-cpp/context-sizing`,{policy:e})}getModelContextOverrides(e){return this.request(`GET`,`/api/engines/${e}/model-context`)}updateModelContextOverride(e,t,n){return this.request(`PUT`,`/api/engines/${e}/model-context/${encodeURIComponent(t)}`,{contextTokens:n})}getNativeEngineStatus(){return this.request(`GET`,`/api/engines/binaries/status`)}async ensureNativeEngine(e,t,n,r){let i=n?`?variant=${encodeURIComponent(n)}`:``;await $({...Z,url:`${this.baseUrl}/api/engines/binaries/${encodeURIComponent(e)}/ensure${i}`,method:`POST`,headers:{Authorization:`Bearer ${this.token}`},signal:r,fetch:this.fetchImpl,schema:pa,onEvent:t,isTerminal:e=>e.type===`done`||e.type===`error`,label:`Native engine install stream for "${e}"`})}reconcileEnginePool(e){return this.request(`POST`,`/api/engines/reconcile`,e)}generateImage(e){return this.request(`POST`,`/api/image-gen/generate`,e)}listInstalledImageModels(){return this.request(`GET`,`/api/image-gen/models`)}getImageEngineStatus(){return this.request(`GET`,`/api/image-gen/engine-status`)}deleteImageModel(e){return this.request(`DELETE`,`/api/image-gen/models/${encodeURIComponent(e)}`)}async pullImageModel(e,t,n){return this.consumeImagePullSse(`${this.baseUrl}/api/image-gen/models/${encodeURIComponent(e)}/pull`,`POST`,t,n)}listActiveImagePulls(){return this.request(`GET`,`/api/image-gen/pulls`)}subscribeImagePull(e,t,n){return this.consumeImagePullSse(`${this.baseUrl}/api/image-gen/pulls/${encodeURIComponent(e)}/events`,`GET`,t,n)}cancelImagePull(e){return this.request(`DELETE`,`/api/image-gen/pulls/${encodeURIComponent(e)}`)}async consumeImagePullSse(e,t,n,r){await $({...Z,url:e,method:t,headers:{Authorization:`Bearer ${this.token}`},signal:r,fetch:this.fetchImpl,schema:qo,onEvent:n,isTerminal:e=>e.type===`done`||e.type===`error`,label:`Image model pull stream`})}generateVideo(e){return this.request(`POST`,`/api/video-gen/generate`,e)}listInstalledVideoModels(){return this.request(`GET`,`/api/video-gen/models`)}getVideoEngineStatus(){return this.request(`GET`,`/api/video-gen/engine-status`)}deleteVideoModel(e){return this.request(`DELETE`,`/api/video-gen/models/${encodeURIComponent(e)}`)}async pullVideoModel(e,t,n){return this.consumeVideoPullSse(`${this.baseUrl}/api/video-gen/models/${encodeURIComponent(e)}/pull`,`POST`,t,n)}listActiveVideoPulls(){return this.request(`GET`,`/api/video-gen/pulls`)}subscribeVideoPull(e,t,n){return this.consumeVideoPullSse(`${this.baseUrl}/api/video-gen/pulls/${encodeURIComponent(e)}/events`,`GET`,t,n)}cancelVideoPull(e){return this.request(`DELETE`,`/api/video-gen/pulls/${encodeURIComponent(e)}`)}async consumeVideoPullSse(e,t,n,r){await $({...Z,url:e,method:t,headers:{Authorization:`Bearer ${this.token}`},signal:r,fetch:this.fetchImpl,schema:Zo,onEvent:n,isTerminal:e=>e.type===`done`||e.type===`error`,label:`Video model pull stream`})}transcribeAudio(e){return this.request(`POST`,`/api/audio/transcribe`,e)}synthesizeSpeech(e){let{signal:t,...n}=e;return this.request(`POST`,`/api/audio/synthesize`,n,void 0,t)}getAudioEngineStatus(){return this.request(`GET`,`/api/audio/engine-status`)}listAudioCatalog(){return this.request(`GET`,`/api/audio/catalog`)}listInstalledSttModels(){return this.request(`GET`,`/api/audio/stt/models`)}listInstalledTtsModels(){return this.request(`GET`,`/api/audio/tts/models`)}deleteSttModel(e){return this.request(`DELETE`,`/api/audio/stt/models/${encodeURIComponent(e)}`)}deleteTtsModel(e){return this.request(`DELETE`,`/api/audio/tts/models/${encodeURIComponent(e)}`)}listAudioVoices(){return this.request(`GET`,`/api/audio/voices`)}async pullAudioModel(e,t,n,r){await $({...Z,url:`${this.baseUrl}/api/audio/${e}/models/${encodeURIComponent(t)}/pull`,method:`POST`,headers:{Authorization:`Bearer ${this.token}`},signal:r,fetch:this.fetchImpl,schema:ns,onEvent:n,isTerminal:e=>e.type===`done`||e.type===`error`,label:`Audio model pull stream`})}getRecognitionHealth(){return this.request(`GET`,`/api/recognition/health`)}listRecognitionCatalog(){return this.request(`GET`,`/api/recognition/catalog`)}listInstalledRecognitionModels(){return this.request(`GET`,`/api/recognition/models`)}deleteRecognitionModel(e){return this.request(`DELETE`,`/api/recognition/models/${encodeURIComponent(e)}`)}clearRecognitionCache(){return this.request(`POST`,`/api/recognition/cache/clear`)}describeImage(e,t){let n=t?.projectId?`?project=${encodeURIComponent(t.projectId)}`:``;return this.request(`POST`,`/api/recognition/describe${n}`,e)}readImageMetadata(e,t){let n=t?.projectId?`?project=${encodeURIComponent(t.projectId)}`:``;return this.request(`POST`,`/api/recognition/metadata${n}`,e)}async pullRecognitionModel(e,t,n){await $({...Z,url:`${this.baseUrl}/api/recognition/models/${encodeURIComponent(e)}/pull`,method:`POST`,headers:{Authorization:`Bearer ${this.token}`},signal:n,fetch:this.fetchImpl,schema:sn,onEvent:t,isTerminal:e=>e.type===`done`||e.type===`error`,label:`Recognition model pull stream`})}async pullOllamaModel(e,t,n){await $({...Z,url:`${this.baseUrl}/api/ollama/pull`,method:`POST`,headers:{Authorization:`Bearer ${this.token}`,"Content-Type":`application/json`},body:JSON.stringify({name:e}),signal:n,fetch:this.fetchImpl,schema:ks,onEvent:t,isTerminal:e=>e.type===`done`,label:`Ollama pull stream`})}listGezels(){return this.request(`GET`,`/api/gezels`)}createGezel(e){return this.request(`POST`,`/api/gezels`,e)}resetGezelTemplates(){return this.request(`POST`,`/api/gezels/reset-templates`)}getGezel(e){return this.request(`GET`,`/api/gezels/${encodeURIComponent(e)}`)}deleteGezel(e){return this.request(`DELETE`,`/api/gezels/${encodeURIComponent(e)}`)}renameGezel(e,t){return this.request(`POST`,`/api/gezels/${encodeURIComponent(e)}/rename`,t)}updateGezelSettings(e,t){return this.request(`POST`,`/api/gezels/${encodeURIComponent(e)}/settings`,t)}updateGezelMarkdown(e,t){return this.request(`PUT`,`/api/gezels/${encodeURIComponent(e)}/md`,t)}getGezelGrowth(e){return this.request(`GET`,`/api/gezels/${encodeURIComponent(e)}/growth`)}refreshGezelGrowth(e){return this.request(`POST`,`/api/gezels/${encodeURIComponent(e)}/growth/refresh`)}acceptGrowthProposal(e,t){return this.request(`POST`,`/api/gezels/${encodeURIComponent(e)}/growth/accept`,{proposalId:t})}declineGrowthLevelUp(e,t){return this.request(`POST`,`/api/gezels/${encodeURIComponent(e)}/growth/decline`,t?{proposalId:t}:{})}retireGrowthTrait(e,t){return this.request(`DELETE`,`/api/gezels/${encodeURIComponent(e)}/growth/traits/${encodeURIComponent(t)}`)}updateGezelAbout(e,t){return this.request(`PUT`,`/api/gezels/${encodeURIComponent(e)}/about`,t)}updateGezelFixedFunctionDefaults(e,t){return this.request(`PUT`,`/api/gezels/${encodeURIComponent(e)}/fixed-function-defaults`,t)}generateGezelAbout(e,t={}){return this.request(`POST`,`/api/gezels/${encodeURIComponent(e)}/about/generate`,t)}generateGezelIcon(e,t={}){return this.request(`POST`,`/api/gezels/${encodeURIComponent(e)}/icon/generate`,t)}updateGezelIcon(e,t){return this.request(`PUT`,`/api/gezels/${encodeURIComponent(e)}/icon`,t)}listGezelIconHistory(e){return this.request(`GET`,`/api/gezels/${encodeURIComponent(e)}/icons`)}revertGezelIcon(e,t){return this.request(`POST`,`/api/gezels/${encodeURIComponent(e)}/icon/revert`,t)}getGezelPoppetje(e){return this.request(`GET`,`/api/gezels/${encodeURIComponent(e)}/poppetje`)}setGezelPoppetje(e,t){return this.request(`PUT`,`/api/gezels/${encodeURIComponent(e)}/poppetje`,t)}rerollGezelPoppetje(e,t={}){return this.request(`POST`,`/api/gezels/${encodeURIComponent(e)}/poppetje/reroll`,t)}messageGezel(e,t){return this.request(`POST`,`/api/gezels/${encodeURIComponent(e)}/message`,t)}askGezel(e){return this.request(`POST`,`/api/asks/request-and-wait`,e)}ensureGezel(e){return this.request(`POST`,`/api/gezels/ensure`,e)}rewriteText(e){return this.request(`POST`,`/api/ai/rewrite`,e)}async transformTextStream(e,t,n){await $({url:`${this.baseUrl}/api/ai/transform`,method:`POST`,headers:{Authorization:`Bearer ${this.token}`,"Content-Type":`application/json`},body:JSON.stringify(e),signal:n,fetch:this.fetchImpl,schema:Os,onEvent:t,isTerminal:e=>e.type===`done`||e.type===`error`,label:`Transform stream`})}listChatSessions(e){let t=new URLSearchParams;e?.gezelId&&t.set(`gezel`,e.gezelId),e?.projectId&&t.set(`project`,e.projectId);let n=t.toString()?`?${t.toString()}`:``;return this.request(`GET`,`/api/sessions${n}`)}createChatSession(e){return this.request(`POST`,`/api/sessions`,e)}getChatSession(e){return this.request(`GET`,`/api/sessions/${encodeURIComponent(e)}`)}getChatSessionDebug(e,t){let n=new URLSearchParams;t?.atTimestamp&&n.set(`at`,t.atTimestamp),t?.limit&&n.set(`limit`,String(t.limit));let r=n.toString()?`?${n.toString()}`:``;return this.request(`GET`,`/api/sessions/${encodeURIComponent(e)}/debug${r}`)}sendToChatSession(e,t){let n=typeof t==`string`?{message:t}:t;return this.request(`POST`,`/api/sessions/${encodeURIComponent(e)}/send`,n)}listSessionTools(e){return this.request(`GET`,`/api/sessions/${encodeURIComponent(e)}/tools`)}listProjectTools(e){return this.request(`GET`,`/api/projects/${encodeURIComponent(e)}/tools`)}searchProjectFiles(e,t){let n=t?`?prefix=${encodeURIComponent(t)}`:``;return this.request(`GET`,`/api/projects/${encodeURIComponent(e)}/index/files${n}`)}invokeSessionTool(e,t,n){return this.request(`POST`,`/api/sessions/${encodeURIComponent(e)}/tools/${encodeURIComponent(t)}/invoke`,{args:n??{}})}askUserQuestion(e){return this.request(`POST`,`/api/questions`,e)}listQuestions(e){let t=new URLSearchParams;e?.projectId&&t.set(`project`,e.projectId),e?.pending&&t.set(`pending`,`true`);let n=t.toString();return this.request(`GET`,`/api/questions${n?`?${n}`:``}`)}answerQuestion(e,t){return this.request(`POST`,`/api/questions/${encodeURIComponent(e)}/answer`,t)}listProjectsForGezel(e){return this.request(`GET`,`/api/gezels/${encodeURIComponent(e)}/projects`)}listMentionCandidates(e){let t=new URLSearchParams;e.projectId&&t.set(`project`,e.projectId),e.query&&t.set(`query`,e.query);let n=t.toString();return this.request(`GET`,`/api/gezels/mention-candidates${n?`?${n}`:``}`)}archiveChatSession(e){return this.request(`POST`,`/api/sessions/${encodeURIComponent(e)}/archive`)}deleteChatSession(e){return this.request(`DELETE`,`/api/sessions/${encodeURIComponent(e)}`)}getChatSessionInflight(e){return this.request(`GET`,`/api/sessions/${encodeURIComponent(e)}/inflight`)}listInflightTurns(e={}){let t=new URLSearchParams;e.projectId&&t.set(`project`,e.projectId),e.gezelId&&t.set(`gezel`,e.gezelId);let n=t.toString()?`?${t.toString()}`:``;return this.request(`GET`,`/api/sessions/inflight${n}`)}listSessionTelemetry(e={}){let t=new URLSearchParams;e.projectId&&t.set(`project`,e.projectId),e.gezelId&&t.set(`gezel`,e.gezelId);let n=t.toString()?`?${t.toString()}`:``;return this.request(`GET`,`/api/sessions/telemetry${n}`)}getSessionTelemetry(e){return this.request(`GET`,`/api/sessions/${encodeURIComponent(e)}/telemetry`)}cancelChatSessionTurn(e){return this.request(`POST`,`/api/sessions/${encodeURIComponent(e)}/cancel`)}emergencyStopChats(){return this.request(`POST`,`/api/sessions/emergency-stop`)}clearProjectErrors(e){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/clear-errors`)}listPoisonedProjects(){return this.request(`GET`,`/api/projects/poisoned`)}cancelQueuedMessage(e,t){return this.request(`DELETE`,`/api/sessions/${encodeURIComponent(e)}/queue/${encodeURIComponent(t)}`)}listSessionQueue(e){return this.request(`GET`,`/api/sessions/${encodeURIComponent(e)}/queue`)}updateQueuedMessage(e,t,n){return this.request(`PATCH`,`/api/sessions/${encodeURIComponent(e)}/queue/${encodeURIComponent(t)}`,n)}interruptChatSession(e,t){return this.request(`POST`,`/api/sessions/${encodeURIComponent(e)}/interrupt`,t)}saveMemory(e){return this.request(`POST`,`/api/memory/save`,e)}listMemoryDays(e,t){return this.request(`GET`,`/api/memory/days?scope=${e}&id=${encodeURIComponent(t)}`)}readMemoryDay(e,t,n){return this.request(`GET`,`/api/memory/day?scope=${e}&id=${encodeURIComponent(t)}&day=${encodeURIComponent(n)}`)}updateMemoryDay(e,t,n,r){return this.request(`PATCH`,`/api/memory/day?scope=${e}&id=${encodeURIComponent(t)}&day=${encodeURIComponent(n)}`,{content:r})}readMemorySummary(e,t){return this.request(`GET`,`/api/memory/summary?scope=${e}&id=${encodeURIComponent(t)}`)}readMemoryLessons(e){return this.request(`GET`,`/api/memory/lessons?gezelId=${encodeURIComponent(e)}`)}sessionEventsUrl(e){return`${this.baseUrl}/events/chat?session=${encodeURIComponent(e)}`}listProjectTimeline(e,t){let n=new URLSearchParams;t?.limit!=null&&n.set(`limit`,String(t.limit)),t?.before&&n.set(`before`,t.before),t?.gezelId&&n.set(`gezel`,t.gezelId),t?.taskRef&&n.set(`task`,t.taskRef);let r=n.toString()?`?${n.toString()}`:``;return this.request(`GET`,`/api/projects/${encodeURIComponent(e)}/timeline${r}`)}listGezelTimeline(e,t){let n=new URLSearchParams;t?.limit!=null&&n.set(`limit`,String(t.limit)),t?.before&&n.set(`before`,t.before),t?.projectId&&n.set(`project`,t.projectId);let r=n.toString()?`?${n.toString()}`:``;return this.request(`GET`,`/api/gezels/${encodeURIComponent(e)}/timeline${r}`)}listGlobalTimeline(e){let t=new URLSearchParams;e?.limit!=null&&t.set(`limit`,String(e.limit)),e?.before&&t.set(`before`,e.before);let n=t.toString()?`?${t.toString()}`:``;return this.request(`GET`,`/api/timeline${n}`)}projectEventsUrl(e){return`${this.baseUrl}/events/chat/project?project=${encodeURIComponent(e)}`}gezelEventsUrl(e){return`${this.baseUrl}/events/chat/gezel?gezel=${encodeURIComponent(e)}`}allEventsUrl(){return`${this.baseUrl}/events/chat/all`}listTerminalThreads(e){return this.request(`GET`,`/api/projects/${encodeURIComponent(e)}/terminals`)}getTerminalThread(e,t){return this.request(`GET`,`/api/projects/${encodeURIComponent(e)}/terminals/${encodeURIComponent(t)}`)}runTerminalCommand(e,t){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/terminals/run`,t)}deleteTerminalThread(e,t){return this.request(`DELETE`,`/api/projects/${encodeURIComponent(e)}/terminals/${encodeURIComponent(t)}`)}async cancelTerminalRun(e,t){try{await this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/terminals/runs/${encodeURIComponent(t)}/cancel`)}catch(e){if(e instanceof Error&&/\b404\b/.test(e.message))return;throw e}}sendTerminalInput(e,t,n){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/terminals/runs/${encodeURIComponent(t)}/input`,{text:n})}terminalEventsUrl(e){return`${this.baseUrl}/api/projects/${encodeURIComponent(e)}/terminals/events`}copilotLoginUrl(){return`${this.baseUrl}/api/system/copilot-login`}chatHistory(e,t=`default`){return this.request(`GET`,`/api/gezels/${encodeURIComponent(e)}/chat?project=${encodeURIComponent(t)}`)}sendChatMessage(e,t){return this.request(`POST`,`/api/gezels/${encodeURIComponent(e)}/chat/send`,t)}resetChat(e,t=`default`){return this.request(`POST`,`/api/gezels/${encodeURIComponent(e)}/chat/reset?project=${encodeURIComponent(t)}`)}chatEventsUrl(e,t=`default`){return`${this.baseUrl}/events/chat?gezel=${encodeURIComponent(e)}&project=${encodeURIComponent(t)}`}listProjects(e){return this.request(`GET`,`/api/projects${e?.rollup?`?rollup=1`:``}`)}listRemotes(){return this.request(`GET`,`/api/remotes`)}pairRemote(e){return this.request(`POST`,`/api/remotes/pair`,e)}inspectRemote(e){return this.request(`POST`,`/api/remotes/inspect`,e)}unpairRemote(e){return this.request(`DELETE`,`/api/remotes/${encodeURIComponent(e)}`)}getMachineServing(){return this.request(`GET`,`/api/machine-serving`)}updateMachineServing(e){return this.request(`PUT`,`/api/machine-serving`,e)}listMachineServingGrants(){return this.request(`GET`,`/api/machine-serving/grants`)}approveMachineServingGrant(e){return this.request(`POST`,`/api/machine-serving/grants/${encodeURIComponent(e)}/approve`)}denyMachineServingGrant(e){return this.request(`POST`,`/api/machine-serving/grants/${encodeURIComponent(e)}/deny`)}listMachineServingDevices(){return this.request(`GET`,`/api/machine-serving/devices`)}revokeMachineServingDevice(e){return this.request(`DELETE`,`/api/machine-serving/devices/${encodeURIComponent(e)}`)}listRemoteModels(e){return this.request(`GET`,`/api/remotes/${encodeURIComponent(e)}/models`)}createProject(e){return this.request(`POST`,`/api/projects`,e)}createTypedProject(e){return this.request(`POST`,`/api/projects/typed`,e)}getProject(e){return this.request(`GET`,`/api/projects/${encodeURIComponent(e)}`)}setProjectWorkingDir(e,t){return this.request(`PUT`,`/api/projects/${encodeURIComponent(e)}/working-dir`,{workingDir:t})}updateProject(e,t){return this.request(`PUT`,`/api/projects/${encodeURIComponent(e)}`,t)}deleteProject(e,t){let n=t?.removeWorkspace?`?removeWorkspace=1`:``;return this.request(`DELETE`,`/api/projects/${encodeURIComponent(e)}${n}`)}applyProjectType(e,t){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/apply-project-type`,t)}exportProjectType(e,t){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/project-types/export`,t)}importProjectType(e,t){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/project-types/import`,t)}listConnectorTypes(){return this.listCatalogItems(`connector-type`)}listConnectors(e){return this.request(`GET`,`/api/projects/${encodeURIComponent(e)}/connectors`)}bindConnector(e,t){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/connectors/bind`,t)}syncConnector(e,t){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/connectors/${encodeURIComponent(t)}/sync`,{})}unbindConnector(e,t){return this.request(`DELETE`,`/api/projects/${encodeURIComponent(e)}/connectors/${encodeURIComponent(t)}`)}startConnectorOAuth(e,t){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/connectors/oauth/start`,t)}completeConnectorOAuth(e,t){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/connectors/oauth/complete`,t)}listConnectorActions(e){return this.request(`GET`,`/api/projects/${encodeURIComponent(e)}/connectors/actions`)}queueConnectorAction(e,t){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/connectors/actions/${encodeURIComponent(t)}/queue`,{})}commitConnectorAction(e,t){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/connectors/actions/${encodeURIComponent(t)}/commit`,{})}discardConnectorAction(e,t){return this.request(`DELETE`,`/api/projects/${encodeURIComponent(e)}/connectors/actions/${encodeURIComponent(t)}`)}listProjectGezels(e){return this.request(`GET`,`/api/projects/${encodeURIComponent(e)}/gezels`)}addGezelToProject(e,t){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/gezels`,{gezelId:t})}removeGezelFromProject(e,t){return this.request(`DELETE`,`/api/projects/${encodeURIComponent(e)}/gezels/${encodeURIComponent(t)}`)}listHistory(e){let t=new URLSearchParams;e?.projectId&&t.set(`project`,e.projectId),e?.gezelId&&t.set(`gezel`,e.gezelId),e?.kind&&t.set(`kind`,e.kind),e?.from&&t.set(`from`,e.from),e?.to&&t.set(`to`,e.to),e?.q&&t.set(`q`,e.q),e?.limit!=null&&t.set(`limit`,String(e.limit));let n=t.toString()?`?${t.toString()}`:``;return this.request(`GET`,`/api/history${n}`)}searchSessions(e){let t=new URLSearchParams;return t.set(`q`,e.q),e.gezel&&t.set(`gezel`,e.gezel),e.project&&t.set(`project`,e.project),e.maxResults!=null&&t.set(`maxResults`,String(e.maxResults)),this.request(`GET`,`/api/sessions/search?${t.toString()}`)}searchDocuments(e){let t=new URLSearchParams;return t.set(`q`,e.q),e.maxResults!=null&&t.set(`maxResults`,String(e.maxResults)),this.request(`GET`,`/api/documents/search?${t.toString()}`)}revealProject(e,t=`artifacts`){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/reveal?which=${t}`)}resolveReferenceFileLocation(e,t){let n=new URLSearchParams({kind:t.kind,path:t.path});return this.request(`GET`,`/api/projects/${encodeURIComponent(e)}/reference-file-location?${n.toString()}`)}previewReference(e,t){let n=new URLSearchParams({kind:t.kind,path:t.path});return this.request(`GET`,`/api/projects/${encodeURIComponent(e)}/reference-preview?${n.toString()}`)}listProjectArtifacts(e,t,n){let r=new URLSearchParams;t&&r.set(`path`,t),n&&r.set(`recursive`,`1`);let i=r.toString()?`?${r.toString()}`:``;return this.request(`GET`,`/api/projects/${encodeURIComponent(e)}/artifacts${i}`)}readProjectArtifact(e,t){return this.request(`GET`,`/api/projects/${encodeURIComponent(e)}/artifacts/read?path=${encodeURIComponent(t)}`)}resolveProjectArtifact(e,t){return this.request(`GET`,`/api/projects/${encodeURIComponent(e)}/artifacts/resolve?path=${encodeURIComponent(t)}`)}readProjectArtifactSlice(e,t,n){let r=new URLSearchParams({path:t});return n?.lines?r.set(`lines`,`${n.lines.start},${n.lines.count}`):typeof n?.head==`number`?r.set(`head`,String(n.head)):typeof n?.tail==`number`&&r.set(`tail`,String(n.tail)),this.request(`GET`,`/api/projects/${encodeURIComponent(e)}/artifacts/slice?${r.toString()}`)}grepProjectArtifact(e,t){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/artifacts/grep`,t)}runPlaywrightScript(e,t){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/run-playwright`,t)}getSystemToolsetStatus(){return this.request(`GET`,`/api/system-toolsets/status`)}systemToolsetStatusStreamUrl(){return`${this.baseUrl}/api/system-toolsets/status/stream`}listSystemToolsetInstalls(){return this.request(`GET`,`/api/system-toolsets/installs`)}async installSystemToolset(e,t,n){await $({...Z,url:`${this.baseUrl}/api/system-toolsets/${encodeURIComponent(e)}/install`,method:`POST`,headers:{Authorization:`Bearer ${this.token}`},signal:n,fetch:this.fetchImpl,schema:Va,onEvent:t,isTerminal:e=>e.type===`done`||e.type===`error`,label:`System toolset install stream for "${e}"`})}cancelSystemToolsetInstall(e){return this.request(`DELETE`,`/api/system-toolsets/${encodeURIComponent(e)}/install`)}getCopilotStatus(){return this.request(`GET`,`/api/system/copilot-status`)}getMlxRuntimeStatus(){return this.request(`GET`,`/api/mlx/runtime/status`)}mlxRuntimeStatusStreamUrl(){return`${this.baseUrl}/api/mlx/runtime/status/stream`}writeProjectArtifact(e,t,n,r){return this.request(`PUT`,`/api/projects/${encodeURIComponent(e)}/artifacts/write`,{path:t,content:n,...r?.gezelId?{gezelId:r.gezelId}:{},...r?.sessionId?{sessionId:r.sessionId}:{}})}async writeProjectArtifactBinary(e,t,n,r,i){let a=i?.createOnly?`&create=1`:``,o=`${this.baseUrl}/api/projects/${encodeURIComponent(e)}/artifacts/raw?path=${encodeURIComponent(t)}${a}`,s=n instanceof Blob||n instanceof Uint8Array?n:new Uint8Array(n),c=await this.fetchImpl(o,{method:`PUT`,headers:{"content-type":r,Authorization:`Bearer ${this.token}`},body:s});if(!c.ok){let e=await c.text().catch(()=>``);throw Error(`artifact binary write failed (${c.status}): ${e}`)}return c.json()}renderImage(e){return this.request(`POST`,`/api/render/image`,e)}deleteProjectArtifact(e,t){return this.request(`DELETE`,`/api/projects/${encodeURIComponent(e)}/artifacts/delete?path=${encodeURIComponent(t)}`)}listProjectWorkspace(e,t,n){let r=new URLSearchParams;t&&r.set(`path`,t),n&&r.set(`recursive`,`1`);let i=r.toString()?`?${r.toString()}`:``;return this.request(`GET`,`/api/projects/${encodeURIComponent(e)}/workspace${i}`)}listProjectWorkspaceHtmlPages(e){return this.request(`GET`,`/api/projects/${encodeURIComponent(e)}/workspace/html-pages`)}readProjectWorkspaceFile(e,t){return this.request(`GET`,`/api/projects/${encodeURIComponent(e)}/workspace/read?path=${encodeURIComponent(t)}`)}statProjectWorkspacePath(e,t){return this.request(`GET`,`/api/projects/${encodeURIComponent(e)}/workspace/stat?path=${encodeURIComponent(t)}`)}writeProjectWorkspaceFile(e,t){return this.request(`PUT`,`/api/projects/${encodeURIComponent(e)}/workspace/file`,t)}async writeProjectWorkspaceBinary(e,t,n,r=`application/octet-stream`,i){let a=i?.createOnly?`&create=1`:``,o=`${this.baseUrl}/api/projects/${encodeURIComponent(e)}/workspace/raw?path=${encodeURIComponent(t)}${a}`,s=n instanceof Blob||n instanceof Uint8Array?n:new Uint8Array(n),c=await this.fetchImpl(o,{method:`PUT`,headers:{"content-type":r,Authorization:`Bearer ${this.token}`},body:s});if(!c.ok){let e=await c.text().catch(()=>``);throw Error(`workspace binary write failed (${c.status}): ${e}`)}return c.json()}copyArtifactToWorkspace(e,t){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/workspace/copy-from-artifact`,t)}fetchProjectRepo(e,t){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/workspace/fetch-repo`,t)}fetchProjectDiff(e,t){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/workspace/fetch-diff`,t)}replaceInProjectWorkspaceFile(e,t){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/workspace/replace`,t)}replaceLinesInProjectWorkspaceFile(e,t){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/workspace/replace-lines`,t)}applyPatchToProjectWorkspaceFile(e,t){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/workspace/patch`,t)}insertAtMarkerInProjectWorkspaceFile(e,t){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/workspace/insert-at-marker`,t)}rmProjectWorkspacePath(e,t,n={}){let r=new URLSearchParams;return r.set(`path`,t),n.recursive&&r.set(`recursive`,`1`),n.gezelId&&r.set(`gezelId`,n.gezelId),n.sessionId&&r.set(`sessionId`,n.sessionId),this.request(`DELETE`,`/api/projects/${encodeURIComponent(e)}/workspace/path?${r.toString()}`)}mkdirProjectWorkspace(e,t){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/workspace/mkdir`,t)}renameProjectWorkspacePath(e,t){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/workspace/rename`,t)}toolFetchUrl(e,t){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/tools/fetch-url`,t)}toolWebSearch(e,t){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/tools/web-search`,t)}toolWikipediaSearch(e,t){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/tools/wikipedia-search`,t)}toolSearchFiles(e,t){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/tools/search-files`,t)}toolReadWorkspaceFiles(e,t){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/tools/read-files`,t)}toolFindFiles(e,t){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/tools/find-files`,t)}toolOutlineFile(e,t){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/tools/outline-file`,t)}toolFileContext(e,t){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/tools/file-context`,t)}toolFileReview(e,t){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/tools/file-review`,t)}toolListFileIssues(e,t={}){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/tools/list-file-issues`,t)}getBoekwachterIssue(e,t){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/tools/get-file-issue`,t)}updateBoekwachterIssue(e,t){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/tools/update-file-issue`,t)}fixBoekwachterIssue(e,t){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/tools/fix-file-issue`,t)}toolFindSymbol(e,t){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/tools/find-symbol`,t)}toolReadSymbol(e,t){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/tools/read-symbol`,t)}toolFindReferences(e,t){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/tools/find-references`,t)}toolMapRepo(e,t){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/tools/map-repo`,t)}toolFileMap(e,t={}){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/tools/file-map`,t)}toolSearchDocs(e,t){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/tools/search-docs`,t)}toolSearchCode(e,t){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/tools/search-code`,t)}toolSecurityScan(e,t={}){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/tools/security-scan`,t)}toolScanFindings(e,t={}){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/tools/scan-findings`,t)}resolveSecurityFinding(e,t){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/tools/resolve-finding`,t)}delegateSecurityFinding(e,t){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/tools/delegate-finding`,t)}toolMapAttackSurface(e){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/tools/map-attack-surface`,{})}toolListDependencies(e){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/tools/list-dependencies`,{})}toolSecurityOverview(e){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/tools/security-overview`,{})}toolTraceTaint(e,t){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/tools/trace-taint`,t)}toolSearchImages(e,t){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/tools/search-images`,t)}toolFindSimilarImages(e,t){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/tools/find-similar-images`,t)}toolDescribeFolder(e,t){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/tools/describe-folder`,t)}toolFindEntity(e,t){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/tools/find-entity`,t)}toolListEntityMentions(e,t){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/tools/list-entity-mentions`,t)}reportSystemIdle(e){return this.request(`POST`,`/api/system/idle`,{idleSeconds:e})}getNightShiftPowerIntent(){return this.request(`GET`,`/api/night-shift/power-intent`)}toolReadDocAsMarkdown(e,t){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/tools/read-doc-as-markdown`,t)}toolDiffFiles(e,t){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/tools/diff-files`,t)}toolReadImageBase64(e,t){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/tools/read-image-base64`,t)}toolArchiveList(e,t){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/tools/archive/list`,t)}toolArchiveExtract(e,t){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/tools/archive/extract`,t)}toolRunGit(e,t){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/tools/git`,t)}npmInstall(e,t){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/npm-install`,t)}runNodejsScript(e,t){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/run-nodejs-script`,t)}deriveFile(e,t){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/derive-file`,t)}listPackageScripts(e){return this.request(`GET`,`/api/projects/${encodeURIComponent(e)}/package-scripts`)}runPackageScript(e,t){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/run-package-script`,t)}runNpx(e,t){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/run-npx`,t)}listWorkspaceWrites(e,t){let n=t?`?limit=${encodeURIComponent(String(t))}`:``;return this.request(`GET`,`/api/projects/${encodeURIComponent(e)}/workspace/writes${n}`)}installPackage(e,t){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/install`,t)}getProjectApprovals(e){return this.request(`GET`,`/api/projects/${encodeURIComponent(e)}/approvals`)}getProjectGitStatus(e){return this.request(`GET`,`/api/projects/${encodeURIComponent(e)}/git/status`)}cloneProjectGit(e){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/git/clone`)}pullProjectGit(e){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/git/pull`)}setProjectGitBranch(e,t){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/git/branch`,{branch:t})}createProjectGitBranch(e,t){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/git/branch`,{branch:t,create:!0})}listProjectGitBranches(e){return this.request(`GET`,`/api/projects/${encodeURIComponent(e)}/git/branches`)}fetchProjectGit(e){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/git/fetch`)}commitProjectGit(e,t){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/git/commit`,{message:t})}pushProjectGit(e){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/git/push`)}getProjectGitChanges(e){return this.request(`GET`,`/api/projects/${encodeURIComponent(e)}/git/changes`)}getProjectGitFileDiff(e,t){return this.request(`GET`,`/api/projects/${encodeURIComponent(e)}/git/changes/diff?path=${encodeURIComponent(t)}`)}discardProjectGitChanges(e,t){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/git/discard`,t)}getProjectGitLog(e,t={}){let n=new URLSearchParams;t.limit!==void 0&&n.set(`limit`,String(t.limit)),t.skip!==void 0&&n.set(`skip`,String(t.skip));let r=n.toString();return this.request(`GET`,`/api/projects/${encodeURIComponent(e)}/git/log${r?`?${r}`:``}`)}getProjectGitCommit(e,t){return this.request(`GET`,`/api/projects/${encodeURIComponent(e)}/git/log/${encodeURIComponent(t)}`)}syncProjectGit(e){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/git/sync`)}getProjectGitMergeState(e){return this.request(`GET`,`/api/projects/${encodeURIComponent(e)}/git/merge`)}getProjectGitConflictVersions(e,t){return this.request(`GET`,`/api/projects/${encodeURIComponent(e)}/git/merge/file?path=${encodeURIComponent(t)}`)}resolveProjectGitConflict(e,t){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/git/merge/resolve`,t)}completeProjectGitMerge(e,t){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/git/merge/complete`,t?{message:t}:{})}abandonProjectGitMerge(e){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/git/merge/abandon`)}suggestProjectGitMessage(e){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/git/ai/suggest-message`)}aiResolveProjectGitConflict(e,t){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/git/ai/merge`,{path:t})}getProjectIndex(e){return this.request(`GET`,`/api/projects/${encodeURIComponent(e)}/index`)}getProjectIndexStatus(e){return this.request(`GET`,`/api/projects/${encodeURIComponent(e)}/index/status`)}refreshProjectIndex(e){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/index/refresh`)}driveIndexEnrichment(e,t={}){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/index/enrich`,t)}getProjectSkills(e){return this.request(`GET`,`/api/projects/${encodeURIComponent(e)}/index/skills`)}listProjectGitFiles(e){return this.request(`GET`,`/api/projects/${encodeURIComponent(e)}/git/files`)}readProjectGitFile(e,t){return this.request(`GET`,`/api/projects/${encodeURIComponent(e)}/git/files/read?path=${encodeURIComponent(t)}`)}startProjectCodeReview(e,t){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/git/reviews`,t)}listProjectCodeReviews(e){return this.request(`GET`,`/api/projects/${encodeURIComponent(e)}/git/reviews`)}getProjectCodeReview(e,t){return this.request(`GET`,`/api/projects/${encodeURIComponent(e)}/git/reviews/${encodeURIComponent(t)}`)}cancelProjectCodeReview(e,t){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/git/reviews/${encodeURIComponent(t)}/cancel`)}listProjectGitHubPulls(e){return this.request(`GET`,`/api/projects/${encodeURIComponent(e)}/github/prs`)}getProjectGitHubPull(e,t){return this.request(`GET`,`/api/projects/${encodeURIComponent(e)}/github/prs/${t}`)}listProjectGitHubPullFiles(e,t){return this.request(`GET`,`/api/projects/${encodeURIComponent(e)}/github/prs/${t}/files`)}listProjectGitHubPullComments(e,t){return this.request(`GET`,`/api/projects/${encodeURIComponent(e)}/github/prs/${t}/comments`)}getProjectGitHubPullDiff(e,t){return this.request(`GET`,`/api/projects/${encodeURIComponent(e)}/github/prs/${t}/diff`)}createProjectGitHubPullComment(e,t,n){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/github/prs/${t}/comments`,{body:n})}createProjectGitHubPullRequest(e,t){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/github/prs`,t)}listProjectGitHubWorkflowRuns(e,t,n){let r=new URLSearchParams({branch:t});return n!==void 0&&r.set(`limit`,String(n)),this.request(`GET`,`/api/projects/${encodeURIComponent(e)}/github/workflow-runs?${r.toString()}`)}getProjectGitHubChecks(e,t){return this.request(`GET`,`/api/projects/${encodeURIComponent(e)}/github/checks?ref=${encodeURIComponent(t)}`)}search(e,t={}){let{signal:n,...r}=t;return this.request(`POST`,`/api/search`,{query:e,...r},void 0,n)}quickOpen(e,t={}){let n=new URLSearchParams({q:e});return t.limit&&n.set(`limit`,String(t.limit)),this.request(`GET`,`/api/search/quick?${n.toString()}`,void 0,void 0,t.signal)}getHandboekToc(){return this.request(`GET`,`/api/handboek/toc`)}getHandboekArticle(e,t={}){let n=t.mode?`?mode=${t.mode}`:``,r=e.split(`/`).map(encodeURIComponent).join(`/`);return this.request(`GET`,`/api/handboek/article/${r}${n}`)}getHandboekNarration(e,t={}){let n=t.voice?`?voice=${encodeURIComponent(t.voice)}`:``,r=e.split(`/`).map(encodeURIComponent).join(`/`);return this.request(`GET`,`/api/handboek/narration/article/${r}${n}`)}handboekHowDoI(e,t={}){let n=new URLSearchParams({q:e});return t.limit&&n.set(`limit`,String(t.limit)),this.request(`GET`,`/api/handboek/how-do-i?${n.toString()}`)}async fetchHandboekNarrationAudio(e){let t=`${this.baseUrl}/api/handboek/narration/audio/${e}`,n=await this.fetchImpl(t,{headers:{Authorization:`Bearer ${this.token}`}});if(!n.ok)throw Error(`narration fetch failed: ${n.status}`);return n.blob()}listDocuments(e,t){let n=new URLSearchParams;e&&n.set(`path`,e),t&&n.set(`recursive`,`1`);let r=n.toString()?`?${n.toString()}`:``;return this.request(`GET`,`/api/documents${r}`)}readDocument(e){return this.request(`GET`,`/api/documents/read?path=${encodeURIComponent(e)}`)}writeDocument(e,t){return this.request(`PUT`,`/api/documents/write`,{path:e,content:t})}async writeDocumentBinary(e,t,n){let r=`${this.baseUrl}/api/documents/raw?path=${encodeURIComponent(e)}`,i=t instanceof Blob||t instanceof Uint8Array?t:new Uint8Array(t),a=await this.fetchImpl(r,{method:`PUT`,headers:{"content-type":n,Authorization:`Bearer ${this.token}`},body:i});if(!a.ok){let e=await a.text().catch(()=>``);throw Error(`document binary write failed (${a.status}): ${e}`)}return a.json()}async fetchDocumentBlob(e){let t=`${this.baseUrl}/api/documents/read?path=${encodeURIComponent(e)}&raw=1`,n=await this.fetchImpl(t,{headers:{Authorization:`Bearer ${this.token}`}});if(!n.ok)throw Error(`document fetch failed: ${n.status}`);return n.blob()}async exportDocumentMedia(e,t){let n=`${this.baseUrl}/api/document-media-export`,r=await this.fetchImpl(n,{method:`POST`,headers:{"content-type":`application/json`,Authorization:`Bearer ${this.token}`},body:JSON.stringify(e),signal:t});if(!r.ok){let e=`document media export failed (${r.status})`,t=await r.json().then(t=>t&&typeof t==`object`&&`error`in t&&typeof t.error==`string`?t.error:e).catch(()=>e);throw Error(t)}return r.blob()}deleteDocument(e){return this.request(`DELETE`,`/api/documents/delete?path=${encodeURIComponent(e)}`)}createDocumentFolder(e){return this.request(`POST`,`/api/documents/mkdir`,{path:e})}renameDocument(e,t){return this.request(`POST`,`/api/documents/rename`,{fromPath:e,toPath:t})}continueProject(e){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/continue`)}listTasks(e){let t=new URLSearchParams;e?.status&&t.set(`status`,e.status),e?.assignee&&t.set(`assignee`,e.assignee);let n=t.toString()?`?${t.toString()}`:``;return this.request(`GET`,`/api/tasks${n}`)}listProjectTasks(e,t){let n=new URLSearchParams;t?.status&&n.set(`status`,t.status),t?.assignee&&n.set(`assignee`,t.assignee);let r=n.toString()?`?${n.toString()}`:``;return this.request(`GET`,`/api/projects/${encodeURIComponent(e)}/tasks${r}`)}createTask(e,t){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/tasks`,t)}getTask(e,t){return this.request(`GET`,`/api/projects/${encodeURIComponent(e)}/tasks/${t}`)}getTaskByRef(e){let t=te(e);return t?this.getTask(t.projectId,t.num):Promise.reject(Error(`invalid task ref "${e}"`))}updateTask(e,t,n){return this.request(`PATCH`,`/api/projects/${encodeURIComponent(e)}/tasks/${t}`,n)}setTaskStatus(e,t,n){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/tasks/${t}/status`,{status:n})}activateTask(e,t,n=!1){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/tasks/${t}/activate`,n?{force:!0}:{})}setTaskAssignee(e,t,n){return this.updateTask(e,t,{assignee:n})}addTaskStep(e,t,n,r){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/tasks/${t}/steps`,{...n,...r??{}})}activateTaskStep(e,t,n){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/tasks/${t}/steps/${encodeURIComponent(n)}/activate`)}completeTaskStep(e,t,n,r={}){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/tasks/${t}/steps/${encodeURIComponent(n)}/complete`,r)}updateTaskStep(e,t,n,r){return this.request(`PATCH`,`/api/projects/${encodeURIComponent(e)}/tasks/${t}/steps/${encodeURIComponent(n)}`,r)}removeTaskStep(e,t,n){return this.request(`DELETE`,`/api/projects/${encodeURIComponent(e)}/tasks/${t}/steps/${encodeURIComponent(n)}`)}reorderTaskSteps(e,t,n){return this.request(`PATCH`,`/api/projects/${encodeURIComponent(e)}/tasks/${t}/craftbook/steps/order`,{order:n})}updateTaskCraftbook(e,t,n){return this.request(`PATCH`,`/api/projects/${encodeURIComponent(e)}/tasks/${t}/craftbook`,n)}exportTaskCraftbook(e,t,n={}){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/tasks/${t}/export-craftbook`,n)}listTaskNotes(e,t,n){let r=n?`?step=${encodeURIComponent(n)}`:``;return this.request(`GET`,`/api/projects/${encodeURIComponent(e)}/tasks/${t}/notes${r}`)}appendTaskNote(e,t,n,r={}){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/tasks/${t}/notes`,n,r.actorGezelId?{"x-gezel-actor":r.actorGezelId}:void 0)}updateTaskNote(e,t,n,r,i={}){return this.request(`PATCH`,`/api/projects/${encodeURIComponent(e)}/tasks/${t}/notes/${encodeURIComponent(n)}`,r,i.actorGezelId?{"x-gezel-actor":i.actorGezelId}:void 0)}deleteTaskNote(e,t,n,r={}){return this.request(`DELETE`,`/api/projects/${encodeURIComponent(e)}/tasks/${t}/notes/${encodeURIComponent(n)}`,void 0,r.actorGezelId?{"x-gezel-actor":r.actorGezelId}:void 0)}listProjectScripts(e){return this.request(`GET`,`/api/projects/${encodeURIComponent(e)}/scripts`)}runProjectScript(e,t){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/scripts/run`,t)}invokeProjectPageTool(e,t){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/page-invoke`,t)}invokeProjectPageRead(e,t){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/page-read`,t)}getProjectScriptRun(e,t){return this.request(`GET`,`/api/projects/${encodeURIComponent(e)}/script-runs/${encodeURIComponent(t)}`)}getProjectScriptSource(e,t){return this.request(`GET`,`/api/projects/${encodeURIComponent(e)}/scripts/source?name=${encodeURIComponent(t)}`)}saveProjectScriptSource(e,t){return this.request(`PUT`,`/api/projects/${encodeURIComponent(e)}/scripts/source`,t)}createProjectScript(e,t){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/scripts`,t)}draftProjectScript(e,t){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/scripts/draft`,t)}deleteProjectScript(e,t){return this.request(`DELETE`,`/api/projects/${encodeURIComponent(e)}/scripts/source?name=${encodeURIComponent(t)}`)}getSdkTypes(){return this.request(`GET`,`/api/sdk/types`)}listStandardScripts(){return this.request(`GET`,`/api/scripts/standard`)}getStandardScriptSource(e){return this.request(`GET`,`/api/scripts/standard/source?name=${encodeURIComponent(e)}`)}listUserScripts(){return this.request(`GET`,`/api/scripts/user`)}getUserScriptSource(e){return this.request(`GET`,`/api/scripts/user/source?name=${encodeURIComponent(e)}`)}saveUserScriptSource(e){return this.request(`PUT`,`/api/scripts/user/source`,e)}createUserScript(e){return this.request(`POST`,`/api/scripts/user`,e)}deleteUserScript(e){return this.request(`DELETE`,`/api/scripts/user/source?name=${encodeURIComponent(e)}`)}listAvailableCredentials(){return this.request(`GET`,`/api/credentials/available`)}listTaskSessions(e,t){return this.request(`GET`,`/api/projects/${encodeURIComponent(e)}/tasks/${t}/sessions`)}listTaskChildren(e,t,n){let r=new URLSearchParams;n?.status&&r.set(`status`,n.status),n?.limit&&r.set(`limit`,String(n.limit));let i=r.toString()?`?${r.toString()}`:``;return this.request(`GET`,`/api/projects/${encodeURIComponent(e)}/tasks/${t}/children${i}`)}spawnTaskInstances(e,t,n={}){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/tasks/${t}/spawn`,n)}authHeader(){return{Authorization:`Bearer ${this.token}`}}getBaseUrl(){return this.baseUrl}getFetch(){return this.fetchImpl}listCraftbooks(e={}){let t=[];e.source&&t.push(`source=${e.source}`),e.projectId&&t.push(`projectId=${encodeURIComponent(e.projectId)}`);let n=t.length?`?${t.join(`&`)}`:``;return this.request(`GET`,`/api/craftbooks${n}`)}getCraftbook(e,t={}){let n=[];t.version&&n.push(`version=${encodeURIComponent(t.version)}`),t.source&&n.push(`source=${t.source}`),t.projectId&&n.push(`projectId=${encodeURIComponent(t.projectId)}`);let r=n.length?`?${n.join(`&`)}`:``;return this.request(`GET`,`/api/craftbooks/${encodeURIComponent(e)}${r}`)}suggestCraftbooks(e){return this.request(`POST`,`/api/craftbooks/suggest`,e)}getCraftbookDocument(e,t={}){let n=[];t.format&&n.push(`format=${t.format}`),t.version&&n.push(`version=${encodeURIComponent(t.version)}`),t.source&&n.push(`source=${t.source}`),t.projectId&&n.push(`projectId=${encodeURIComponent(t.projectId)}`);let r=n.length?`?${n.join(`&`)}`:``;return this.request(`GET`,`/api/craftbooks/${encodeURIComponent(e)}/document${r}`)}createCraftbookDocument(e){return this.request(`POST`,`/api/craftbooks/document`,e)}putCraftbookDocument(e,t){return this.request(`PUT`,`/api/craftbooks/${encodeURIComponent(e)}/document`,t)}getTaskCraftbookDocument(e,t,n={}){let r=n.format?`?format=${n.format}`:``;return this.request(`GET`,`/api/projects/${encodeURIComponent(e)}/tasks/${t}/craftbook/document${r}`)}putTaskCraftbookDocument(e,t,n){return this.request(`PUT`,`/api/projects/${encodeURIComponent(e)}/tasks/${t}/craftbook/document`,n)}listProjectLocalGezels(e){return this.request(`GET`,`/api/projects/${encodeURIComponent(e)}/local-gezels`)}getProjectLocalGezel(e,t){return this.request(`GET`,`/api/projects/${encodeURIComponent(e)}/local-gezels/${encodeURIComponent(t)}`)}createProjectLocalGezel(e,t){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/local-gezels`,t)}deleteProjectLocalGezel(e,t){return this.request(`DELETE`,`/api/projects/${encodeURIComponent(e)}/local-gezels/${encodeURIComponent(t)}`)}copyGezelToProject(e,t){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/local-gezels/copy`,t)}getProjectImportsPending(e){return this.request(`GET`,`/api/projects/${encodeURIComponent(e)}/imports/pending`)}approveProjectImport(e,t){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/imports/approve`,{skillSource:t})}rejectProjectImport(e,t){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/imports/reject`,{skillSource:t})}convertProjectImport(e,t,n){return this.request(`POST`,`/api/projects/${encodeURIComponent(e)}/imports/convert`,{skillSource:t,...n?.allowLlm===void 0?{}:{allowLlm:n.allowLlm}})}createCraftbook(e){return this.request(`POST`,`/api/craftbooks`,e)}updateCraftbook(e,t){return this.request(`PATCH`,`/api/craftbooks/${encodeURIComponent(e)}`,t)}deleteCraftbook(e){return this.request(`DELETE`,`/api/craftbooks/${encodeURIComponent(e)}`)}listCraftbookScripts(e){return this.request(`GET`,`/api/craftbooks/${encodeURIComponent(e)}/scripts`)}getCraftbookScriptSource(e,t){return this.request(`GET`,`/api/craftbooks/${encodeURIComponent(e)}/scripts/source?name=${encodeURIComponent(t)}`)}saveCraftbookScriptSource(e,t){return this.request(`PUT`,`/api/craftbooks/${encodeURIComponent(e)}/scripts/source`,t)}createCraftbookScript(e,t){return this.request(`POST`,`/api/craftbooks/${encodeURIComponent(e)}/scripts`,t)}deleteCraftbookScript(e,t){return this.request(`DELETE`,`/api/craftbooks/${encodeURIComponent(e)}/scripts/source?name=${encodeURIComponent(t)}`)}getProjectGithubStatus(...e){return this.getProjectGitStatus(...e)}cloneProjectGithub(...e){return this.cloneProjectGit(...e)}pullProjectGithub(...e){return this.pullProjectGit(...e)}setProjectGithubBranch(...e){return this.setProjectGitBranch(...e)}createProjectGithubBranch(...e){return this.createProjectGitBranch(...e)}listProjectGithubBranches(...e){return this.listProjectGitBranches(...e)}fetchProjectGithub(...e){return this.fetchProjectGit(...e)}commitProjectGithub(...e){return this.commitProjectGit(...e)}pushProjectGithub(...e){return this.pushProjectGit(...e)}getProjectGithubChanges(...e){return this.getProjectGitChanges(...e)}getProjectGithubFileDiff(...e){return this.getProjectGitFileDiff(...e)}discardProjectGithubChanges(...e){return this.discardProjectGitChanges(...e)}getProjectGithubLog(...e){return this.getProjectGitLog(...e)}getProjectGithubCommit(...e){return this.getProjectGitCommit(...e)}syncProjectGithub(...e){return this.syncProjectGit(...e)}getProjectGithubMergeState(...e){return this.getProjectGitMergeState(...e)}getProjectGithubConflictVersions(...e){return this.getProjectGitConflictVersions(...e)}resolveProjectGithubConflict(...e){return this.resolveProjectGitConflict(...e)}completeProjectGithubMerge(...e){return this.completeProjectGitMerge(...e)}abandonProjectGithubMerge(...e){return this.abandonProjectGitMerge(...e)}suggestProjectGithubMessage(...e){return this.suggestProjectGitMessage(...e)}aiResolveProjectGithubConflict(...e){return this.aiResolveProjectGitConflict(...e)}listProjectGithubFiles(...e){return this.listProjectGitFiles(...e)}readProjectGithubFile(...e){return this.readProjectGitFile(...e)}listProjectGithubPulls(...e){return this.listProjectGitHubPulls(...e)}getProjectGithubPull(...e){return this.getProjectGitHubPull(...e)}listProjectGithubPullFiles(...e){return this.listProjectGitHubPullFiles(...e)}listProjectGithubPullComments(...e){return this.listProjectGitHubPullComments(...e)}getProjectGithubPullDiff(...e){return this.getProjectGitHubPullDiff(...e)}createProjectGithubPullComment(...e){return this.createProjectGitHubPullComment(...e)}createProjectGithubPullRequest(...e){return this.createProjectGitHubPullRequest(...e)}listProjectGithubWorkflowRuns(...e){return this.listProjectGitHubWorkflowRuns(...e)}getProjectGithubChecks(...e){return this.getProjectGitHubChecks(...e)}startGithubLogin(...e){return this.startGitHubLogin(...e)}pollGithubLogin(...e){return this.pollGitHubLogin(...e)}getGithubIdentity(...e){return this.getGitHubIdentity(...e)}listGithubRepos(...e){return this.listGitHubRepos(...e)}previewGithubRepo(...e){return this.previewGitHubRepo(...e)}githubLogout(...e){return this.gitHubLogout(...e)}};function js(e){return e.kind===`shared`?`scope=shared`:e.kind===`system`?`scope=system`:e.kind===`project`?`scope=project&project=${encodeURIComponent(e.projectId)}`:`scope=gezel&gezel=${encodeURIComponent(e.gezelId)}`}export{gs as a,_s as c,vs as i,bs as l,As as n,Ss as o,cs as r,xs as s,Q as t};