mixdog 0.9.106 → 0.9.108

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mixdog",
3
- "version": "0.9.106",
3
+ "version": "0.9.108",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Standalone mixdog coding-agent CLI/TUI workspace.",
@@ -0,0 +1,9 @@
1
+ export const IMPLICIT_APPROVAL_MODE = 'implicit';
2
+ export const IMPLICIT_APPROVAL_CONTEXT =
3
+ 'Non-interactive execution: treat the initial user request as the approved plan and proceed without requesting approval.';
4
+
5
+ export function workflowContextForApprovalMode(workflowContext, approvalMode) {
6
+ if (approvalMode !== IMPLICIT_APPROVAL_MODE) return workflowContext || null;
7
+ const workflow = typeof workflowContext === 'string' ? workflowContext.trim() : '';
8
+ return [workflow, IMPLICIT_APPROVAL_CONTEXT].filter(Boolean).join('\n\n');
9
+ }
@@ -34,6 +34,10 @@ import { getAgentRuntimeSync, warnAgentRuntimeResolveFailureOnce } from './agent
34
34
  import { mintSessionId } from './session-id.mjs';
35
35
  import { providerCacheKey } from './provider-cache-key.mjs';
36
36
  import { clearTurnCheckpoint, recoverTurnCheckpoint } from './turn-checkpoint.mjs';
37
+ import {
38
+ IMPLICIT_APPROVAL_MODE,
39
+ workflowContextForApprovalMode,
40
+ } from '../approval-mode.mjs';
37
41
 
38
42
  function buildSessionProviderCacheOpts(providerName, sessionId, agent = null) {
39
43
  // Keep this in sync with createSession's provider-cache policy: only
@@ -274,7 +278,7 @@ export function createSession(opts) {
274
278
  skipRoleCatalog: !ownerIsAgent,
275
279
  profile: profile || undefined,
276
280
  agent: resolvedAgent,
277
- workflowContext: opts.workflowContext || null,
281
+ workflowContext: workflowContextForApprovalMode(opts.workflowContext, opts.approvalMode),
278
282
  workspaceContext: opts.workspaceContext || null,
279
283
  coreMemoryContext: opts.coreMemoryContext || null,
280
284
  skillManifest: buildSkillManifest(skills),
@@ -373,6 +377,9 @@ export function createSession(opts) {
373
377
  fast,
374
378
  agent: opts.agent,
375
379
  owner: opts.owner || 'user',
380
+ ...(opts.approvalMode === IMPLICIT_APPROVAL_MODE
381
+ ? { approvalMode: IMPLICIT_APPROVAL_MODE }
382
+ : {}),
376
383
  mcpPid: process.pid,
377
384
  mcpScopeId: opts.mcpScopeId || null,
378
385
  scopeKey: opts.scopeKey || null,
@@ -682,11 +682,18 @@ function extractInlinePatchRoot(patchText) {
682
682
 
683
683
  export function expandCompactPatchInput(patchText) {
684
684
  const text = String(patchText || '').replace(/^\uFEFF/, '');
685
- if (/^\s*\*\*\* Begin Patch(?:\r?\n|$)/.test(text)) return text;
686
685
  const lines = text.replace(/\r\n/g, '\n').split('\n');
687
686
  while (lines.length && lines[0] === '') lines.shift();
688
687
  while (lines.length && lines[lines.length - 1] === '') lines.pop();
689
- if (!lines.length || !/^[RADU] /.test(lines[0])) return text;
688
+ const wrapped = /^\*\*\* Begin Patch\b/i.test(lines[0] || '');
689
+ if (wrapped) {
690
+ lines.shift();
691
+ while (lines.length && lines[0] === '') lines.shift();
692
+ if (/^\*\*\* End Patch\b/i.test(lines[lines.length - 1] || '')) lines.pop();
693
+ while (lines.length && lines[lines.length - 1] === '') lines.pop();
694
+ }
695
+ const sectionIndex = /^(?:R |\*\*\* Root: )/.test(lines[0] || '') ? 1 : 0;
696
+ if (!/^[ADU] /.test(lines[sectionIndex] || '')) return text;
690
697
  const mapped = lines.map((line) => {
691
698
  if (line.startsWith('R ')) return `*** Root: ${line.slice(2)}`;
692
699
  if (line.startsWith('A ')) return `*** Add File: ${line.slice(2)}`;
@@ -9,6 +9,7 @@
9
9
  import { createWorkflowHelpers } from '../../session-runtime/workflow.mjs';
10
10
  import { STANDALONE_ROOT, STANDALONE_DATA_DIR } from '../../session-runtime/runtime-paths.mjs';
11
11
  import { readMarkdownDocument, normalizeAgentPermissionOrNone } from './markdown-frontmatter.mjs';
12
+ import { IMPLICIT_APPROVAL_MODE } from '../agent/orchestrator/session/approval-mode.mjs';
12
13
 
13
14
  let _helpers = null;
14
15
  function helpers() {
@@ -23,19 +24,21 @@ function helpers() {
23
24
  return _helpers;
24
25
  }
25
26
 
26
- /** { workflow, workflowContext } createSession opts for a workflow id, or {} when unset/unresolvable. */
27
+ /** Non-interactive createSession opts, plus workflow context when the id resolves. */
27
28
  export function automationWorkflowOpts(workflowId) {
29
+ const approvalOpts = { approvalMode: IMPLICIT_APPROVAL_MODE };
28
30
  const id = String(workflowId || '').trim();
29
- if (!id) return {};
31
+ if (!id) return approvalOpts;
30
32
  try {
31
33
  const h = helpers();
32
34
  const pack = h.loadWorkflowPack(undefined, id);
33
- if (!pack) return {};
35
+ if (!pack) return approvalOpts;
34
36
  return {
37
+ ...approvalOpts,
35
38
  workflow: h.workflowSummary(pack),
36
39
  workflowContext: h.workflowContextBlock({ workflow: { active: id } }, undefined),
37
40
  };
38
41
  } catch {
39
- return {};
42
+ return approvalOpts;
40
43
  }
41
44
  }
@@ -329,6 +329,7 @@ export async function createMixdogSessionRuntime({
329
329
  model,
330
330
  cwd = process.cwd(),
331
331
  toolMode = 'full',
332
+ approvalMode = null,
332
333
  remote = false,
333
334
  desktopSession: initialDesktopSession = null,
334
335
  agentSession = null,
@@ -336,6 +337,7 @@ export async function createMixdogSessionRuntime({
336
337
  // Shared mutable runtime state, promoted from closure `let`s so extracted
337
338
  // modules can read/write live values through one reference.
338
339
  const rt = {};
340
+ rt.approvalMode = approvalMode === 'implicit' ? 'implicit' : null;
339
341
  rt.mcpScopeId = randomUUID();
340
342
  rt.desktopSession = initialDesktopSession;
341
343
  // Agent shard spread: a daemon-hosted worker runtime carries the resolved
@@ -232,6 +232,7 @@ export function createSessionLifecycle({
232
232
  lane: 'cli',
233
233
  sourceType: 'lead',
234
234
  sourceName: 'main',
235
+ ...(rt.approvalMode ? { approvalMode: rt.approvalMode } : {}),
235
236
  clientHostPid: process.pid,
236
237
  mcpScopeId: rt.mcpScopeId,
237
238
  disallowedTools: [...LEAD_DISALLOWED_TOOLS, ...featureDisallowedTools()],