agent-policy-kit 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/inspect.mjs CHANGED
@@ -2,7 +2,7 @@ import fs from 'node:fs/promises';
2
2
  import {constants} from 'node:fs';
3
3
  import path from 'node:path';
4
4
  import {parseToml} from './toml.mjs';
5
- import {CLIENTS} from './policy.mjs';
5
+ import {CLIENTS,NATIVE_EFFORTS} from './policy.mjs';
6
6
  import {inspectConfiguration} from './install.mjs';
7
7
 
8
8
  const ROOTS={chatgpt:'.codex',claude:'.claude',kimi:'.kimi-code',gemini:'.gemini',grok:'.grok'};
@@ -151,9 +151,10 @@ async function rolesIn(directory,client,id,budget,models,depth=0){
151
151
  }
152
152
  }
153
153
  if(id==='grok'){
154
- // The native per-subagent model override lives in config.toml, not in the agent file.
154
+ // The native per-subagent model override lives in config.toml, not in the agent file; the effort lives in the agent frontmatter.
155
155
  role.model=models.get(role.name)??role.model;
156
- if(fields.effort!==undefined){role.effort=null;warning(client,failure('UNSUPPORTED_ROLE_EFFORT'));}
156
+ // Grok Build drops an agent whose frontmatter effort is not a level it accepts.
157
+ if(role.effort!==null&&!NATIVE_EFFORTS.grok.includes(role.effort))warning(client,failure('UNSUPPORTED_ROLE_EFFORT'));
157
158
  }
158
159
  if(id==='gemini'){
159
160
  if(role.model!==null&&!['pro','flash','flash_lite','inherit'].includes(role.model))throw failure('UNSUPPORTED_NATIVE_SETTING');
package/src/native.mjs CHANGED
@@ -24,8 +24,10 @@ export function nativeRoles(client,config,selectedRoles=ROLE_IDS) {
24
24
  const {description,prompt}=ROLE_DEFINITIONS.find(value=>value.id===role);
25
25
  if(client==='chatgpt') return Object.entries({name,description,model:selected.model,...(selected.effort===null?{}:{model_reasoning_effort:selected.effort}),developer_instructions:prompt}).map(([k,v])=>`${k} = ${JSON.stringify(v)}\n`).join('');
26
26
  const fields=[`name: ${name}`,`description: ${JSON.stringify(description)}`];
27
- // Grok selects the model from config.toml [subagents.models]; read-only roles use the bundled plan permission mode.
27
+ // Grok selects the model from config.toml [subagents.models] and reads a role effort from the agent frontmatter;
28
+ // a null effort writes nothing, so the role keeps its model's native default. Read-only roles use the bundled plan permission mode.
28
29
  if(client==='grok') {
30
+ if(selected.effort!==null)fields.push(`effort: ${selected.effort}`);
29
31
  if(['reviewer','explorer'].includes(role))fields.push('permission_mode: plan');
30
32
  } else if(client==='kimi') {
31
33
  if(['reviewer','explorer'].includes(role))fields.push('tools: [Read, Grep, Glob]');
@@ -51,7 +53,7 @@ export function instructionBlock(client,config,maxConcurrent,selectedRoles=ROLE_
51
53
  for(const role of selectedRoles)text.push(`When delegating to apk-${role}, use model tier ${rolePreference(config,role).model}.`);
52
54
  text.push('Per-role effort and a hard concurrency cap are not supported by the documented native agent settings.');
53
55
  }
54
- else if(client==='grok')text.push('Use the named role definitions for model selection. Per-role effort is not supported by the documented native agent settings; subagents use the main session effort. Explicit spawn settings and higher-priority instructions can supersede user defaults.');
56
+ else if(client==='grok')text.push("Use the named role definitions for model and effort selection. A role effort applies only when its model supports effort; a role without an effort uses its model's native default effort. Explicit spawn settings and higher-priority instructions can supersede user defaults.");
55
57
  else if(client==='claude')text.push('Use the named role definitions for model and effort selection. Session, project, managed settings, environment overrides and some spawn paths can supersede these user defaults; the native cap applies to ordinary Agent-tool spawns with documented exceptions.');
56
58
  else text.push('Use the named role definitions for model and effort selection. Explicit spawn settings and higher-priority instructions can supersede user defaults.');
57
59
  if(client==='chatgpt'||client==='claude')text.push('An omitted role effort uses the native client default; it does not pin a level.');
@@ -60,5 +62,5 @@ export function instructionBlock(client,config,maxConcurrent,selectedRoles=ROLE_
60
62
  return text.join('\n')+'\n';
61
63
  }
62
64
  export function nativeWarnings(client) {
63
- return client==='kimi'?['kimi-concurrency-guidance-only','kimi-model-pool-routing-guidance']:client==='gemini'?['gemini-concurrency-guidance-only','gemini-per-role-effort-unsupported']:client==='grok'?['grok-per-role-effort-unsupported','grok-native-precedence-limits']:client==='claude'?['claude-native-precedence-limits']:['chatgpt-native-precedence-limits'];
65
+ return client==='kimi'?['kimi-concurrency-guidance-only','kimi-model-pool-routing-guidance']:client==='gemini'?['gemini-concurrency-guidance-only','gemini-per-role-effort-unsupported']:client==='grok'?['grok-effort-model-dependent','grok-native-precedence-limits']:client==='claude'?['claude-native-precedence-limits']:['chatgpt-native-precedence-limits'];
64
66
  }
package/src/output.mjs CHANGED
@@ -11,7 +11,9 @@ const NOTES={
11
11
  'kimi-model-pool-routing-guidance':'Kimi: the parent selects the model alias for each role.',
12
12
  'gemini-concurrency-guidance-only':'Gemini: the concurrency limit is guidance.',
13
13
  'gemini-per-role-effort-unsupported':'Gemini: native tiers do not support per-role effort.',
14
- 'grok-per-role-effort-unsupported':'Grok: native agent settings do not support per-role effort.',
14
+ 'grok-effort-model-dependent':'Grok: a role effort applies only when its model supports effort; a role without one uses its model default.',
15
+ // Receipts written by 0.4.0 still carry this code; it is shown with the corrected text.
16
+ 'grok-per-role-effort-unsupported':'Grok: a role effort applies only when its model supports effort; a role without one uses its model default.',
15
17
  'grok-native-precedence-limits':'Project and explicit client settings can override these defaults.',
16
18
  'kimi-catalog-alias-resolved':'Kimi: an existing matching model alias was selected.',
17
19
  };
package/src/share.mjs CHANGED
@@ -55,7 +55,7 @@ function shareRelease(release){
55
55
  }
56
56
  function shareChoice(choice,id,metadata){
57
57
  shareRecord(choice,['model','effort']);
58
- if(typeof choice.model!=='string'||choice.model.length>128||(choice.effort!==null&&(['gemini','grok'].includes(id)||!metadata.catalog[id].efforts.includes(choice.effort))))invalidShare();
58
+ if(typeof choice.model!=='string'||choice.model.length>128||(choice.effort!==null&&(id==='gemini'||!metadata.catalog[id].efforts.includes(choice.effort))))invalidShare();
59
59
  return {model:choice.model,effort:choice.effort};
60
60
  }
61
61
  function sharePayload(payload,release,metadata){