@aiwg/cli 2026.11.3 → 2026.11.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.
- package/agentic/code/addons/aiwg-hooks/canonical/aiwg-prompt-discovery.yaml +3 -2
- package/agentic/code/addons/aiwg-hooks/hooks/aiwg-prompt-discovery.cjs +12 -9
- package/agentic/code/addons/aiwg-utils/rules/anti-laziness.md +2 -0
- package/agentic/code/addons/composition-engine/lib/runtime.mjs +5 -26
- package/agentic/code/addons/composition-engine/schemas/flow-graph.schema.json +22 -0
- package/agentic/code/providers/capability-matrix.yaml +85 -18
- package/agentic/code/providers/model-capabilities.v1.json +35 -27
- package/dist/src/a2a/hitl-authorization.js +46 -0
- package/dist/src/a2a/hitl-driver.js +5 -5
- package/dist/src/artifacts/browser-export.js +2 -0
- package/dist/src/artifacts/framework-source-digest.js +1 -1
- package/dist/src/artifacts/index-builder.js +9 -27
- package/dist/src/artifacts/index-capability.js +24 -0
- package/dist/src/artifacts/query-engine-discover-output.js +8 -3
- package/dist/src/artifacts/query-engine-rules.js +29 -11
- package/dist/src/artifacts/query-engine-scoring.js +5 -5
- package/dist/src/artifacts/query-engine-show-card.js +5 -1
- package/dist/src/artifacts/query-engine-show-load.js +1 -1
- package/dist/src/artifacts/query-engine-show.js +3 -3
- package/dist/src/artifacts/query-engine-templates.js +10 -4
- package/dist/src/artifacts/query-engine-verbose.js +18 -4
- package/dist/src/artifacts/relations-builder.js +1 -0
- package/dist/src/artifacts/types.js +1 -1
- package/dist/src/cli/handlers/checkpoint-handoff.js +2 -1
- package/dist/src/cli/handlers/guided-setup.js +3 -1
- package/dist/src/cli/handlers/refresh-managed-deployment.js +17 -5
- package/dist/src/cli/handlers/rules.js +1 -1
- package/dist/src/cli/handlers/script-runner.js +7 -4
- package/dist/src/cli/handlers/sessions.js +1 -1
- package/dist/src/cli/handlers/steward-format.js +12 -0
- package/dist/src/cli/handlers/steward.js +1 -1
- package/dist/src/cli/handlers/use.js +14 -6
- package/dist/src/cli/handlers/utility-doctor.js +9 -2
- package/dist/src/cli/handlers/workspace.js +1 -1
- package/dist/src/cli/services/deployment-probe-scope.js +40 -0
- package/dist/src/cli/services/deployment-verification.js +4 -5
- package/dist/src/config/aiwg-config.js +6 -0
- package/dist/src/config/authorization-cli.js +61 -3
- package/dist/src/config/cli-help.js +1 -1
- package/dist/src/config/cli.js +4 -2
- package/dist/src/config/host-resource-runtime.mjs +1 -1
- package/dist/src/config/user-registry.js +9 -1
- package/dist/src/config/worker-owner-lock.js +90 -10
- package/dist/src/decision/graph-flow-adapter.js +1 -1
- package/dist/src/effects/authorization-grant.js +50 -0
- package/dist/src/effects/authorization-store.js +130 -0
- package/dist/src/effects/index.js +2 -0
- package/dist/src/effects/ledger.js +1 -0
- package/dist/src/effects/lifecycle.js +1 -1
- package/dist/src/effects/reader.js +4 -0
- package/dist/src/effects/records.js +4 -0
- package/dist/src/effects/schema.js +2 -0
- package/dist/src/extensions/claude-hooks-installer.js +7 -7
- package/dist/src/extensions/manifest.js +6 -0
- package/dist/src/extensions/muse-managed-hooks.js +11 -0
- package/dist/src/extensions/project-local-discovery.js +21 -1
- package/dist/src/extensions/project-local-scaffold.js +19 -7
- package/dist/src/extensions/user-hook-diagnostics.js +32 -0
- package/dist/src/extensions/verified-hook-command.js +32 -0
- package/dist/src/lint/rule-conflicts.js +52 -0
- package/dist/src/lint/runner.js +3 -0
- package/dist/src/mcp/cli.mjs +3 -1
- package/dist/src/mcp/elicitation.mjs +30 -0
- package/dist/src/mcp/grok-build-config.mjs +1 -1
- package/dist/src/mcp/muse-native-config.mjs +1 -0
- package/dist/src/mcp/server.mjs +2 -0
- package/dist/src/mcp/tools/authorization.mjs +78 -0
- package/dist/src/models/factory-models.js +144 -0
- package/dist/src/models/model-capabilities.v1.json +35 -27
- package/dist/src/models/model-discovery.js +7 -3
- package/dist/src/models/worker-installation.d.mts +2 -0
- package/dist/src/models/worker-installation.mjs +11 -2
- package/dist/src/models/worker-invocation-policy.js +25 -1
- package/dist/src/models/wrapper-enforcement.js +1 -1
- package/dist/src/policy/authorization-capture.js +64 -0
- package/dist/src/policy/authorization-operations.js +108 -0
- package/dist/src/policy/hitl-check.js +3 -2
- package/dist/src/policy/hitl-consume.js +14 -0
- package/dist/src/policy/hitl-durable-store.js +60 -0
- package/dist/src/policy/hitl-durable.js +60 -0
- package/dist/src/policy/hitl-receipt.js +5 -0
- package/dist/src/policy/hitl.js +44 -6
- package/dist/src/policy/repo-access.js +3 -1
- package/dist/src/process/bounded-child-process.mjs +49 -39
- package/dist/src/providers/capability-matrix.yaml +85 -18
- package/dist/src/providers/deployment-ownership.d.mts +1 -0
- package/dist/src/providers/deployment-ownership.mjs +29 -3
- package/dist/src/providers/deployment-preservation.mjs +44 -3
- package/dist/src/providers/grok-build-acp.js +13 -5
- package/dist/src/providers/grok-build-dispatch.js +35 -2
- package/dist/src/providers/grok-build-headless.js +171 -77
- package/dist/src/providers/grok-build-inspect.js +1 -0
- package/dist/src/providers/grok-build-paths.js +2 -0
- package/dist/src/providers/muse-paths.js +4 -2
- package/dist/src/providers/provider-context-contracts.js +12 -4
- package/dist/src/providers/provider-definition-schema.js +6 -0
- package/dist/src/providers/provider-seeds-1.js +3 -3
- package/dist/src/providers/provider-seeds-2.js +6 -4
- package/dist/src/providers/provider-seeds-3.js +6 -6
- package/dist/src/rules/activation.d.mts +2 -0
- package/dist/src/rules/activation.mjs +16 -7
- package/dist/src/rules/inline-budget.d.mts +2 -1
- package/dist/src/rules/inline-budget.mjs +4 -2
- package/dist/src/rules/inventory.js +3 -0
- package/dist/src/rules/precedence.d.mts +6 -0
- package/dist/src/rules/precedence.mjs +49 -0
- package/dist/src/rules/project-precedence.js +73 -0
- package/dist/src/rules/rule-frontmatter.schema.json +15 -0
- package/dist/src/serve/a2a-terminal-observer.js +12 -3
- package/dist/src/serve/mission-hitl.js +20 -1
- package/dist/src/serve/worker-stdin-frame.mjs +1 -1
- package/dist/src/sessions/adapters/grok-build-fallback.js +33 -0
- package/dist/src/sessions/adapters/grok-build-native-records.js +134 -0
- package/dist/src/sessions/adapters/grok-build-native.js +237 -98
- package/dist/src/sessions/adapters/grok-build.js +95 -32
- package/dist/src/sessions/grok-build-cli-output.js +113 -0
- package/dist/src/sessions/grok-build-cli.js +4 -28
- package/dist/src/sessions/normalization.js +1 -1
- package/dist/src/smiths/context-pipeline/bridge-ownership.js +4 -3
- package/dist/src/smiths/context-pipeline/finalization.js +5 -0
- package/dist/src/smiths/context-pipeline/generator.js +1 -1
- package/dist/src/smiths/context-pipeline/workspace-bootstrap.js +20 -17
- package/dist/src/smiths/context-pipeline/workspace-doctor.js +6 -1
- package/dist/src/smiths/context-pipeline/workspace-document.js +6 -0
- package/dist/src/smiths/context-pipeline/workspace-migration.js +2 -12
- package/dist/src/smiths/hook-bridge/codex-translator.js +11 -14
- package/dist/src/smiths/hook-bridge/codex-trust.js +7 -2
- package/dist/src/smiths/hook-bridge/copilot-translator.js +2 -1
- package/dist/src/smiths/hook-bridge/factory-trust.js +2 -2
- package/dist/src/smiths/hook-bridge/grok-build-translator.js +3 -1
- package/dist/src/smiths/hook-bridge/hermes-prompt-discovery.js +81 -0
- package/dist/src/smiths/hook-bridge/hermes-translator.js +5 -3
- package/dist/src/smiths/hook-bridge/hermes-trust.js +65 -0
- package/dist/src/smiths/hook-bridge/index.js +3 -1
- package/dist/src/smiths/hook-bridge/prompt-discovery-gaps.js +3 -2
- package/package.json +7 -1
- package/tools/agents/deploy-agents.mjs +9 -8
- package/tools/agents/deploy-options.mjs +3 -0
- package/tools/agents/providers/base-frontmatter.mjs +3 -2
- package/tools/agents/providers/base-inventory.mjs +3 -1
- package/tools/agents/providers/base-kernel-skills.mjs +11 -5
- package/tools/agents/providers/claude-post-deploy.mjs +1 -1
- package/tools/agents/providers/codex-post-deploy.mjs +1 -1
- package/tools/agents/providers/generic.mjs +66 -0
- package/tools/agents/providers/grok-build.mjs +34 -41
- package/tools/agents/providers/model-wrapper.mjs +2 -5
- package/tools/agents/providers/muse-hooks.mjs +13 -11
- package/tools/agents/providers/muse-prompt-discovery.mjs +5 -1
- package/tools/agents/providers/muse.mjs +2 -1
- package/tools/agents/providers/openclaw.mjs +2 -1
- package/tools/agents/providers/rule-deployment-commit.mjs +3 -0
- package/tools/agents/providers/rule-deployment-prepare.mjs +7 -5
- package/tools/agents/providers/rule-deployment-state.mjs +14 -6
- package/tools/agents/providers/rule-projection.mjs +39 -4
- package/tools/agents/providers/rule-startup.mjs +11 -10
- package/tools/agents/providers/skill-copy-prune.mjs +12 -0
- package/tools/agents/providers/staged-directory-reference.mjs +14 -0
- package/tools/agents/providers/stale-artifact-prune.mjs +24 -10
- package/tools/agents/providers/user-hooks.mjs +26 -0
- package/tools/cli/authorization-health.mjs +20 -0
- package/tools/cli/workspace-status.mjs +7 -0
- package/tools/commands/deploy-prompts-codex.mjs +15 -1
- package/tools/ralph-external/lib/claude-adapter.mjs +2 -0
- package/tools/ralph-external/lib/factory-adapter.mjs +6 -2
- package/tools/ralph-external/lib/worker-inputs.mjs +20 -1
- package/tools/ralph-external/lib/worker-isolation.mjs +1 -0
- package/tools/ralph-external/lib/worker-termination.mjs +21 -12
- package/tools/ralph-external/session-launcher.mjs +22 -17
- package/vscode-extension/schemas/aiwg.config.v1.json +20 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
// Read Hermes shell-hook consent without accepting commands or changing config.
|
|
2
|
+
import fs from 'node:fs/promises';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { parseDocument } from 'yaml';
|
|
5
|
+
import { resolveHermesHomePath } from '../../providers/hermes-home.js';
|
|
6
|
+
// One short deploy line; doctor carries the complete set of acceptance options.
|
|
7
|
+
export const HERMES_HOOK_ACCEPTANCE_NEXT_STEP = 'Accept the Hermes hook (--accept-hooks); see aiwg doctor.';
|
|
8
|
+
export const HERMES_HOOK_ACCEPTANCE_DETAIL = 'Hermes skips unaccepted pre_llm_call hooks. Review and accept at the TTY prompt, '
|
|
9
|
+
+ 'or explicitly opt in with --accept-hooks, HERMES_ACCEPT_HOOKS=1 or hooks_auto_accept: true. '
|
|
10
|
+
+ 'AIWG never accepts hooks for you. Acceptance matches the exact event and command string; '
|
|
11
|
+
+ 'a script change changes the fingerprinted command on redeploy and requires re-acceptance.';
|
|
12
|
+
export function hermesHookAcceptanceNextStep(state) {
|
|
13
|
+
return state && state !== 'accepted' ? HERMES_HOOK_ACCEPTANCE_NEXT_STEP : '';
|
|
14
|
+
}
|
|
15
|
+
export async function readHermesHookAcceptance() {
|
|
16
|
+
const home = resolveHermesHomePath();
|
|
17
|
+
let commands;
|
|
18
|
+
let autoAccept;
|
|
19
|
+
try {
|
|
20
|
+
const doc = parseDocument(await fs.readFile(path.join(home, 'config.yaml'), 'utf8'));
|
|
21
|
+
if (doc.errors.length)
|
|
22
|
+
return null;
|
|
23
|
+
const config = doc.toJS();
|
|
24
|
+
const entries = config?.hooks?.pre_llm_call;
|
|
25
|
+
if (!Array.isArray(entries))
|
|
26
|
+
return null;
|
|
27
|
+
commands = entries.filter(entry => entry?._aiwg_managed === true
|
|
28
|
+
&& entry._aiwg_id === 'aiwg-prompt-discovery' && typeof entry.command === 'string')
|
|
29
|
+
.map(entry => entry.command);
|
|
30
|
+
if (!commands.length)
|
|
31
|
+
return null;
|
|
32
|
+
await fs.access(path.join(home, 'agent-hooks/aiwg-prompt-discovery.cjs'));
|
|
33
|
+
autoAccept = config.hooks_auto_accept;
|
|
34
|
+
}
|
|
35
|
+
catch {
|
|
36
|
+
// Broken deployments are handled by the existing drift diagnostics.
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
// Match Hermes's existing config opt-in, without setting it or assuming a CLI flag.
|
|
40
|
+
if (autoAccept === true || typeof autoAccept === 'string'
|
|
41
|
+
&& ['1', 'true', 'yes', 'on'].includes(autoAccept.trim().toLowerCase()))
|
|
42
|
+
return 'accepted';
|
|
43
|
+
try {
|
|
44
|
+
const data = JSON.parse((await fs.readFile(path.join(home, 'shell-hooks-allowlist.json'), 'utf8')).replace(/^\uFEFF/, ''));
|
|
45
|
+
if (!Array.isArray(data?.approvals))
|
|
46
|
+
return 'unknown';
|
|
47
|
+
// Hermes agent/shell_hooks.py _entry_matches compares both strings exactly.
|
|
48
|
+
return commands.every(command => data.approvals.some((entry) => entry?.event === 'pre_llm_call' && entry.command === command)) ? 'accepted' : 'unaccepted';
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
return error.code === 'ENOENT' ? 'unaccepted' : 'unknown';
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
export async function diagnoseHermesHookAcceptance() {
|
|
55
|
+
const state = await readHermesHookAcceptance();
|
|
56
|
+
if (!hermesHookAcceptanceNextStep(state))
|
|
57
|
+
return null;
|
|
58
|
+
return {
|
|
59
|
+
severity: state === 'unaccepted' ? 'warning' : 'info', code: 'hermes-prompt-discovery-acceptance',
|
|
60
|
+
path: resolveHermesHomePath('config.yaml'),
|
|
61
|
+
message: `Hermes prompt-discovery hook deployed but ${state === 'unaccepted' ? 'not accepted' : 'acceptance unverified'}. `
|
|
62
|
+
+ HERMES_HOOK_ACCEPTANCE_DETAIL,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=hermes-trust.js.map
|
|
@@ -18,6 +18,7 @@ import { translateForFactory } from './factory-translator.js';
|
|
|
18
18
|
import { translateForHermes } from './hermes-translator.js';
|
|
19
19
|
import { translateForGrokBuild } from './grok-build-translator.js';
|
|
20
20
|
import { getProviderDefinition } from '../../providers/provider-definitions.js';
|
|
21
|
+
import { resolveHermesHomePath } from '../../providers/hermes-home.js';
|
|
21
22
|
export { AIWG_ENV_VARS, NATIVE_ENV_VAR_MAP } from './types.js';
|
|
22
23
|
export { substituteEnvVars, generateShimBash, EXIT_CODE_MAP } from './shim.js';
|
|
23
24
|
export { translateForCodex, renderCodexHookToml, injectHookBlock as injectCodexHookBlock } from './codex-translator.js';
|
|
@@ -68,7 +69,8 @@ export async function bridgeAll(sources, providers, options) {
|
|
|
68
69
|
try {
|
|
69
70
|
const roots = [path.join(options.projectPath, '.factory/hooks'), path.join(options.projectPath, '.factory/hooks.json'), path.join(options.projectPath, '.github/hooks'),
|
|
70
71
|
path.join(options.projectPath, '.grok/hooks'), path.join(options.projectPath, '.codex/hooks.json'), path.join(options.projectPath, '.codex/hooks'),
|
|
71
|
-
path.join(homedir(), '.hermes/plugins')
|
|
72
|
+
path.join(homedir(), '.hermes/plugins'), resolveHermesHomePath('config.yaml'), resolveHermesHomePath('agent-hooks'),
|
|
73
|
+
resolveHermesHomePath('.aiwg-manifest.json')];
|
|
72
74
|
const before = options.dryRun ? undefined : captureDeploymentOutputs(roots);
|
|
73
75
|
const r = await translator(source, options);
|
|
74
76
|
if (before)
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
// Explain
|
|
1
|
+
// Explain bootstrap fallbacks where an event mapping has no prompt context contract.
|
|
2
2
|
export const PROMPT_DISCOVERY_GAPS = {
|
|
3
|
-
|
|
3
|
+
copilot: 'Prompt discovery uses the .github/copilot-instructions.md bootstrap rule; installed help documents no prompt-context injection contract.',
|
|
4
|
+
'grok-build': 'Prompt discovery uses the AGENTS.md bootstrap rule; Grok discards allowing UserPromptSubmit stdout (no additionalContext).',
|
|
4
5
|
};
|
|
5
6
|
//# sourceMappingURL=prompt-discovery-gaps.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aiwg/cli",
|
|
3
|
-
"version": "2026.11.
|
|
3
|
+
"version": "2026.11.5",
|
|
4
4
|
"description": "Lightweight AIWG CLI for signed, versioned web-backed resources.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
"agentic/code/addons/aiwg-utils/rules/anti-laziness.md",
|
|
33
33
|
"agentic/code/addons/aiwg-utils/rules/anti-laziness.core.md",
|
|
34
34
|
"agentic/code/addons/composition-engine/lib/runtime.mjs",
|
|
35
|
+
"agentic/code/addons/composition-engine/lib/authority.mjs",
|
|
35
36
|
"agentic/code/addons/composition-engine/lib/validator.mjs",
|
|
36
37
|
"agentic/code/addons/composition-engine/schemas/flow-graph.schema.json",
|
|
37
38
|
"schemas/security/",
|
|
@@ -41,6 +42,7 @@
|
|
|
41
42
|
"schemas/models/",
|
|
42
43
|
"vscode-extension/schemas/aiwg.config.v1.json",
|
|
43
44
|
"dist/src/",
|
|
45
|
+
"dist/src/cli/services/deployment-probe-scope.js",
|
|
44
46
|
"!dist/**/*.d.ts",
|
|
45
47
|
"!dist/**/*.map",
|
|
46
48
|
"dist/src/api/index.d.ts",
|
|
@@ -57,6 +59,7 @@
|
|
|
57
59
|
"tools/ralph-external/lib/behavior-registry.mjs",
|
|
58
60
|
"tools/warp/warp-content.mjs",
|
|
59
61
|
"tools/cli/decision-offload-report.mjs",
|
|
62
|
+
"tools/cli/authorization-health.mjs",
|
|
60
63
|
"tools/cli/workspace-status.mjs",
|
|
61
64
|
"tools/ralph-external/session-launcher.mjs",
|
|
62
65
|
"tools/ralph-external/process-monitor.mjs",
|
|
@@ -106,6 +109,9 @@
|
|
|
106
109
|
"tools/agents/deploy-options.mjs",
|
|
107
110
|
"tools/agents/deploy-support.mjs",
|
|
108
111
|
"tools/agents/use-rule-selection.mjs",
|
|
112
|
+
"dist/src/extensions/verified-hook-command.js",
|
|
113
|
+
"dist/src/extensions/user-hook-diagnostics.js",
|
|
114
|
+
"tools/agents/providers/user-hooks.mjs",
|
|
109
115
|
"tools/agents/providers/",
|
|
110
116
|
"tools/providers/antigravity-transport.mjs",
|
|
111
117
|
"tools/commands/deploy-prompts-codex.mjs",
|
|
@@ -101,7 +101,7 @@ const PROVIDER_ALIASES = {
|
|
|
101
101
|
'dsh': 'deepseek-harness',
|
|
102
102
|
};
|
|
103
103
|
|
|
104
|
-
const AVAILABLE_PROVIDERS = ['antigravity', 'claude', 'factory', 'codex', 'opencode', 'copilot', 'cursor', 'flue', 'pi', 'omp', 'deepseek-harness', 'warp', 'windsurf', 'hermes', 'openclaw', 'openhuman', 'grokbot', 'grok-build', 'muse'];
|
|
104
|
+
const AVAILABLE_PROVIDERS = ['antigravity', 'claude', 'factory', 'codex', 'opencode', 'copilot', 'cursor', 'flue', 'pi', 'omp', 'deepseek-harness', 'warp', 'windsurf', 'hermes', 'openclaw', 'openhuman', 'grokbot', 'grok-build', 'muse', 'generic'];
|
|
105
105
|
|
|
106
106
|
const UNSUPPORTED_PROVIDER_HINTS = {
|
|
107
107
|
'devin-cli': [
|
|
@@ -292,13 +292,15 @@ async function mainUnlocked(args, internal) {
|
|
|
292
292
|
deployRules: !cfg.deferRuleProjection && (cfg.kernelOnly || cfg.deployRules),
|
|
293
293
|
deployBehaviors: cfg.kernelOnly ? false : cfg.deployBehaviors,
|
|
294
294
|
commandsOnly: cfg.commandsOnly,
|
|
295
|
-
|
|
295
|
+
// Grok bulk deployment includes native agents alongside kernel skills (#2577).
|
|
296
|
+
skillsOnly: cfg.skillsOnly || (cfg.kernelOnly && provider.name !== 'grok-build'),
|
|
296
297
|
rulesOnly: cfg.rulesOnly,
|
|
297
298
|
strict: cfg.strict,
|
|
298
299
|
reportOnly: cfg.reportOnly,
|
|
299
300
|
allowOverBudget: cfg.allowOverBudget === true,
|
|
300
301
|
kernelOnly: cfg.kernelOnly,
|
|
301
302
|
deferRuleProjection: cfg.deferRuleProjection,
|
|
303
|
+
bundleOnly: cfg.bundleOnly,
|
|
302
304
|
additionalSources: cfg.additionalSources,
|
|
303
305
|
filter: cfg.filter,
|
|
304
306
|
filterRole: cfg.filterRole,
|
|
@@ -369,7 +371,7 @@ async function mainUnlocked(args, internal) {
|
|
|
369
371
|
try {
|
|
370
372
|
if (!internal.finalizeOnly) {
|
|
371
373
|
if (cfg.kernelOnly && (!cfg.deferRuleProjection || preparationActive)
|
|
372
|
-
&& !['claude', 'codex', 'cursor', 'hermes', 'warp', 'openclaw', 'flue', 'pi', 'copilot', 'factory', 'opencode', 'windsurf', 'antigravity', 'muse', 'omp', 'grok-build'].includes(provider.name)) {
|
|
374
|
+
&& !['claude', 'codex', 'cursor', 'hermes', 'warp', 'openclaw', 'flue', 'pi', 'copilot', 'factory', 'opencode', 'windsurf', 'antigravity', 'muse', 'omp', 'grok-build', 'generic'].includes(provider.name)) {
|
|
373
375
|
const { deployWithRuleDelivery } = await import('./providers/rule-delivery.mjs');
|
|
374
376
|
await deployWithRuleDelivery(opts, provider, staged => provider.deploy(staged));
|
|
375
377
|
} else await provider.deploy(opts);
|
|
@@ -377,10 +379,9 @@ async function mainUnlocked(args, internal) {
|
|
|
377
379
|
if (preparationActive) return;
|
|
378
380
|
|
|
379
381
|
// User settings are outside staging: write only after a real promotion.
|
|
380
|
-
if (
|
|
381
|
-
const {
|
|
382
|
-
|
|
383
|
-
for (const warning of result?.warnings || []) console.warn(`Claude settings: ${warning}`);
|
|
382
|
+
if (cfg.userScope && !cfg.dryRun) {
|
|
383
|
+
const { installUserHooks } = await import('./providers/user-hooks.mjs');
|
|
384
|
+
await installUserHooks(provider.name, cfg);
|
|
384
385
|
}
|
|
385
386
|
|
|
386
387
|
const mirroredCommandCount = mirrorSkillsAsCommands(provider, cfg.target, srcRoot, opts);
|
|
@@ -392,7 +393,7 @@ async function mainUnlocked(args, internal) {
|
|
|
392
393
|
// or removed (the flat-file analogue of the skills holistic prune). #1627.
|
|
393
394
|
pruneStaleAiwgArtifacts(provider, cfg.target, srcRoot, opts, cfg.source);
|
|
394
395
|
|
|
395
|
-
if (!['claude', 'codex', 'cursor', 'hermes', 'warp', 'openclaw'].includes(provider.name) && !opts.commandsOnly && !opts.skillsOnly && !opts.rulesOnly) {
|
|
396
|
+
if (!opts.kernelOnly && !['claude', 'codex', 'cursor', 'hermes', 'warp', 'openclaw'].includes(provider.name) && !opts.commandsOnly && !opts.skillsOnly && !opts.rulesOnly) {
|
|
396
397
|
const behaviorDirs = collectBehaviorDirs(srcRoot);
|
|
397
398
|
const behaviorCount = deployEmulatedBehaviors(behaviorDirs, provider.name, cfg.target, opts);
|
|
398
399
|
if (behaviorCount > 0 && !cfg.quiet) {
|
|
@@ -29,6 +29,7 @@ export function parseArgs(args = process.argv.slice(2)) {
|
|
|
29
29
|
reportOnly: true,
|
|
30
30
|
kernelOnly: false,
|
|
31
31
|
deferRuleProjection: false,
|
|
32
|
+
bundleOnly: false,
|
|
32
33
|
ruleSelectionMode: null,
|
|
33
34
|
additionalSources: [],
|
|
34
35
|
filter: null, // Glob pattern for agent names
|
|
@@ -99,6 +100,7 @@ export function parseArgs(args = process.argv.slice(2)) {
|
|
|
99
100
|
else if (a === '--kernel-only') cfg.kernelOnly = true;
|
|
100
101
|
// Internal use orchestration: the final source owns rule presentation.
|
|
101
102
|
else if (a === '--defer-rule-projection') cfg.deferRuleProjection = true;
|
|
103
|
+
else if (a === '--bundle-only') cfg.bundleOnly = true;
|
|
102
104
|
else if (a === '--deploy-behaviors') cfg.deployBehaviors = true;
|
|
103
105
|
else if (a === '--filter' && args[i + 1]) cfg.filter = args[++i];
|
|
104
106
|
else if (a === '--filter-role' && args[i + 1]) cfg.filterRole = args[++i];
|
|
@@ -234,6 +236,7 @@ Providers (all deploy agents, commands, skills, and rules):
|
|
|
234
236
|
grokbot - Grok Bot (AGENTS.md bridge; skills only with AIWG_GROKBOT_SKILLS_DIR)
|
|
235
237
|
grok-build - Grok Build (experimental; .grok paths + $GROK_HOME; no bare grok alias)
|
|
236
238
|
muse - Muse Code (stable; AGENTS.md bridge; .agents/skills + XDG user root; managed hooks, opt-in --mcp; no aliases)
|
|
239
|
+
generic - Portable Markdown (AGENTS.md + rules; .agents/skills kernel; host must load explicitly)
|
|
237
240
|
hermes - Hermes Agent (MCP-based integration)
|
|
238
241
|
Skills: $HERMES_HOME/skills/ (user-global; defaults to ~/.hermes/skills/) | Agents: AGENTS.md
|
|
239
242
|
Commands/Rules: served via MCP, not file-deployed
|
|
@@ -7,12 +7,13 @@ import { path } from './base-runtime.mjs';
|
|
|
7
7
|
* Returns { frontmatter: string, body: string, metadata: object }
|
|
8
8
|
*/
|
|
9
9
|
export function parseFrontmatter(content) {
|
|
10
|
-
const fmMatch = content.match(/^---\n([\s\S]*?)\n---\n([\s\S]*)$/);
|
|
10
|
+
const fmMatch = content.match(/^---\r?\n([\s\S]*?)\r?\n---\r?\n([\s\S]*)$/);
|
|
11
11
|
if (!fmMatch) {
|
|
12
12
|
return { frontmatter: null, body: content, metadata: {} };
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
const [,
|
|
15
|
+
const [, rawFrontmatter, body] = fmMatch;
|
|
16
|
+
const frontmatter = rawFrontmatter.replace(/\r\n/g, '\n');
|
|
16
17
|
|
|
17
18
|
// Parse simple YAML key-value pairs
|
|
18
19
|
const metadata = {};
|
|
@@ -244,6 +244,7 @@ export function pruneStaleAiwgFiles(destDir, desiredStems, opts = {}) {
|
|
|
244
244
|
const record = managed[name];
|
|
245
245
|
const owners = [record?.frameworkSlug, ...(Array.isArray(record?.owners) ? record.owners : [])]
|
|
246
246
|
.filter(owner => typeof owner === 'string' && owner.length > 0);
|
|
247
|
+
if (opts.onlyOwner && (!owners.length || owners.some(owner => owner !== opts.onlyOwner))) continue;
|
|
247
248
|
// Wrappers belong to the skill inventory below, not the command inventory.
|
|
248
249
|
const ownerAware = opts.ownerStems instanceof Map && owners.length > 0 && record?.kind !== 'skill-command';
|
|
249
250
|
if (ownerAware ? owners.some(owner => opts.ownerStems.get(owner)?.has(stem)) : desired.has(stem)) continue;
|
|
@@ -275,7 +276,8 @@ export function pruneStaleAiwgFiles(destDir, desiredStems, opts = {}) {
|
|
|
275
276
|
}
|
|
276
277
|
removed.push(target);
|
|
277
278
|
if (dryRun) {
|
|
278
|
-
if (
|
|
279
|
+
if (opts.onlyOwner) console.log(`[dry-run] Would remove ${target} (recorded owner ${opts.onlyOwner} no longer ships this artifact)`);
|
|
280
|
+
else if (verbose) console.log(`[dry-run] would prune stale AIWG artifact: ${path.relative(process.cwd(), target)}`);
|
|
279
281
|
continue;
|
|
280
282
|
}
|
|
281
283
|
try {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { removeSkillCopy } from './skill-copy-prune.mjs';
|
|
3
3
|
import { fs, path } from './base-runtime.mjs';
|
|
4
4
|
import { parseFrontmatter } from './base-frontmatter.mjs';
|
|
5
|
-
import { ensureDir } from './base-files.mjs';
|
|
5
|
+
import { ensureDir, listSkillDirs, readSidecarManifest } from './base-files.mjs';
|
|
6
6
|
import { deploySkillDir, pruneMissingStandardSkills } from './base-skill-copy.mjs';
|
|
7
7
|
|
|
8
8
|
|
|
@@ -30,7 +30,8 @@ export function isKernelSkill(skillDir) {
|
|
|
30
30
|
* Deploy skills with kernel-vs-standard routing (#1212/#1216/#1217).
|
|
31
31
|
*
|
|
32
32
|
* Partitions `skillDirs` into kernel skills (frontmatter `kernel: true`)
|
|
33
|
-
* and standard skills.
|
|
33
|
+
* and standard skills. Project-local skills use the native kernel destination
|
|
34
|
+
* too, so the provider can load them without a framework-index lookup (#4086).
|
|
34
35
|
*
|
|
35
36
|
* **Kernel skills** copy to `kernelDestDir` (platform-native dir,
|
|
36
37
|
* always-loaded by the platform). Small set: currently 24 skills spanning
|
|
@@ -88,7 +89,7 @@ export function deploySkillsWithKernelRouting(
|
|
|
88
89
|
const kernel = [];
|
|
89
90
|
const standard = [];
|
|
90
91
|
for (const dir of skillDirs) {
|
|
91
|
-
if (kernelDestDir && isKernelSkill(dir)) kernel.push(dir);
|
|
92
|
+
if (kernelDestDir && (opts?.deploySource === 'project-local' || isKernelSkill(dir))) kernel.push(dir);
|
|
92
93
|
else standard.push(dir);
|
|
93
94
|
}
|
|
94
95
|
|
|
@@ -322,13 +323,18 @@ export function computeAllKernelNames(srcRoot) {
|
|
|
322
323
|
export function pruneStaleAiwgSkills(kernelDestDir, desiredKernelNames, opts = {}) {
|
|
323
324
|
if ((opts.copyMode ?? opts.copyStandardSkills) || !kernelDestDir || !fs.existsSync(kernelDestDir)) return 0;
|
|
324
325
|
// No global desired set — skip pruning rather than delete everything (#123).
|
|
325
|
-
if (desiredKernelNames == null) return 0;
|
|
326
|
+
if (desiredKernelNames == null && !opts.bundleOnly) return 0;
|
|
326
327
|
if (opts.dryRun) return 0;
|
|
327
|
-
const desired = new Set(desiredKernelNames);
|
|
328
|
+
const desired = new Set(desiredKernelNames || []);
|
|
329
|
+
if (opts.bundleOnly) for (const dir of listSkillDirs(path.join(opts.srcRoot, 'skills')).filter(isKernelSkill)) {
|
|
330
|
+
desired.add(path.basename(dir));
|
|
331
|
+
}
|
|
328
332
|
let pruned = 0;
|
|
329
333
|
for (const entry of fs.readdirSync(kernelDestDir, { withFileTypes: true })) {
|
|
330
334
|
if (!entry.isDirectory()) continue;
|
|
331
335
|
if (desired.has(entry.name)) continue;
|
|
336
|
+
// The bundled corpus cannot declare project-local skills obsolete (#4086).
|
|
337
|
+
if (readSidecarManifest(path.join(kernelDestDir, entry.name))?.managed?.['SKILL.md']?.source === 'project-local') continue;
|
|
332
338
|
|
|
333
339
|
const skillMd = path.join(kernelDestDir, entry.name, 'SKILL.md');
|
|
334
340
|
if (!fs.existsSync(skillMd)) continue;
|
|
@@ -43,7 +43,7 @@ export async function postDeploy(targetDir, opts) {
|
|
|
43
43
|
if (opts.attribution !== false || hooks) {
|
|
44
44
|
const { installAiwgHooks } = await importImpl(import.meta.url, 'extensions/claude-hooks-installer.js');
|
|
45
45
|
const { deploymentOwner } = await importImpl(import.meta.url, 'providers/deployment-ownership.mjs');
|
|
46
|
-
const result = await installAiwgHooks({ frameworkSlug: deploymentOwner(opts), claimUnchangedSettings: !addonPass, projectPath: targetDir,
|
|
46
|
+
const result = await installAiwgHooks({ frameworkSlug: deploymentOwner(opts), claimUnchangedSettings: !addonPass, projectPath: targetDir, commandRoot: opts.logicalOutputPath?.(targetDir),
|
|
47
47
|
frameworkRoot: fileURLToPath(new URL('../../../', import.meta.url)),
|
|
48
48
|
attribution: opts.attribution !== false, hooks, dryRun: opts.dryRun });
|
|
49
49
|
if (!opts.dryRun && result) opts.writtenFiles?.push(result.settingsPath, ...result.installedScripts);
|
|
@@ -14,7 +14,7 @@ export async function postDeploy(targetDir, opts) {
|
|
|
14
14
|
const { installCodexPromptDiscovery } = await importImpl(import.meta.url, 'smiths/hook-bridge/codex-translator.js');
|
|
15
15
|
const packageRoot = fileURLToPath(new URL('../../../', import.meta.url));
|
|
16
16
|
// Runtime hooks belong to this package, even when deploying an external bundle.
|
|
17
|
-
await installCodexPromptDiscovery({ projectPath: targetDir, frameworkRoot: packageRoot, dryRun: opts.dryRun });
|
|
17
|
+
await installCodexPromptDiscovery({ projectPath: targetDir, commandRoot: opts.logicalOutputPath?.(targetDir), frameworkRoot: packageRoot, dryRun: opts.dryRun });
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
if (opts.createAgentsMd) {
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
// Deploy portable Markdown artifacts through the shared rule and skill lifecycle.
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import {
|
|
4
|
+
collectFrameworkArtifacts,
|
|
5
|
+
deployFiles,
|
|
6
|
+
deploySkillsWithKernelRouting,
|
|
7
|
+
ensureDir,
|
|
8
|
+
getAddonAgentFiles,
|
|
9
|
+
getAddonCommandFiles,
|
|
10
|
+
getAddonSkillDirs,
|
|
11
|
+
normalizeDeploymentMode,
|
|
12
|
+
withRuleDeployment,
|
|
13
|
+
} from './base.mjs';
|
|
14
|
+
|
|
15
|
+
export const name = 'generic';
|
|
16
|
+
export const aliases = [];
|
|
17
|
+
export const paths = { agents: 'agents', commands: 'commands', skills: 'skills', rules: 'rules' };
|
|
18
|
+
export const kernelSkillsPath = '.agents/skills';
|
|
19
|
+
// Portable files need an explicit host loader; no native harness features are claimed.
|
|
20
|
+
export const support = { agents: 'context', commands: 'context', skills: 'context', rules: 'context' };
|
|
21
|
+
export const capabilities = { skills: true, rules: true, aggregatedOutput: false, yamlFormat: false, homeDirectoryDeploy: false };
|
|
22
|
+
export const mapModel = model => model;
|
|
23
|
+
export const transformAgent = (_file, content) => content;
|
|
24
|
+
export const transformCommand = (_file, content) => content;
|
|
25
|
+
export const getFileExtension = () => '.md';
|
|
26
|
+
|
|
27
|
+
function deployMarkdown(files, target, directory, opts) {
|
|
28
|
+
const destination = path.join(target, directory);
|
|
29
|
+
ensureDir(destination, opts.dryRun);
|
|
30
|
+
return deployFiles(files, destination, opts).filter(action => action.type === 'deploy').length;
|
|
31
|
+
}
|
|
32
|
+
export const deployAgents = (files, target, opts) => deployMarkdown(files, target, paths.agents, opts);
|
|
33
|
+
export const deployCommands = (files, target, opts) => deployMarkdown(files, target, paths.commands, opts);
|
|
34
|
+
// Activation-selected rules and the bootstrap are projected by withRuleDeployment.
|
|
35
|
+
export const deployRules = () => 0;
|
|
36
|
+
|
|
37
|
+
export function deploySkills(dirs, target, opts) {
|
|
38
|
+
return deploySkillsWithKernelRouting(dirs, path.join(target, paths.skills),
|
|
39
|
+
path.join(target, kernelSkillsPath), opts);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export async function deploy(opts) {
|
|
43
|
+
return withRuleDeployment(opts, { name, paths, kernelSkillsPath }, deploySelected);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
async function deploySelected(opts) {
|
|
47
|
+
const mode = normalizeDeploymentMode(opts.mode);
|
|
48
|
+
const commands = (opts.deployCommands || opts.commandsOnly) && !opts.skillsOnly && !opts.rulesOnly;
|
|
49
|
+
const skills = (opts.deploySkills || opts.skillsOnly) && !opts.commandsOnly && !opts.rulesOnly;
|
|
50
|
+
const agents = !opts.commandsOnly && !opts.skillsOnly && !opts.rulesOnly;
|
|
51
|
+
const selected = collectFrameworkArtifacts(opts.srcRoot, mode, {
|
|
52
|
+
includeAgents: agents, includeCommands: commands, includeSkills: skills, includeRules: false,
|
|
53
|
+
});
|
|
54
|
+
if (['general', 'sdlc', 'both', 'all'].includes(mode)) {
|
|
55
|
+
if (agents) selected.agents.push(...getAddonAgentFiles(opts.srcRoot));
|
|
56
|
+
if (commands) selected.commands.push(...getAddonCommandFiles(opts.srcRoot));
|
|
57
|
+
if (skills) selected.skills.push(...getAddonSkillDirs(opts.srcRoot));
|
|
58
|
+
}
|
|
59
|
+
if (agents) deployAgents(selected.agents, opts.target, opts);
|
|
60
|
+
if (commands) deployCommands(selected.commands, opts.target, opts);
|
|
61
|
+
if (skills) deploySkills([...new Set(selected.skills)], opts.target, opts);
|
|
62
|
+
if (!opts.quiet) console.log('Generic: configure your host to read AGENTS.md; automatic loading and prompt hooks are host dependent.');
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export default { name, aliases, paths, kernelSkillsPath, support, capabilities, mapModel,
|
|
66
|
+
transformAgent, transformCommand, getFileExtension, deployAgents, deployCommands, deploySkills, deployRules, deploy };
|
|
@@ -4,8 +4,8 @@ import { withModelWrapper } from './model-wrapper.mjs';
|
|
|
4
4
|
* Project skills under `.grok/skills`; user home via $GROK_HOME (default ~/.grok).
|
|
5
5
|
* Distinct from grokbot. No bare `grok` alias.
|
|
6
6
|
*
|
|
7
|
-
* Native
|
|
8
|
-
*
|
|
7
|
+
* Native agents use captured name/description frontmatter and a body prompt.
|
|
8
|
+
* Grok 1.0.77 ignores model frontmatter; worker CLI -m controls model selection.
|
|
9
9
|
* Rules are written to .grok/rules and loaded by Grok alongside AGENTS.md.
|
|
10
10
|
*
|
|
11
11
|
* @issue #2575
|
|
@@ -16,12 +16,18 @@ import os from 'node:os';
|
|
|
16
16
|
import fs from 'node:fs';
|
|
17
17
|
import { createHash, randomUUID } from 'node:crypto';
|
|
18
18
|
import yaml from 'js-yaml';
|
|
19
|
+
import { importImpl } from '../../_resolve-impl.mjs';
|
|
20
|
+
const { GROK_BUILD_STANDARD_SKILLS_PATH } = await importImpl(import.meta.url, 'providers/grok-build-paths.js');
|
|
19
21
|
import {
|
|
20
22
|
withRuleDeployment,
|
|
21
23
|
replaceBoundRulesBlock,
|
|
22
24
|
createAgentsMdFromTemplate,
|
|
23
25
|
deploySkillsWithKernelRouting,
|
|
24
26
|
collectFrameworkArtifacts,
|
|
27
|
+
getAddonAgentFiles,
|
|
28
|
+
filterAgentFiles,
|
|
29
|
+
listMdFiles,
|
|
30
|
+
toKebabCase,
|
|
25
31
|
getAddonSkillDirs,
|
|
26
32
|
injectPlatformInContent,
|
|
27
33
|
isKernelSkill,
|
|
@@ -42,7 +48,7 @@ export const paths = {
|
|
|
42
48
|
};
|
|
43
49
|
export const kernelSkillsPath = '.grok/skills';
|
|
44
50
|
/** Standard-tier opt-in mirror (`--copy-all`) lives under the project .aiwg tree. */
|
|
45
|
-
export const standardSkillsPath =
|
|
51
|
+
export const standardSkillsPath = GROK_BUILD_STANDARD_SKILLS_PATH;
|
|
46
52
|
|
|
47
53
|
export const support = {
|
|
48
54
|
agents: 'native',
|
|
@@ -136,9 +142,7 @@ export function deploySkills(skillDirs, targetDir, opts = {}) {
|
|
|
136
142
|
});
|
|
137
143
|
}
|
|
138
144
|
|
|
139
|
-
const WORKER_ROLES = new Set(['reasoning', 'coding', 'efficiency']);
|
|
140
145
|
const ROLE_FROM_ALIAS = { opus: 'reasoning', sonnet: 'coding', haiku: 'efficiency' };
|
|
141
|
-
const GROK_TOOLS = new Set(['Bash', 'Read', 'Write', 'Edit', 'Grep', 'Glob']);
|
|
142
146
|
|
|
143
147
|
/** Grok agent files accept a small YAML frontmatter subset, not AIWG metadata. */
|
|
144
148
|
export const compileGrokAgent = withModelWrapper('grok-build', translateAgent);
|
|
@@ -149,42 +153,34 @@ function translateAgent(source, content, opts = {}) {
|
|
|
149
153
|
if (!metadata || typeof metadata !== 'object' || Array.isArray(metadata)) {
|
|
150
154
|
throw new Error(`${source}: invalid agent frontmatter`);
|
|
151
155
|
}
|
|
152
|
-
const name = metadata.name;
|
|
156
|
+
const name = toKebabCase(metadata.name || path.basename(source, '.md'));
|
|
153
157
|
const role = metadata['model-role'] || ROLE_FROM_ALIAS[metadata.model];
|
|
154
|
-
if (!/^aiwg-model-((reasoning|coding|efficiency)-worker|explorer|verifier)$/.test(String(name)) || !WORKER_ROLES.has(role)) {
|
|
155
|
-
throw new Error(`${source}: Grok Build native compilation currently supports only the five AIWG model wrappers; use aiwg show agent for other roles`);
|
|
156
|
-
}
|
|
157
158
|
if (typeof metadata.description !== 'string' || !metadata.description.trim()) {
|
|
158
159
|
throw new Error(`${source}: agent description is required`);
|
|
159
160
|
}
|
|
160
|
-
|
|
161
|
-
if (!Array.isArray(tools) || tools.some(tool => !GROK_TOOLS.has(tool))) {
|
|
162
|
-
throw new Error(`${source}: unsupported Grok Build tool mapping; supported tools: ${[...GROK_TOOLS].join(', ')}`);
|
|
163
|
-
}
|
|
161
|
+
// Portable tier aliases are intent. Exact pins cannot be honored in Grok agents.
|
|
164
162
|
const sourceModel = String(metadata.model || '').trim();
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
if (configuredModel && (typeof configuredModel !== 'string' || /^(configured\/|inherit$)/.test(configuredModel))) {
|
|
170
|
-
throw new Error(`${source}: unresolved Grok Build ${role} model; configure --${role}-model with a discovered selector`);
|
|
163
|
+
const configuredModel = metadata['model-override'] || opts[`${role}Model`]
|
|
164
|
+
|| opts.modelsConfig?.['grok-build']?.[role]?.model;
|
|
165
|
+
if (configuredModel || (sourceModel && !ROLE_FROM_ALIAS[sourceModel] && sourceModel !== 'inherit')) {
|
|
166
|
+
throw new Error(`${source}: exact model pin is unsupported in Grok Build agents: frontmatter model is ignored. Select a model with -m in the worker CLI invocation instead.`);
|
|
171
167
|
}
|
|
172
168
|
const header = [
|
|
173
169
|
'---',
|
|
174
170
|
`name: ${name}`,
|
|
175
171
|
`description: ${JSON.stringify(metadata.description)}`,
|
|
176
|
-
`tools: ${tools.join(', ')}`,
|
|
177
|
-
...(configuredModel ? [`model: ${JSON.stringify(configuredModel)}`] : []),
|
|
178
172
|
'---',
|
|
179
173
|
];
|
|
180
|
-
const intent =
|
|
181
|
-
? `AIWG model role: ${role}
|
|
182
|
-
|
|
174
|
+
const intent = [
|
|
175
|
+
...(role ? [`AIWG model role: ${role}.`] : []),
|
|
176
|
+
...(metadata['model-tier'] ? [`AIWG model tier intent: ${metadata['model-tier']}.`] : []),
|
|
177
|
+
'Grok Build frontmatter model is ignored; this agent inherits the session model. Role and tier intent do not pin a model. Select the worker model with -m in the CLI invocation.',
|
|
178
|
+
].join(' ');
|
|
183
179
|
return `${header.join('\n')}\n\n${intent}\n\n${match[2].trim()}\n`;
|
|
184
180
|
}
|
|
185
181
|
|
|
186
182
|
export function deployAgents(agentFiles, targetDir, opts = {}) {
|
|
187
|
-
const selected = agentFiles
|
|
183
|
+
const selected = filterAgentFiles(agentFiles, opts);
|
|
188
184
|
const dir = assertSafeNativeDirectory(targetDir, paths.agents);
|
|
189
185
|
for (const source of selected) {
|
|
190
186
|
const dest = path.join(dir, path.basename(source));
|
|
@@ -296,7 +292,7 @@ export function uninstall(target, opts = {}) {
|
|
|
296
292
|
}
|
|
297
293
|
manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf8'));
|
|
298
294
|
for (const [name, record] of Object.entries(manifest.managed ?? {})) {
|
|
299
|
-
if (path.basename(name) !== name ||
|
|
295
|
+
if (path.basename(name) !== name || !name.endsWith('.md')) continue;
|
|
300
296
|
const file = path.join(agentsDir, name);
|
|
301
297
|
const relative = path.relative(root, file);
|
|
302
298
|
if (!fs.existsSync(file) || fs.lstatSync(file).isSymbolicLink() || !fs.lstatSync(file).isFile()) {
|
|
@@ -350,7 +346,7 @@ export async function postDeploy(target, opts = {}) {
|
|
|
350
346
|
console.log(
|
|
351
347
|
`Grok Build (experimental): kernel skills → ${kernelSkillsPath}; ` +
|
|
352
348
|
`standard skills index-driven (opt-in mirror → ${standardSkillsPath} with --copy-all); ` +
|
|
353
|
-
`
|
|
349
|
+
`agents → ${paths.agents}; rules → ${paths.rules}; user home → ${home || '(unresolved GROK_HOME)'}. ` +
|
|
354
350
|
'Distinct from grokbot.',
|
|
355
351
|
);
|
|
356
352
|
}
|
|
@@ -369,23 +365,20 @@ async function deploySelected(opts) {
|
|
|
369
365
|
if (opts.createAgentsMd || (!opts.commandsOnly && !opts.skillsOnly && !opts.rulesOnly)) {
|
|
370
366
|
assertSafeAgentsMd(opts.target);
|
|
371
367
|
}
|
|
372
|
-
const aiwgRoot = resolveAiwgRoot(opts.srcRoot) || opts.srcRoot;
|
|
373
368
|
const skillDirs = [...getAddonSkillDirs(opts.srcRoot)];
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
);
|
|
369
|
+
const artifacts = collectFrameworkArtifacts(opts.srcRoot, mode, {
|
|
370
|
+
includeAgents: true,
|
|
371
|
+
includeCommands: false,
|
|
372
|
+
includeSkills: true,
|
|
373
|
+
includeRules: false,
|
|
374
|
+
});
|
|
375
|
+
skillDirs.push(...artifacts.skills);
|
|
382
376
|
let count = 0;
|
|
383
377
|
if (!opts.commandsOnly && !opts.skillsOnly && !opts.rulesOnly) {
|
|
384
|
-
|
|
385
|
-
const
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
count += deployAgents(workers, opts.target, opts).filter(action => action.type === 'deploy').length;
|
|
378
|
+
// Use the same frozen source root as skills/frameworks, including direct bundles.
|
|
379
|
+
const agents = [...getAddonAgentFiles(opts.srcRoot), ...artifacts.agents,
|
|
380
|
+
...listMdFiles(path.join(opts.srcRoot, 'agents'))];
|
|
381
|
+
count += deployAgents(agents, opts.target, opts).filter(action => action.type === 'deploy').length;
|
|
389
382
|
}
|
|
390
383
|
if (!opts.commandsOnly && !opts.rulesOnly) {
|
|
391
384
|
const result = deploySkills(skillDirs, opts.target, opts);
|
|
@@ -47,8 +47,7 @@ export function withModelWrapper(provider, translate) {
|
|
|
47
47
|
const mapped = translate(source, normalized, opts);
|
|
48
48
|
const notice = `AIWG wrapper tier: ${tier}; catalog role: ${role}. `
|
|
49
49
|
+ `Tier enforcement: ${enforcement}; effort: ${nativeEffort ? `pinned (${nativeEffort})` : 'not enforced per wrapper'}. `
|
|
50
|
-
+ (pin ? `Model selector: ${pin}.` : 'The automatic selector is not a model pin. Model control is inherited or informational; stop unless the conductor confirms the required non-flagship session.')
|
|
51
|
-
+ (provider === 'grok-build' ? ' Native-agent tier enforcement remains gated by #2577; not enforced.' : '');
|
|
50
|
+
+ (pin ? `Model selector: ${pin}.` : 'The automatic selector is not a model pin. Model control is inherited or informational; stop unless the conductor confirms the required non-flagship session.');
|
|
52
51
|
if (provider === 'codex') {
|
|
53
52
|
let output = mapped.replace(/^model = .*$/m, `model = ${JSON.stringify(pin)}`);
|
|
54
53
|
if (!pin) throw new Error(`${source}: Codex wrapper needs a catalog model pin`);
|
|
@@ -62,7 +61,7 @@ export function withModelWrapper(provider, translate) {
|
|
|
62
61
|
if (!target) return `${mapped.trim()}\n\n${notice}\n`;
|
|
63
62
|
const metadata = target.metadata;
|
|
64
63
|
if (pin) metadata[controls.model] = pin;
|
|
65
|
-
else
|
|
64
|
+
else delete metadata.model;
|
|
66
65
|
// Portable input aliases are not provider controls. Emit only the resolved native field.
|
|
67
66
|
for (const key of ['effort', 'model-effort', 'model_reasoning_effort', 'reasoningEffort', 'thinkingLevel']) {
|
|
68
67
|
if (key !== controls.effort || !nativeEffort) delete metadata[key];
|
|
@@ -83,8 +82,6 @@ export function withModelWrapper(provider, translate) {
|
|
|
83
82
|
const nativeHeader = mapped.match(/^---\r?\n([\s\S]*?)\r?\n---\r?\n/)?.[1] ?? '';
|
|
84
83
|
const nativeTools = nativeHeader.match(/^tools:[^\n]*(?:\n[ \t]+- [^\n]*)*/m)?.[0];
|
|
85
84
|
if (nativeTools) header = header.replace(/^tools:[^\n]*(?:\n[ \t]+- [^\n]*)*/m, () => nativeTools);
|
|
86
|
-
// Keep Grok's quoted native model selector, including operator-supplied IDs.
|
|
87
|
-
if (provider === 'grok-build' && metadata.model) header = header.replace(/^model: .*$/m, `model: ${JSON.stringify(metadata.model)}`);
|
|
88
85
|
return `---\n${header}---\n\n${notice}\n\n${target.body.trim()}\n`;
|
|
89
86
|
};
|
|
90
87
|
}
|