@wjarka/cezarion 0.14.4 → 0.14.5

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 (59) hide show
  1. package/README.md +4 -1
  2. package/dist/automations/types.d.ts +2 -0
  3. package/dist/contract/automations.d.ts +8 -0
  4. package/dist/contract/index.js +4 -0
  5. package/dist/contract/runs.d.ts +10 -2
  6. package/dist/contract/skills.d.ts +1 -0
  7. package/dist/contract/workflows.d.ts +6 -0
  8. package/dist/delegation/cli.js +60 -1
  9. package/dist/delegation/cli.js.map +1 -1
  10. package/dist/index.js +1 -0
  11. package/dist/index.js.map +1 -1
  12. package/dist/runs/store.d.ts +1 -0
  13. package/dist/server/server.d.ts +72 -0
  14. package/dist/server/server.js +6 -5
  15. package/dist/server/server.js.map +1 -1
  16. package/dist/workflows/run.d.ts +4 -0
  17. package/dist/workflows/run.js +64 -19
  18. package/dist/workflows/run.js.map +1 -1
  19. package/dist/workflows/types.d.ts +3 -0
  20. package/dist/workflows/types.js +2 -1
  21. package/dist/workflows/types.js.map +1 -1
  22. package/package.json +3 -3
  23. package/web/dist/assets/{agent-accounts-BxBsIXGa.js → agent-accounts-4EqNShyp.js} +1 -1
  24. package/web/dist/assets/{alert-dialog-BOp2HnnL.js → alert-dialog-CVF_qvQ8.js} +1 -1
  25. package/web/dist/assets/{collapsible-bb0csfMs.js → collapsible-DVDGHZAE.js} +1 -1
  26. package/web/dist/assets/{commit-list-DOWYQ7G6.js → commit-list-BuNsBn8P.js} +1 -1
  27. package/web/dist/assets/{compare-variants-B1XteHt-.js → compare-variants-BnQ1O8Ix.js} +1 -1
  28. package/web/dist/assets/{diff-BjLZHKfD2.js → diff-DWmKlqw52.js} +2 -2
  29. package/web/dist/assets/{diff-controls-DaO836o4.js → diff-controls-CuqRa-63.js} +1 -1
  30. package/web/dist/assets/{diff-stat-DpHwISUB.js → diff-stat-BXriPIds.js} +1 -1
  31. package/web/dist/assets/{diff-view-BaYxuP8L.js → diff-view-DLPDcgEV.js} +1 -1
  32. package/web/dist/assets/{dropdown-menu-DAmCVaLJ.js → dropdown-menu-IsTcumXE.js} +1 -1
  33. package/web/dist/assets/{git-toolbar-rk3doc2w.js → git-toolbar-BjMzETip.js} +1 -1
  34. package/web/dist/assets/{github-BhnijVvD.js → github-BvowTAuy.js} +1 -1
  35. package/web/dist/assets/{image-preview-CFHgISfb.js → image-preview-WXKTY8KT.js} +1 -1
  36. package/web/dist/assets/index-Cz3N9b18.js +7 -0
  37. package/web/dist/assets/{markdown-Ir62-VMS.js → markdown-gFxX4dDH.js} +1 -1
  38. package/web/dist/assets/pill-BlaWNkHk.js +1 -0
  39. package/web/dist/assets/{project-router-CvFAMDcP.js → project-router-CX1jLqj-.js} +1 -1
  40. package/web/dist/assets/{prompt-templates-BGGpAIzb.js → prompt-templates-DwdQcfSc.js} +1 -1
  41. package/web/dist/assets/{repo-git-QEHH7y-w.js → repo-git-DnbE8dR5.js} +1 -1
  42. package/web/dist/assets/{run-diff-DrQsmf3-.js → run-diff-Mfc85irR.js} +1 -1
  43. package/web/dist/assets/run-header-CDO3LV4z.js +1 -0
  44. package/web/dist/assets/{skills-DOT1odMt.js → skills-DHfsyXTQ.js} +1 -1
  45. package/web/dist/assets/{tab-link-CkIV8ixq.js → tab-link-DhREnUYE.js} +1 -1
  46. package/web/dist/assets/{task-changes-CUQTi97I.js → task-changes-Cfo-vtEl.js} +1 -1
  47. package/web/dist/assets/{task-commits-D_N8-awD.js → task-commits-CvK4flXT.js} +1 -1
  48. package/web/dist/assets/{task-files-CfYcMt07.js → task-files-BwVGUObK.js} +1 -1
  49. package/web/dist/assets/{task-thread-Bnd_Pc07.js → task-thread-g1vc4tKn.js} +6 -6
  50. package/web/dist/assets/{textarea-DfvlPIgO.js → textarea-DCP8bOOf.js} +1 -1
  51. package/web/dist/assets/{thread-loading-B0WsjYr0.js → thread-loading-D9DbIsIS.js} +1 -1
  52. package/web/dist/assets/{token-metrics-BLzFUb8F.js → token-metrics-PSnNTJZF.js} +1 -1
  53. package/web/dist/assets/{utils-GZNjgma4.js → utils-DNvmfH6b.js} +1 -1
  54. package/web/dist/assets/{workflows-C1I-xV9B.js → workflows-BDdUJIFT.js} +3 -3
  55. package/web/dist/assets/{zoomable-image-COhBxkky.js → zoomable-image-yNqiuVu7.js} +1 -1
  56. package/web/dist/index.html +13 -13
  57. package/web/dist/assets/index-DTsigc4h.js +0 -7
  58. package/web/dist/assets/pill-BoBISMI9.js +0 -1
  59. package/web/dist/assets/run-header-BKeByMek.js +0 -1
