@miphamai/cli 0.85.54 → 0.85.55

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.
@@ -1,7 +1,7 @@
1
1
  import { SubAgent } from '../agent/sub-agent'
2
2
  import type { ProviderRegistry } from '../providers/registry'
3
3
  import type { Llm } from '../providers/llm'
4
- import type { ToolDefinition, SkillDefinition } from '../shared/index.ts'
4
+ import type { ToolDefinition, SkillDefinition, ToolContext } from '../shared/index.ts'
5
5
  import type { AgentDefinition } from '../agent/types'
6
6
  import type { PermissionSystem } from '../core/permission'
7
7
  import type { SubAgentServices } from '../agent/services'
@@ -24,6 +24,7 @@ export async function executeForkedSkill(
24
24
  permissionSystem?: PermissionSystem,
25
25
  llm?: Llm,
26
26
  services?: SubAgentServices,
27
+ toolContext?: Partial<ToolContext>,
27
28
  ): Promise<string> {
28
29
  const agentDef: AgentDefinition = {
29
30
  name: `skill:${skill.name}`,
@@ -49,7 +50,7 @@ export async function executeForkedSkill(
49
50
  ? `Execute the "${skill.name}" skill with arguments: ${args}`
50
51
  : `Execute the "${skill.name}" skill.`
51
52
 
52
- return sub.execute(prompt, `skill:${skill.name}`, { agentDef })
53
+ return sub.execute(prompt, `skill:${skill.name}`, { agentDef, toolContext })
53
54
  }
54
55
 
55
56
  function buildSkillSystemPrompt(skill: SkillDefinition): string {
@@ -103,6 +103,7 @@ export const skillTool: ToolDefinition = {
103
103
  ctx.permissionSystem,
104
104
  ctx.llm,
105
105
  ctx.subAgentServices,
106
+ ctx,
106
107
  )
107
108
  // Return to AI as internal context
108
109
  recordSkillUsage(skillName)
@@ -107,6 +107,7 @@ export const workflowTool: ToolDefinition = {
107
107
  getPermission: () => ctx.permissionSystem,
108
108
  getLlm: () => ctx.llm,
109
109
  getSubAgentServices: () => ctx.subAgentServices,
110
+ getToolContext: () => ctx,
110
111
  } as unknown as QueryEngine
111
112
 
112
113
  try {
@@ -620,6 +620,13 @@ const statusCmd: CommandHandler = async (ctx) => {
620
620
  .filter((p) => p.status !== 'upcoming')
621
621
  .map((p) => `${p.id} ${health.get(p.id) ? '🟢' : '🔴'}`)
622
622
  .join(' ')
623
+ // Only the engine knows what it actually wired. A remote stub without the
624
+ // accessor omits the row instead of showing a guess.
625
+ const selfCheck = (
626
+ ctx.engine as QueryEngine & {
627
+ getSelfCheckStatus?: () => { reviewGate: boolean; verification: boolean }
628
+ }
629
+ ).getSelfCheckStatus?.()
623
630
 
624
631
  return {
625
632
  content: stripIndent`
@@ -630,6 +637,7 @@ const statusCmd: CommandHandler = async (ctx) => {
630
637
  ${t('commands.status.tokens')} ~${c.getEstimatedTokens().toLocaleString()} / ${c.getMaxTokens().toLocaleString()}
631
638
  ${t('commands.status.tools')} ${tools.size} ${t('commands.status.loaded')}
632
639
  ${t('commands.status.permission')} ${liveMode(ctx)}
640
+ ${selfCheck ? `Self-check review=${selfCheck.reviewGate ? 'on' : 'off'} verification=${selfCheck.verification ? 'on' : 'off'}` : ''}
633
641
  Telemetry ${telemetryStatus(ctx)}
634
642
 
635
643
  ${t('commands.status.system_title')}
@@ -2,7 +2,7 @@ import { join } from 'node:path'
2
2
  import { SubAgent } from '../../agent/sub-agent'
3
3
  import type { ProviderRegistry } from '../../providers/registry'
4
4
  import type { Llm } from '../../providers/llm'
5
- import type { ToolDefinition } from '../../shared/index.ts'
5
+ import type { ToolDefinition, ToolContext } from '../../shared/index.ts'
6
6
  import type { PermissionSystem } from '../../core/permission'
7
7
  import type { SubAgentServices } from '../../agent/services'
8
8
  import { worktreeRoot } from '../../core/paths.ts'
@@ -40,6 +40,8 @@ export interface WorkflowAgentOpts {
40
40
  permissionSystem?: PermissionSystem
41
41
  /** Hooks, gates and DLP handed down by the engine running the workflow. */
42
42
  services?: SubAgentServices
43
+ /** Write tracking handed down by the engine (the review gate is one consumer). */
44
+ toolContext?: Partial<ToolContext>
43
45
  /** Run the agent in an isolated git worktree (optional). */
44
46
  isolation?: 'worktree'
45
47
  /**
@@ -173,6 +175,7 @@ export async function workflowAgent(
173
175
  effort: opts.effort,
174
176
  allowedTools: undefined, // use all tools by default
175
177
  worktreePath,
178
+ toolContext: opts.toolContext,
176
179
  signal: opts.signal,
177
180
  // The prompt is computed by the script, not typed by the user — say so,
178
181
  // so text the script relayed from a file or another agent cannot pass
@@ -152,6 +152,10 @@ export async function runWorkflow(
152
152
  ...(opts || {}),
153
153
  permissionSystem: permission,
154
154
  services: engine.getSubAgentServices(),
155
+ // Stub engines (the Workflow tool's, older tests) may predate this
156
+ // accessor; a missing write tap must not fail the whole run.
157
+ toolContext:
158
+ typeof engine.getToolContext === 'function' ? engine.getToolContext() : undefined,
155
159
  signal: controller.signal,
156
160
  } as Record<string, unknown>,
157
161
  llm,