@@ -680,6 +680,10 @@ export declare class RunManager {
680
680
  /** A settled-but-uncollected result is work for the parent, not a live worker.
681
681
  * Keep the private termination proof: a public terminal status can precede exit. */
682
682
  private hasLiveWorkers;
683
+ private delegationFinishBlockedReason;
684
+ /** The read-only verdict and explicit Finish share this decision. Operational failures
685
+ * (for example a failed durable write) are still handled at execution time. */
686
+ private finishDecision;
683
687
  finishBlockedReason(runId: string): string | undefined;
684
688
  /** One durable automatic worker wait per cycle. Further premature DONEs with
685
689
  * live workers use the existing capped monitoring wakes; settled uncollected
@@ -2331,7 +2331,7 @@ export class RunManager {
2331
2331
  return blocker.reason === 'outstanding' && worker?.role === 'worker' && worker.parentRunId === runId;
2332
2332
  });
2333
2333
  }
2334
- finishBlockedReason(runId) {
2334
+ delegationFinishBlockedReason(runId) {
2335
2335
  const parent = this.store.getRun(runId);
2336
2336
  if (parent?.delegation?.role !== 'root')
2337
2337
  return undefined;
@@ -2340,6 +2340,30 @@ export class RunManager {
2340
2340
  const blockers = this.parentCompletionBlockers(runId);
2341
2341
  return blockers.length ? `Workers must finish or be stopped, prove termination, and have their latest results collected before finishing: ${blockers.map(b => `${b.workerId} (${b.reason})`).join(', ')}` : undefined;
2342
2342
  }
2343
+ /** The read-only verdict and explicit Finish share this decision. Operational failures
2344
+ * (for example a failed durable write) are still handled at execution time. */
2345
+ finishDecision(runId) {
2346
+ const blocked = this.delegationFinishBlockedReason(runId);
2347
+ if (blocked)
2348
+ return { reason: blocked, warn: true };
2349
+ if (this.active.get(runId)?.session?.open)
2350
+ return { action: 'session' };
2351
+ const run = this.store.getRun(runId);
2352
+ if (run?.status === 'waiting' && !hasRegisteredRunProcess(runId) && !this.isActive(runId) &&
2353
+ (run.delegation?.role === 'root' || run.delegation === undefined)) {
2354
+ if (this.waitingBeforeFinalWorkflowStep(run)) {
2355
+ return { reason: 'Continue the remaining workflow steps before finishing.' };
2356
+ }
2357
+ return { action: run.delegation?.role === 'root' ? 'root' : 'waiting' };
2358
+ }
2359
+ if (run?.status === 'review' && !this.isActive(runId))
2360
+ return { action: 'review' };
2361
+ return { reason: 'no open session' };
2362
+ }
2363
+ finishBlockedReason(runId) {
2364
+ const decision = this.finishDecision(runId);
2365
+ return 'reason' in decision ? decision.reason : undefined;
2366
+ }
2343
2367
  /** One durable automatic worker wait per cycle. Further premature DONEs with
2344
2368
  * live workers use the existing capped monitoring wakes; settled uncollected
2345
2369
  * results retain attention. Human input starts a fresh completion cycle. */
@@ -3137,13 +3161,14 @@ export class RunManager {
3137
3161
  * over), "Finish" is the third review exit: accept the changes without a
3138
3162
  * PR and flip straight to `done`. */
3139
3163
  finish(runId) {
3140
- const state = this.active.get(runId);
3141
- const blocked = this.finishBlockedReason(runId);
3142
- if (blocked) {
3143
- this.store.appendEvent(runId, { type: 'note', tone: 'warning', message: blocked });
3164
+ const decision = this.finishDecision(runId);
3165
+ if ('reason' in decision) {
3166
+ if (decision.warn)
3167
+ this.store.appendEvent(runId, { type: 'note', tone: 'warning', message: decision.reason });
3144
3168
  return false;
3145
3169
  }
3146
- if (state?.session?.open) {
3170
+ const state = this.active.get(runId);
3171
+ if (decision.action === 'session' && state?.session) {
3147
3172
  try {
3148
3173
  this.withdrawWorkerWait(runId);
3149
3174
  }
@@ -3157,8 +3182,7 @@ export class RunManager {
3157
3182
  return true;
3158
3183
  }
3159
3184
  const run = this.store.getRun(runId);
3160
- if (run?.status === 'waiting' && !hasRegisteredRunProcess(runId) && run.delegation?.role === 'root' && !this.isActive(runId) &&
3161
- !this.waitingBeforeFinalWorkflowStep(run)) {
3185
+ if (decision.action === 'root') {
3162
3186
  try {
3163
3187
  this.store.commitRootFinishIntent(runId);
3164
3188
  }
@@ -3168,8 +3192,7 @@ export class RunManager {
3168
3192
  void this.settleRequestedRootFinish(runId);
3169
3193
  return true;
3170
3194
  }
3171
- if (run?.status === 'waiting' && !hasRegisteredRunProcess(runId) && run.delegation === undefined && !this.isActive(runId) &&
3172
- !this.waitingBeforeFinalWorkflowStep(run)) {
3195
+ if (decision.action === 'waiting' && run) {
3173
3196
  const finishedAt = new Date().toISOString();
3174
3197
  for (const step of run.steps) {
3175
3198
  if (step.status === 'waiting' || step.status === 'running') {
@@ -3179,7 +3202,7 @@ export class RunManager {
3179
3202
  void this.settleSuccess(runId);
3180
3203
  return true;
3181
3204
  }
3182
- if (run?.status === 'review' && !this.isActive(runId)) {
3205
+ if (decision.action === 'review') {
3183
3206
  this.store.updateRun(runId, { status: 'done' });
3184
3207
  this.store.appendEvent(runId, { type: 'lifecycle', message: 'review accepted — finished without a PR' });
3185
3208
  return true;
@@ -3840,6 +3863,21 @@ export class RunManager {
3840
3863
  const grants = this.workerIdentity(runId)?.grants ?? {
3841
3864
  allowedTools: allowedToolsForStep(toolsStep, continueBackend), bashAllowlist: toolsStep?.bashAllowlist,
3842
3865
  };
3866
+ let continueEffort;
3867
+ try {
3868
+ const modelsLocked = agentModelsLocked(this.repoRoot);
3869
+ const authoredStepEffort = toolsStep?.effort !== undefined;
3870
+ if (modelsLocked && toolsStep?.effort?.trim())
3871
+ throw new Error(AGENT_MODELS_LOCKED_ERROR);
3872
+ const stepEffort = parseDelegationEffort(toolsStep?.effort);
3873
+ continueEffort = modelsLocked
3874
+ ? undefined
3875
+ : authoredStepEffort ? stepEffort : record?.effort;
3876
+ }
3877
+ catch (err) {
3878
+ failBeforeSpawn(err instanceof Error ? err.message : String(err));
3879
+ return;
3880
+ }
3843
3881
  // The temp-directory preflight (#785) rides along with the account resolution: a resumed
3844
3882
  // turn hits the same broken `/tmp` a fresh one would, and an agent whose shell silently
3845
3883
  // returns nothing is worse than a turn that refuses to start and says why.
@@ -3867,7 +3905,7 @@ export class RunManager {
3867
3905
  return;
3868
3906
  this.store.updateStep(runId, stepId, { profileId: continueProfile.profileId });
3869
3907
  state.delegationSettings = { cwd: state.cwd, runner: continueBackend, model: continueModel,
3870
- effort: agentModelsLocked(this.repoRoot) ? undefined : record?.effort, agentProfile: continueProfile.profileId, accountBinding: continueProfile.accountBinding,
3908
+ effort: continueEffort, agentProfile: continueProfile.profileId, accountBinding: continueProfile.accountBinding,
3871
3909
  systemPrompt: record?.systemPrompt, allowedTools: grants.allowedTools, bashAllowlist: grants.bashAllowlist };
3872
3910
  const runner = createRunner(continueBackend);
3873
3911
  state.currentStepId = stepId;
@@ -3901,7 +3939,7 @@ export class RunManager {
3901
3939
  env: { ...continueProfile.env, ...delegation?.env },
3902
3940
  ...(delegation ? { restrictNativeDelegation: delegation.restrictNativeDelegation } : {}),
3903
3941
  model: continueModel,
3904
- effort: agentModelsLocked(this.repoRoot) ? undefined : record?.effort,
3942
+ effort: continueEffort,
3905
3943
  sessionId,
3906
3944
  resume: sessionId !== undefined,
3907
3945
  timeoutMs: 0,
@@ -4611,8 +4649,17 @@ export class RunManager {
4611
4649
  // unresolvable model (e.g. a bare id on opencode) returns the step error
4612
4650
  // instead of letting the backend silently substitute its default.
4613
4651
  let backendModel;
4652
+ let effectiveEffort;
4614
4653
  try {
4615
- const normalized = normalizeModelForBackend(stepBackend, agentModelsLocked(this.repoRoot) ? undefined : step.model ?? input.model, { configuredProvider: await configuredModelProvider(stepBackend, state.cwd) });
4654
+ const modelsLocked = agentModelsLocked(this.repoRoot);
4655
+ const authoredStepEffort = step.effort !== undefined;
4656
+ if (modelsLocked && step.effort?.trim())
4657
+ return AGENT_MODELS_LOCKED_ERROR;
4658
+ const stepEffort = parseDelegationEffort(step.effort);
4659
+ effectiveEffort = modelsLocked
4660
+ ? undefined
4661
+ : authoredStepEffort ? stepEffort : this.store.getRun(runId)?.effort ?? input.effort;
4662
+ const normalized = normalizeModelForBackend(stepBackend, modelsLocked ? undefined : step.model ?? input.model, { configuredProvider: await configuredModelProvider(stepBackend, state.cwd) });
4616
4663
  backendModel = normalized?.backendModel;
4617
4664
  // Persist the identity of what ACTUALLY runs (#405, review M1). The run-start echo
4618
4665
  // (line ~993) is best-effort from `taskBackend`/`input.model`; a per-step `runner`/`model`
@@ -4623,7 +4670,7 @@ export class RunManager {
4623
4670
  });
4624
4671
  }
4625
4672
  catch (err) {
4626
- if (err instanceof ModelIdentityError)
4673
+ if (err instanceof ModelIdentityError || err instanceof DelegationPolicyError)
4627
4674
  return err.message;
4628
4675
  throw err;
4629
4676
  }
@@ -4651,7 +4698,7 @@ export class RunManager {
4651
4698
  allowedTools: allowedToolsForStep(step, stepBackend), bashAllowlist: step.bashAllowlist,
4652
4699
  };
4653
4700
  state.delegationSettings = { cwd: state.cwd, runner: stepBackend, model: backendModel,
4654
- effort: agentModelsLocked(this.repoRoot) ? undefined : this.store.getRun(runId)?.effort ?? input.effort,
4701
+ effort: effectiveEffort,
4655
4702
  agentProfile: stepProfile.profileId, accountBinding: stepProfile.accountBinding, systemPrompt: composeSystemPrompt(systemPrompt, extraSystemPrompt),
4656
4703
  allowedTools: grants.allowedTools, bashAllowlist: grants.bashAllowlist };
4657
4704
  const runner = createRunner(stepBackend);
@@ -4681,9 +4728,7 @@ export class RunManager {
4681
4728
  env: { ...stepProfile.env, ...delegation?.env },
4682
4729
  ...(delegation ? { restrictNativeDelegation: delegation.restrictNativeDelegation } : {}),
4683
4730
  model: backendModel,
4684
- effort: agentModelsLocked(this.repoRoot)
4685
- ? undefined
4686
- : this.store.getRun(runId)?.effort ?? input.effort,
4731
+ effort: effectiveEffort,
4687
4732
  sessionId,
4688
4733
  // Interactive sessions have no wall clock — the idle timer rules.
4689
4734
  timeoutMs: interactive ? 0 : undefined,