@aiwg/cli 2026.10.18 → 2026.11.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.
Files changed (93) hide show
  1. package/README.md +1 -0
  2. package/agentic/code/providers/capability-matrix.yaml +51 -0
  3. package/agentic/code/providers/flue/README.md +62 -0
  4. package/agentic/code/providers/flue/templates/aiwg/tools.ts +120 -0
  5. package/agentic/code/providers/model-capabilities.v1.json +23 -0
  6. package/agentic/code/providers/model-catalog.v1.json +9 -0
  7. package/dist/src/artifacts/corpus-tools/resolve.js +7 -2
  8. package/dist/src/cli/handlers/bundle-declaration.js +55 -0
  9. package/dist/src/cli/handlers/bundle-deployment-mode.js +71 -0
  10. package/dist/src/cli/handlers/bundle-hash-prune.js +37 -0
  11. package/dist/src/cli/handlers/bundle-reconciliation.js +140 -0
  12. package/dist/src/cli/handlers/help.js +1 -1
  13. package/dist/src/cli/handlers/init.js +1 -0
  14. package/dist/src/cli/handlers/refresh-bundles.js +35 -0
  15. package/dist/src/cli/handlers/refresh-rule-inventory.js +10 -0
  16. package/dist/src/cli/handlers/refresh.js +15 -52
  17. package/dist/src/cli/handlers/remove-bundled.js +7 -4
  18. package/dist/src/cli/handlers/remove-flue-modules.js +19 -0
  19. package/dist/src/cli/handlers/remove-historical-bundle.js +18 -0
  20. package/dist/src/cli/handlers/remove.js +8 -0
  21. package/dist/src/cli/handlers/script-runner.js +10 -0
  22. package/dist/src/cli/handlers/subcommands-list-format.js +4 -4
  23. package/dist/src/cli/handlers/update.js +18 -8
  24. package/dist/src/cli/handlers/use-additive-bundles.js +87 -0
  25. package/dist/src/cli/handlers/use-bundle-counts.js +5 -1
  26. package/dist/src/cli/handlers/use-owned-counts.js +75 -0
  27. package/dist/src/cli/handlers/use.js +53 -102
  28. package/dist/src/cli/services/deployment-verification.js +5 -1
  29. package/dist/src/config/aiwg-config.js +10 -5
  30. package/dist/src/config/framework-aliases.js +14 -0
  31. package/dist/src/config/installed-selection.js +9 -1
  32. package/dist/src/config/installed-validation.js +35 -0
  33. package/dist/src/extensions/project-local-doctor.js +1 -1
  34. package/dist/src/extensions/project-local-remove.js +3 -3
  35. package/dist/src/mcp/cli.mjs +12 -7
  36. package/dist/src/mcp/helpers.mjs +5 -1
  37. package/dist/src/mcp/http-options.mjs +101 -0
  38. package/dist/src/mcp/http-tools.mjs +51 -0
  39. package/dist/src/mcp/http-transport.mjs +201 -0
  40. package/dist/src/mcp/server.mjs +9 -7
  41. package/dist/src/mcp/tool-context.mjs +25 -0
  42. package/dist/src/mcp/tools/orchestration.mjs +2 -1
  43. package/dist/src/memory/provider-memory-adapter.js +1 -0
  44. package/dist/src/models/model-capabilities.v1.json +23 -0
  45. package/dist/src/models/model-catalog.v1.json +9 -0
  46. package/dist/src/models/policy-resources.js +1 -1
  47. package/dist/src/providers/capability-matrix.yaml +51 -0
  48. package/dist/src/providers/deployment-ownership.d.mts +2 -1
  49. package/dist/src/providers/deployment-ownership.mjs +27 -3
  50. package/dist/src/providers/deployment-preservation.d.mts +5 -0
  51. package/dist/src/providers/deployment-preservation.mjs +110 -0
  52. package/dist/src/providers/deployment-removal.js +26 -2
  53. package/dist/src/providers/flue-package-mode.js +19 -0
  54. package/dist/src/providers/provider-context-contracts.js +8 -0
  55. package/dist/src/providers/provider-definition-schema.js +1 -0
  56. package/dist/src/providers/provider-definitions.js +1 -0
  57. package/dist/src/providers/provider-seeds-3.js +18 -0
  58. package/dist/src/providers/skill-ownership.d.mts +1 -0
  59. package/dist/src/providers/skill-ownership.mjs +1 -0
  60. package/dist/src/research/reference-match.js +33 -6
  61. package/dist/src/skills/deployment-ownership.js +2 -2
  62. package/dist/src/skills/deployment-policy.js +9 -0
  63. package/dist/src/smiths/context-pipeline/flue-context.js +25 -0
  64. package/dist/src/smiths/context-pipeline/generator.js +6 -1
  65. package/dist/src/smiths/context-pipeline/workspace-bootstrap.js +9 -7
  66. package/package.json +3 -1
  67. package/tools/agents/deploy-agents.mjs +11 -4
  68. package/tools/agents/deploy-options.mjs +11 -0
  69. package/tools/agents/providers/base-inventory.mjs +6 -1
  70. package/tools/agents/providers/base-kernel-skills.mjs +9 -5
  71. package/tools/agents/providers/base-migrations.mjs +1 -0
  72. package/tools/agents/providers/base-skill-copy.mjs +9 -1
  73. package/tools/agents/providers/claude.mjs +2 -1
  74. package/tools/agents/providers/codex.mjs +5 -1
  75. package/tools/agents/providers/flue-bundles.mjs +42 -0
  76. package/tools/agents/providers/flue-cloudflare.mjs +20 -0
  77. package/tools/agents/providers/flue-project.mjs +118 -0
  78. package/tools/agents/providers/flue-skill-copy.mjs +25 -0
  79. package/tools/agents/providers/flue-skills.mjs +45 -0
  80. package/tools/agents/providers/flue-specialists.mjs +82 -0
  81. package/tools/agents/providers/flue-validation.mjs +14 -0
  82. package/tools/agents/providers/flue.mjs +54 -0
  83. package/tools/agents/providers/hermes-skill-lifecycle.mjs +1 -0
  84. package/tools/agents/providers/rule-delivery-surface.mjs +16 -1
  85. package/tools/agents/providers/rule-deployment-commit.mjs +14 -0
  86. package/tools/agents/providers/rule-deployment-prepare.mjs +6 -1
  87. package/tools/agents/providers/rule-startup.mjs +3 -3
  88. package/tools/agents/providers/skill-copy-prune.mjs +49 -0
  89. package/tools/agents/providers/stale-artifact-prune.mjs +1 -0
  90. package/tools/agents/use-rule-selection.mjs +17 -0
  91. package/tools/skills/codex-skill-metadata.mjs +22 -0
  92. package/tools/skills/deploy-skills-codex.mjs +8 -7
  93. package/vscode-extension/schemas/aiwg.config.v1.json +44 -19
@@ -34,6 +34,11 @@ import { getLogger } from '../log.js';
34
34
  import { installCockpit } from './cockpit.js';
35
35
  import { initHandler } from './init.js';
36
36
  import { selectAddonProfile } from './use-addon-profile.js';
37
+ import { deploymentEditWarnings } from '../../providers/deployment-preservation.mjs';
38
+ import { permitsBundleDeployment } from '../../config/installed-selection.js';
39
+ import { bundleDeploymentScope, recordBundleDeployment, copyCleanupArgs, projectLocalDeploymentContext, projectLocalCopyMode } from './bundle-deployment-mode.js';
40
+ import { frameworkAdditiveBundles, getAllAddons, getAllExtensions } from './use-additive-bundles.js';
41
+ export { getAllAddons, getAllExtensions, USE_ALL_DISALLOW, USE_ALL_EXTENSIONS_DISALLOW } from './use-additive-bundles.js';
37
42
  import { checkCollisions, formatCollisionReport, hasBlockingCollisions, } from '../../smiths/skillsmith/collision-detector.js';
38
43
  import { discoverProjectLocalBundles, } from '../../extensions/project-local-discovery.js';
39
44
  import { PROJECT_LOCAL_TYPE_TO_DIR } from '../../extensions/project-local-paths.js';
@@ -64,6 +69,7 @@ const PREPARABLE_BUILTIN_PROVIDERS = new Set(['claude', 'codex', 'cursor', 'herm
64
69
  // Distinct from agentsmith (which creates subagent personas).
65
70
  import { generate as generateContextFiles, discoverDeployedArtifacts, } from '../../smiths/context-pipeline/index.js';
66
71
  import { verifyModelWrapperDeployment } from '../../models/wrapper-deployment.js';
72
+ import { countRecordedFrameworkArtifacts, receiptIncludesOwner } from './use-owned-counts.js';
67
73
  import { countDeployedBundleFiles, countDeployedBundleRules } from './use-bundle-counts.js';
68
74
  import { reconcileDeployedSkillAssets } from './use-skill-assets.js';
69
75
  import { aggregateUseDeploymentResult, buildDryRunUseResult, renderUseDeploymentResult, verifyProviderDeployment, } from '../services/deployment-verification.js';
@@ -263,32 +269,6 @@ const FRAMEWORK_DIR_MAP = {
263
269
  export function resolveFrameworkDir(framework) {
264
270
  return FRAMEWORK_DIR_MAP[framework];
265
271
  }
266
- /**
267
- * Addons excluded from `aiwg use all`.
268
- * aiwg-dev is contributor-only tooling — not for end users.
269
- */
270
- export const USE_ALL_DISALLOW = new Set(['aiwg-dev']);
271
- /**
272
- * Whether an addon's manifest keeps it out of bulk deploys (#2641).
273
- *
274
- * `devOnly` marks contributor tooling; `explicitInstall` marks an addon that is
275
- * deployed only when named, such as `aiwg use decision-engine`. Both match
276
- * `discoverAddons()` in tools/agents/providers/base.mjs, which applies the same
277
- * rule to framework-mode deploys.
278
- *
279
- * `autoInstall: false` is deliberately NOT an exclusion signal: most addons
280
- * declare it (and the extension manifest schema defaults to it), so honoring
281
- * it would drop most addons from `all` for existing users.
282
- */
283
- async function isExplicitOnlyAddon(addonDir) {
284
- try {
285
- const manifest = JSON.parse(await fs.readFile(path.join(addonDir, 'manifest.json'), 'utf8'));
286
- return manifest?.devOnly === true || manifest?.explicitInstall === true;
287
- }
288
- catch {
289
- return false;
290
- }
291
- }
292
272
  /** Full-framework setup requires the corpus omitted by the lightweight CLI. */
293
273
  async function bundledSetupPrerequisiteMessage(frameworkRoot) {
294
274
  let packageName;
@@ -319,57 +299,6 @@ async function bundledSetupPrerequisiteMessage(frameworkRoot) {
319
299
  '@aiwg/cli can still query signed web resources and deploy external project-local bundles.',
320
300
  ].join('\n');
321
301
  }
322
- /**
323
- * Discover all addon names from the filesystem, minus the disallow list and
324
- * addons whose manifest restricts them to explicit installs.
325
- */
326
- export async function getAllAddons(frameworkRoot) {
327
- const addonsDir = path.join(frameworkRoot, 'agentic/code/addons');
328
- const entries = await fs.readdir(addonsDir, { withFileTypes: true });
329
- const candidates = entries.filter(e => e.isDirectory() && !USE_ALL_DISALLOW.has(e.name));
330
- const excluded = await Promise.all(candidates.map(e => isExplicitOnlyAddon(path.join(addonsDir, e.name))));
331
- return candidates.filter((_, index) => !excluded[index]).map(e => e.name);
332
- }
333
- /**
334
- * Extensions excluded from `aiwg use all` deployment.
335
- * `api-adapter` is an OpenAPI spec, not a deployable artifact bundle.
336
- */
337
- export const USE_ALL_EXTENSIONS_DISALLOW = new Set(['api-adapter']);
338
- /**
339
- * Discover all extension names from `agentic/code/extensions/*` (#1221).
340
- *
341
- * Extensions are addon-shaped bundles with their own `manifest.json`,
342
- * `skills/`, `rules/`, and `templates/` directories. Only directories
343
- * containing a `manifest.json` are considered deployable; bare directories
344
- * (e.g. `api-adapter` which only ships an OpenAPI spec) are skipped.
345
- */
346
- export async function getAllExtensions(frameworkRoot) {
347
- const extensionsDir = path.join(frameworkRoot, 'agentic/code/extensions');
348
- let entries;
349
- try {
350
- entries = await fs.readdir(extensionsDir, { withFileTypes: true });
351
- }
352
- catch {
353
- return [];
354
- }
355
- const result = [];
356
- for (const entry of entries) {
357
- if (!entry.isDirectory())
358
- continue;
359
- if (USE_ALL_EXTENSIONS_DISALLOW.has(entry.name))
360
- continue;
361
- const manifestPath = path.join(extensionsDir, entry.name, 'manifest.json');
362
- try {
363
- await fs.access(manifestPath);
364
- result.push(entry.name);
365
- }
366
- catch {
367
- // Directory without a manifest is not deployable as an extension.
368
- continue;
369
- }
370
- }
371
- return result;
372
- }
373
302
  /**
374
303
  * Resolve extension source path from its name.
375
304
  */
@@ -512,8 +441,8 @@ export function gitignorePatternsForDeploy(provider) {
512
441
  return [...AIWG_RUNTIME_PATTERNS, ...(PROVIDER_GENERATED_GITIGNORE_PATTERNS[provider] ?? [])];
513
442
  }
514
443
  export async function ensureProviderGeneratedDirsIgnored(projectRoot, provider, opts) {
515
- if (opts.dryRun)
516
- return;
444
+ if (opts.dryRun || provider === 'flue')
445
+ return; // Flue records its ignore edit inside the provider transaction.
517
446
  const patterns = gitignorePatternsForDeploy(provider);
518
447
  if (patterns.length === 0)
519
448
  return;
@@ -558,7 +487,7 @@ const MIRRORED_KERNEL_COMMAND_SKILLS = new Set([
558
487
  'use',
559
488
  'steward',
560
489
  ]);
561
- function shouldMirrorStandardCommandSkill(skillName) {
490
+ export function shouldMirrorStandardCommandSkill(skillName) {
562
491
  return skillName.startsWith('flow-') || MIRRORED_STANDARD_COMMAND_SKILLS.has(skillName);
563
492
  }
564
493
  function shouldMirrorKernelCommandSkill(skillName) {
@@ -1073,7 +1002,8 @@ async function countDeployedBundleSkills(bundlePath, target, provider) {
1073
1002
  let found = false;
1074
1003
  for (const dir of uniqueCandidateDirs) {
1075
1004
  for (const name of names) {
1076
- if (!(await fileExists(path.join(dir, name, 'SKILL.md'))))
1005
+ if (!(await fileExists(path.join(dir, name, 'SKILL.md')))
1006
+ || !await receiptIncludesOwner(path.join(dir, name, 'SKILL.md'), new Set([path.basename(bundlePath)])))
1077
1007
  continue;
1078
1008
  count++;
1079
1009
  found = true;
@@ -1164,7 +1094,7 @@ async function deployOneProjectLocalBundle(opts) {
1164
1094
  // graph. Without --copy-all, the bundle's rules deploy but its skills
1165
1095
  // never reach <provider>/.aiwg/skills/, leaving them invisible to
1166
1096
  // both the platform and the index.
1167
- '--copy-all',
1097
+ '--copy-all', ...copyCleanupArgs(ctx.args),
1168
1098
  // That copy-all is the deployer's doing, not the operator's, so the
1169
1099
  // provider's startup listing cap still applies; overflow lands on the
1170
1100
  // standard tier instead of over the cap (#2561).
@@ -1257,8 +1187,8 @@ async function deployProjectLocalBundles(opts) {
1257
1187
  }
1258
1188
  const targetBundles = onlyBundleId
1259
1189
  ? discovery.bundles.filter(b => b.id === onlyBundleId)
1260
- : discovery.bundles.filter(b => b.type !== 'provider');
1261
- if (targetBundles.length === 0) {
1190
+ : discovery.bundles.filter(b => b.type !== 'provider' && permitsBundleDeployment(projectDir, b.id, provider));
1191
+ if (targetBundles.length === 0 && discovery.bundles.length === 0) {
1262
1192
  if (!onlyBundleId) {
1263
1193
  const { hasProjectQuickref, deployProjectQuickref } = await import('../../extensions/project-quickref.js');
1264
1194
  try {
@@ -1328,7 +1258,7 @@ async function deployProjectLocalBundles(opts) {
1328
1258
  }
1329
1259
  }
1330
1260
  const result = await deployOneProjectLocalBundle({
1331
- bundle, ctx, frameworkRoot, provider, target, dryRun, verbose, quiet, modelArgs,
1261
+ bundle, ctx: await projectLocalDeploymentContext(ctx, projectDir, bundle.id, provider, Boolean(onlyBundleId)), frameworkRoot, provider, target, dryRun, verbose, quiet, modelArgs,
1332
1262
  });
1333
1263
  if (result.exitCode !== 0) {
1334
1264
  failed++;
@@ -1376,10 +1306,12 @@ async function deployProjectLocalBundles(opts) {
1376
1306
  localPath: bundle.localPath,
1377
1307
  localType: bundle.type,
1378
1308
  manifestVersion: bundle.manifest.manifestVersion,
1309
+ copy: projectLocalCopyMode(config, bundle.id, provider, ctx.args, Boolean(onlyBundleId)),
1379
1310
  artifactHashes,
1380
1311
  deployedArtifactHashes,
1381
1312
  });
1382
1313
  await writeAiwgConfig(projectDir, updated);
1314
+ await recordBundleDeployment(projectDir, bundle.id, provider, updated.installed[bundle.id].deployedTo[provider].copy ? ['--copy-all'] : [], frameworkRoot);
1383
1315
  }
1384
1316
  catch (err) {
1385
1317
  // Non-fatal: deploy already succeeded
@@ -1390,7 +1322,7 @@ async function deployProjectLocalBundles(opts) {
1390
1322
  // Automatic reconciliation (also used by refresh/upgrade) must restore the
1391
1323
  // project search cache for existing bundles, just as a named local install
1392
1324
  // does. Named installs refresh once after all selected providers finish.
1393
- if (deployed > 0 && !dryRun && !onlyBundleId) {
1325
+ if (discovery.bundles.length > 0 && !dryRun && !onlyBundleId) {
1394
1326
  try {
1395
1327
  await rebuildExternalBundleIndex(projectDir, 'project', verbose);
1396
1328
  }
@@ -1459,7 +1391,7 @@ for (const flag of [...MODEL_DEPLOY_VALUE_FLAGS, '--reasoning', '--coding', '--e
1459
1391
  USE_FLAGS_WITH_VALUES.add(flag);
1460
1392
  }
1461
1393
  const USE_BOOLEAN_FLAGS = new Set([
1462
- '--force', '--copy-all', '--copy-standard-skills', '--dry-run', '--verbose', '-v', '--quiet', '-q',
1394
+ '--package', '--force', '--copy-all', '--copy-standard-skills', '--dry-run', '--verbose', '-v', '--quiet', '-q',
1463
1395
  '--json', '--no-project-local', '--no-context-files', '--no-workspace-md',
1464
1396
  '--no-aiwg-md', '--no-agents-md', '--force-context-files', '--global', '--user',
1465
1397
  '--no-utils', '--ci-hooks-enabled', '--skip-conflicts', '--no-harness-agents',
@@ -1467,7 +1399,7 @@ const USE_BOOLEAN_FLAGS = new Set([
1467
1399
  '--allow-over-budget', '--no-hooks', '--no-attribution', '--enable-cross-provider-hooks',
1468
1400
  '--skip-commands-migration', '--listing-budget', '--mcp', '--as-agents-md',
1469
1401
  '--create-agents-md', '--commands-only', '--skills-only', '--rules-only',
1470
- '--save', '--save-user', '--help', '-h',
1402
+ '--declare', '--save', '--save-user', '--help', '-h',
1471
1403
  ]);
1472
1404
  export function validateUseOptions(args, preparedCapabilities = new Set()) {
1473
1405
  for (let i = 0; i < args.length; i++) {
@@ -1512,6 +1444,11 @@ async function generateDeploymentContextFiles(options) {
1512
1444
  let useDeployment;
1513
1445
  function useDeploymentArgs(args) {
1514
1446
  const forwarded = [...args];
1447
+ const modeIndex = args.indexOf('--mode');
1448
+ if (useDeployment && modeIndex >= 0)
1449
+ useDeployment.ruleSelectionMode ??= args[modeIndex + 1];
1450
+ if (useDeployment?.ruleSelectionMode && !forwarded.includes('--rule-selection-mode'))
1451
+ forwarded.push('--rule-selection-mode', useDeployment.ruleSelectionMode);
1515
1452
  if (useDeployment && !forwarded.includes('--deploy-version'))
1516
1453
  forwarded.push('--deploy-version', useDeployment.version);
1517
1454
  if (useDeployment?.skipContextFiles && !forwarded.includes('--no-context-files'))
@@ -2329,6 +2266,7 @@ Additional options:
2329
2266
  --providers <a,b> Providers for global bootstrap
2330
2267
  --prefix <dir> Alias for --target
2331
2268
  --global, --user Install to user scope
2269
+ --package Flue: import skills from @aiwg/flue; persist across update/refresh
2332
2270
  --copy-standard-skills Alias for --copy-all (also restores the full surface)
2333
2271
  --profile <name> Select workspace profile (implicit target: all)
2334
2272
  --workspace-signals Show the workspace signal plan
@@ -2340,6 +2278,7 @@ Additional options:
2340
2278
  --filter <glob>, --filter-role <role>
2341
2279
  Filter deployed agents
2342
2280
  --save, --save-user Persist model selection
2281
+ --declare Declare a bundle for --provider without deploying (project scope)
2343
2282
  --no-utils Skip additive addon and extension passes
2344
2283
  --no-workspace-md, --no-aiwg-md, --no-agents-md
2345
2284
  Suppress individual context files
@@ -2380,6 +2319,8 @@ export class UseHandler {
2380
2319
  return { exitCode: 0, message: USE_HELP, rawOutput: true };
2381
2320
  }
2382
2321
  async execute(ctx) {
2322
+ if (ctx.args.includes('--declare'))
2323
+ return (await import('./bundle-declaration.js')).declareBundle(ctx);
2383
2324
  let resourceCredentials = useDeployment?.resourceCredentials;
2384
2325
  try {
2385
2326
  if (!resourceCredentials) {
@@ -2396,6 +2337,7 @@ export class UseHandler {
2396
2337
  const previousDeployment = useDeployment;
2397
2338
  useDeployment = {
2398
2339
  resourceCredentials,
2340
+ ruleSelectionMode: previousDeployment?.ruleSelectionMode,
2399
2341
  version: previousDeployment?.version ?? resolveDeployVersion(ctx.frameworkRoot || await getFrameworkRoot()),
2400
2342
  skipAttribution: previousDeployment?.skipAttribution || ctx.args.includes('--no-attribution'),
2401
2343
  skipContextFiles: previousDeployment?.skipContextFiles || ctx.args.includes('--no-context-files'),
@@ -2537,6 +2479,11 @@ export class UseHandler {
2537
2479
  console.error = originalConsole.error;
2538
2480
  }
2539
2481
  }
2482
+ if (coreResult.exitCode === 0 && !dryRun)
2483
+ for (const provider of providers) {
2484
+ for (const warning of deploymentEditWarnings(projectDir, provider))
2485
+ originalConsole.warn(warning);
2486
+ }
2540
2487
  let result;
2541
2488
  if (dryRun && coreResult.exitCode === 0) {
2542
2489
  result = buildDryRunUseResult({
@@ -3210,7 +3157,9 @@ export class UseHandler {
3210
3157
  // project. Unlike a full framework deploy, its standard skills cannot be
3211
3158
  // left index-only: the user asked to install this specific bundle and
3212
3159
  // its supporting scripts must travel with the skill directory.
3213
- addonBaseArgs.push('--copy-all');
3160
+ addonBaseArgs.push('--copy-all', ...copyCleanupArgs(remainingArgs));
3161
+ if (provider === 'flue' && remainingArgs.includes('--package'))
3162
+ addonBaseArgs.push('--package');
3214
3163
  addonBaseArgs.push(...modelDeployArgs);
3215
3164
  if (provider)
3216
3165
  addonBaseArgs.push('--provider', provider);
@@ -3225,7 +3174,7 @@ export class UseHandler {
3225
3174
  addonBaseArgs.push('--dry-run');
3226
3175
  if (remainingArgs.includes('--force'))
3227
3176
  addonBaseArgs.push('--force');
3228
- const activationOrder = isAddon
3177
+ const activationOrder = isAddon && provider !== 'flue'
3229
3178
  ? await resolveRequiredAddonActivationOrder(frameworkRoot, framework)
3230
3179
  : [framework];
3231
3180
  const requiredAddons = activationOrder.slice(0, -1);
@@ -3362,8 +3311,11 @@ export class UseHandler {
3362
3311
  source: 'bundled',
3363
3312
  manifestHash: await hashManifest(manifestPath),
3364
3313
  asPrimary: Boolean(explicitAddonProvider),
3314
+ package: provider === 'flue' ? remainingArgs.includes('--package') : undefined,
3315
+ copy: remainingArgs.includes('--copy-all') || remainingArgs.includes('--copy-standard-skills'),
3365
3316
  });
3366
3317
  await writeAiwgConfig(projectDir, updated);
3318
+ await recordBundleDeployment(projectDir, framework, provider, remainingArgs, frameworkRoot);
3367
3319
  config = updated;
3368
3320
  }
3369
3321
  catch (error) {
@@ -3568,8 +3520,7 @@ export class UseHandler {
3568
3520
  && !remainingArgs.includes('--copy-standard-skills');
3569
3521
  if (bulkKernelOnly)
3570
3522
  providerDeployArgs.push('--kernel-only');
3571
- const allAddons = skipUtils ? [] : await getAllAddons(frameworkRoot);
3572
- const allExtensions = skipUtils || bulkKernelOnly ? [] : await getAllExtensions(frameworkRoot);
3523
+ const { addons: allAddons, extensions: allExtensions } = await frameworkAdditiveBundles(frameworkRoot, provider, skipUtils, bulkKernelOnly);
3573
3524
  const mainIncludesAddons = mainDeploymentIncludesAddons(provider, mode, providerDeployArgs);
3574
3525
  // OMP's extension sources share the root transaction and binding scan.
3575
3526
  // Their CLI contributions are still registered below in source order.
@@ -3806,7 +3757,7 @@ export class UseHandler {
3806
3757
  // Deploy project-local bundles (#1035). Auto-runs after upstream addons unless
3807
3758
  // --no-project-local. Idempotent — overwrites prior deploys. Skipped under
3808
3759
  // --dry-run-disabled scenarios for safety; --dry-run is honored and logged.
3809
- if (!skipProjectLocal) {
3760
+ if (!skipProjectLocal && provider !== 'flue') {
3810
3761
  const plResult = await deployProjectLocalBundles({
3811
3762
  ctx,
3812
3763
  frameworkRoot,
@@ -3830,7 +3781,7 @@ export class UseHandler {
3830
3781
  // Pi model selection/headless routing is delivered by #2151. Until that
3831
3782
  // adapter exists, do not require model-wrapper artifacts that Pi cannot
3832
3783
  // load; resource deployment remains independently valid.
3833
- if (!dryRun && !skipUtils && !bulkKernelOnly && !['pi', 'omp'].includes(provider)) {
3784
+ if (!dryRun && !skipUtils && !bulkKernelOnly && !['pi', 'omp', 'flue'].includes(provider)) {
3834
3785
  const wrapperValidation = await validateDeployedModelWrappers({
3835
3786
  provider,
3836
3787
  target,
@@ -3978,7 +3929,7 @@ export class UseHandler {
3978
3929
  if (!prebuilt && await fs.access(path.join(aiwgRootForIndex, 'prebuilt', 'framework-relations', 'manifest.json')).then(() => true).catch(() => false)) {
3979
3930
  const { selectPrebuiltRelations } = await import('../../artifacts/relations.js');
3980
3931
  const reason = selectPrebuiltRelations(aiwgRootForIndex).reason ?? 'packaged search index is missing, stale, or does not match the source';
3981
- ui.dim(` Packaged index unavailable: ${reason}.`);
3932
+ ui.dim(verbose ? ` Packaged index unavailable: ${reason}.` : ' Packaged index unavailable; rebuilding capability index.');
3982
3933
  }
3983
3934
  ui.dim(' Indexing operational assets for agent-side lookup.');
3984
3935
  const indexStart = Date.now();
@@ -4012,7 +3963,8 @@ export class UseHandler {
4012
3963
  // registry record written below (#621) reflects the real deploy even on
4013
3964
  // a verbose run — the prior `if (quiet)` guard left the record
4014
3965
  // `{agents: 0, commands: 0, skills: 0, rules: 0}` on `-v` runs.
4015
- const counts = await countDeployedArtifacts(target, paths, provider);
3966
+ const counts = dryRun ? await countDeployedArtifacts(target, paths, provider)
3967
+ : await countRecordedFrameworkArtifacts(target, provider, framework, frameworkRoot, remainingArgs);
4016
3968
  // Deploy CI workflow files when --ci-hooks-enabled is set (#661)
4017
3969
  if (ciHooksEnabled) {
4018
3970
  await deployCiHooks({ frameworkRoot, framework, target, dryRun });
@@ -4198,18 +4150,17 @@ export class UseHandler {
4198
4150
  if (!frameworkManifestPath)
4199
4151
  throw new Error('no manifest for general/writing mode');
4200
4152
  const mHash = await hashManifest(frameworkManifestPath);
4201
- const updatedConfig = updateInstalled(config, framework, provider, {
4202
- agents: counts.agents,
4203
- commands: counts.commands,
4204
- skills: counts.skills,
4205
- rules: counts.rules,
4206
- }, {
4153
+ const updatedConfig = updateInstalled(config, framework, provider, counts, {
4207
4154
  version: versionInfo.version,
4208
4155
  source: 'bundled',
4209
4156
  manifestHash: mHash,
4210
4157
  asPrimary: Boolean(explicitProvider),
4158
+ package: provider === 'flue' ? remainingArgs.includes('--package') : undefined,
4159
+ copy: remainingArgs.includes('--copy-all') || remainingArgs.includes('--copy-standard-skills'),
4160
+ ...bundleDeploymentScope(framework, provider, remainingArgs),
4211
4161
  });
4212
4162
  await writeAiwgConfig(projectDir, updatedConfig);
4163
+ await recordBundleDeployment(projectDir, framework, provider, remainingArgs, frameworkRoot);
4213
4164
  }
4214
4165
  catch {
4215
4166
  // Non-fatal: config tracking failure must not block deployment
@@ -8,12 +8,16 @@ import { inspectInstallation } from '../../installation/manager.mjs';
8
8
  import { getPackageRoot } from '../../channel/manager.mjs';
9
9
  import { getProviderDefinition, normalizeProviderDefinitionId, resolveProviderPathValue, } from '../../providers/provider-definitions.js';
10
10
  import { resolveGrokbotSkillsDir } from '../../providers/grokbot-paths.js';
11
+ import { hasFluePackageDeployment } from '../../providers/flue-package-mode.js';
11
12
  import { resolveGrokHome } from '../../providers/grok-build-paths.js';
12
13
  import { runGrokInspect } from '../../providers/grok-build-inspect.js';
13
14
  import { diagnoseIntegratedProviderTransformationReceipt } from '../../providers/transformation-receipt-integration.js';
14
15
  import { diagnoseWorkspaceContext, providerContextContract, } from '../../smiths/context-pipeline/workspace-context.js';
15
16
  import { USER_SCOPE_PATHS } from '../scope-resolver.js';
16
17
  const RESTART_NOTICES = {
18
+ flue: { policy: 'restart-required',
19
+ action: 'Restart the Flue app before checking deployed context and skills.',
20
+ reason: 'Flue is experimental; app hot reload of deployed context and skills has not been verified.' },
17
21
  claude: {
18
22
  policy: 'restart-required',
19
23
  action: 'Restart Claude Code so the running session reloads deployed agents and skills.',
@@ -430,7 +434,7 @@ export async function verifyProviderDeployment(options) {
430
434
  if (kernelPath && kernelPath !== resolvedSkillsPath)
431
435
  counts.skills += kernelCount;
432
436
  const artifactTotal = Object.values(counts).reduce((sum, value) => sum + value, 0);
433
- if (artifactTotal === 0) {
437
+ if (artifactTotal === 0 && !(normalized === 'flue' && await hasFluePackageDeployment(options.projectRoot))) {
434
438
  // Bridge-only providers (e.g. grokbot project scope without skills env)
435
439
  // intentionally have null native artifact dirs and land AGENTS.md instead.
436
440
  const bridgeName = definition.paths.configFile || definition.paths.contextFiles?.contextFile;
@@ -1,3 +1,4 @@
1
+ import { validateInstalled } from './installed-validation.js';
1
2
  import { preserveInstalledSelection } from './installed-selection.js';
2
3
  import { validateHitlPolicy } from '../policy/hitl-validation.js';
3
4
  import { normalizeAiwgConfigCandidate } from './config-normalization.js';
@@ -1157,6 +1158,9 @@ export function updateInstalled(config, name, provider, counts, opts) {
1157
1158
  throw new Error(`updateInstalled: source 'project-local' requires localPath and localType (got ${JSON.stringify({ localPath: opts.localPath, localType: opts.localType })})`);
1158
1159
  }
1159
1160
  }
1161
+ validateInstalled({ [name]: { version: opts.version, source: opts.source, installedAt: new Date().toISOString(),
1162
+ deployedTo: { [provider]: { agents: counts.agents, commands: counts.commands, skills: counts.skills, rules: counts.rules,
1163
+ copy: opts.copy, package: opts.package, skipUtils: opts.skipUtils, kernelOnly: opts.kernelOnly } } } });
1160
1164
  const existing = config.installed[name] ?? {
1161
1165
  version: opts.version,
1162
1166
  source: opts.source,
@@ -1167,7 +1171,8 @@ export function updateInstalled(config, name, provider, counts, opts) {
1167
1171
  existing.version = opts.version;
1168
1172
  existing.source = opts.source;
1169
1173
  existing.installedAt = new Date().toISOString();
1170
- existing.deployedTo[provider] = counts;
1174
+ existing.deployedTo[provider] = { ...counts, ...(opts.package === undefined ? {} : { package: opts.package }), ...(opts.copy === undefined ? {} : { copy: opts.copy }),
1175
+ ...(opts.skipUtils === undefined ? {} : { skipUtils: opts.skipUtils }), ...(opts.kernelOnly === undefined ? {} : { kernelOnly: opts.kernelOnly }) };
1171
1176
  if (opts.manifestHash)
1172
1177
  existing.manifestHash = opts.manifestHash;
1173
1178
  if (opts.source === 'project-local') {
@@ -1208,10 +1213,10 @@ export function getDeploymentSummary(config, provider) {
1208
1213
  const counts = entry.deployedTo[targetProvider];
1209
1214
  if (!counts)
1210
1215
  continue;
1211
- totals.agents += counts.agents;
1212
- totals.commands += counts.commands;
1213
- totals.skills += counts.skills;
1214
- totals.rules += counts.rules;
1216
+ totals.agents += counts.agents ?? 0;
1217
+ totals.commands += counts.commands ?? 0;
1218
+ totals.skills += counts.skills ?? 0;
1219
+ totals.rules += counts.rules ?? 0;
1215
1220
  }
1216
1221
  return totals;
1217
1222
  }
@@ -8,5 +8,19 @@ export const REGISTRY_ID_TO_USE_NAME = {
8
8
  'media-curator': 'media-curator',
9
9
  'research-complete': 'research',
10
10
  'forensics-complete': 'forensics',
11
+ dfir: 'forensics',
12
+ 'ops-complete': 'ops',
13
+ 'validation-complete': 'validation',
11
14
  };
15
+ // Reverse aliases without letting a secondary alias (dfir) replace the canonical ID.
16
+ const USE_NAME_TO_REGISTRY_ID = {
17
+ ...Object.fromEntries(Object.entries(REGISTRY_ID_TO_USE_NAME).reverse().map(([id, alias]) => [alias, id])),
18
+ general: 'writing-quality',
19
+ writing: 'writing-quality',
20
+ };
21
+ /** Resolve a use name or legacy alias to its canonical bundle directory. */
22
+ export function frameworkRegistryId(name) {
23
+ const useName = REGISTRY_ID_TO_USE_NAME[name] ?? name;
24
+ return USE_NAME_TO_REGISTRY_ID[useName] ?? name;
25
+ }
12
26
  //# sourceMappingURL=framework-aliases.js.map
@@ -1,7 +1,7 @@
1
1
  // Keep automatic redeployment from changing the explicitly installed selection.
2
2
  import { AsyncLocalStorage } from 'node:async_hooks';
3
3
  import { resolve } from 'node:path';
4
- import { REGISTRY_ID_TO_USE_NAME } from './framework-aliases.js';
4
+ import { REGISTRY_ID_TO_USE_NAME, frameworkRegistryId } from './framework-aliases.js';
5
5
  const selection = new AsyncLocalStorage();
6
6
  export function withInstalledSelection(project, installed, deploy) {
7
7
  return selection.run({ project: resolve(project), installed: structuredClone(installed) }, deploy);
@@ -19,4 +19,12 @@ export function preserveInstalledSelection(project, config) {
19
19
  ]));
20
20
  return guarded;
21
21
  }
22
+ /** Automatic framework passes cannot reinstall a local bundle the operator undeclared. */
23
+ export function permitsBundleDeployment(project, id, provider) {
24
+ const current = selection.getStore();
25
+ if (!current || current.project !== resolve(project) || current.installed === undefined)
26
+ return true;
27
+ const entry = Object.entries(current.installed).find(([key]) => frameworkRegistryId(key) === frameworkRegistryId(id))?.[1];
28
+ return Boolean(entry?.deployedTo?.[provider]);
29
+ }
22
30
  //# sourceMappingURL=installed-selection.js.map
@@ -0,0 +1,35 @@
1
+ // Validate new declarations and deployment writes without rejecting historical reads.
2
+ const object = (value) => !!value && typeof value === 'object' && !Array.isArray(value);
3
+ const kinds = ['agents', 'commands', 'skills', 'rules'];
4
+ export function validateInstalled(installed) {
5
+ if (installed === undefined)
6
+ return;
7
+ if (!object(installed))
8
+ throw new Error('installed must be an object');
9
+ for (const [id, entry] of Object.entries(installed)) {
10
+ if (!object(entry) || !object(entry.deployedTo))
11
+ throw new Error(`installed.${id}.deployedTo must be an object`);
12
+ let deployed = false;
13
+ for (const [provider, counts] of Object.entries(entry.deployedTo)) {
14
+ if (!object(counts))
15
+ throw new Error(`installed.${id}.deployedTo.${provider} must be an object`);
16
+ for (const flag of ['copy', 'skipUtils', 'kernelOnly']) {
17
+ if (counts[flag] !== undefined && typeof counts[flag] !== 'boolean')
18
+ throw new Error(`installed.${id}.deployedTo.${provider}.${flag} must be boolean`);
19
+ }
20
+ if (counts.package !== undefined && (typeof counts.package !== 'boolean' || provider !== 'flue'))
21
+ throw new Error(`installed.${id}.deployedTo.${provider}.package requires Flue and a boolean`);
22
+ if (!Object.keys(counts).some(key => !['copy', 'package', 'skipUtils', 'kernelOnly'].includes(key)))
23
+ continue;
24
+ if (kinds.some(kind => !Number.isSafeInteger(counts[kind]) || counts[kind] < 0)) {
25
+ throw new Error(`installed.${id}.deployedTo.${provider} requires all four nonnegative artifact counts or {}`);
26
+ }
27
+ deployed = true;
28
+ }
29
+ if (deployed || ['version', 'source', 'installedAt'].some(key => entry[key] !== undefined)) {
30
+ if (['version', 'source', 'installedAt'].some(key => typeof entry[key] !== 'string' || !entry[key]))
31
+ throw new Error(`installed.${id} requires version, source and installedAt after deployment`);
32
+ }
33
+ }
34
+ }
35
+ //# sourceMappingURL=installed-validation.js.map
@@ -332,7 +332,7 @@ export async function buildProjectLocalDoctorSection(opts) {
332
332
  const c = entry.deployedTo[p];
333
333
  if (!c)
334
334
  return '-'.padEnd(8);
335
- const total = c.agents + c.commands + c.skills + c.rules;
335
+ const total = (c.agents ?? 0) + (c.commands ?? 0) + (c.skills ?? 0) + (c.rules ?? 0);
336
336
  return `✓ ${total}`.padEnd(8);
337
337
  }).join('');
338
338
  lines.push(` ${name.padEnd(20)}${cells}`);
@@ -13,7 +13,7 @@
13
13
  * @implements #1037
14
14
  */
15
15
  import { lstat, readdir, readFile, stat, unlink, rmdir } from 'fs/promises';
16
- import { resolve, join, relative, dirname, isAbsolute } from 'path';
16
+ import { resolve, join, relative, dirname, isAbsolute, sep } from 'path';
17
17
  import { deployedSkillRoots } from '../providers/deployed-skill-roots.js';
18
18
  import { releaseSkillOwnership } from '../providers/skill-ownership.mjs';
19
19
  import { appendProjectLocalActivity } from './project-local-activity.js';
@@ -263,7 +263,7 @@ export async function removeProjectLocalBundle(config, projectDir, bundleId, opt
263
263
  // retired skills no longer present in the source inventory.
264
264
  const receiptSkills = new Set();
265
265
  const sourceRoot = installedEntry.localPath ? resolve(projectDir, installedEntry.localPath) : undefined;
266
- for (const root of deployedSkillRoots(projectDir, provider)) {
266
+ for (const root of deployedSkillRoots(projectDir, provider).filter(root => !opts.preserveRoots?.includes(root))) {
267
267
  for (const name of await readdir(root).catch(() => [])) {
268
268
  const skillDir = join(root, name);
269
269
  try {
@@ -314,7 +314,7 @@ export async function removeProjectLocalBundle(config, projectDir, bundleId, opt
314
314
  }
315
315
  continue;
316
316
  }
317
- const candidates = candidateDeployedPaths(projectDir, provider, sourceRel);
317
+ const candidates = candidateDeployedPaths(projectDir, provider, sourceRel).filter(file => !opts.preserveRoots?.some(root => file === root || file.startsWith(`${root}${sep}`)));
318
318
  let resolvedAbs = null;
319
319
  let detectedCase = 'missing';
320
320
  for (const c of candidates) {
@@ -201,6 +201,14 @@ Inject Options:
201
201
  Serve Options:
202
202
  --transport <type> Transport type: stdio (default), http
203
203
  --port <number> Port for HTTP transport (default: 3100)
204
+ --project <dir> Required HTTP project; pinned at startup
205
+ --token-env <NAME> HTTP bearer token environment variable (choose one source)
206
+ --token-file <path> HTTP bearer token file; re-read per request for rotation
207
+ --host <address> HTTP bind address (default: 127.0.0.1)
208
+ --allow-remote-bind Required for non-loopback binds; emits a warning
209
+ --allowed-host <h> Additional HTTP Host/Origin hostname (repeatable)
210
+ --max-sessions <n> HTTP session cap (default: 8; idle timeout: 300 seconds)
211
+ --tools <csv> Narrow HTTP tools: discover, *-show, artifact-write
204
212
  --toolsets <csv> Opt-in toolsets: flows, missions, memory, kb, research,
205
213
  activity-log, index, ralph, mc, ops, sandbox, decision, workers
206
214
  all excludes workers; enable explicitly with --toolsets all,workers
@@ -1619,15 +1627,12 @@ export async function main(args = process.argv.slice(2)) {
1619
1627
  switch (command) {
1620
1628
  case 'serve': {
1621
1629
  // Parse options
1622
- const transportIdx = args.indexOf('--transport');
1623
- const transport = transportIdx !== -1 ? args[transportIdx + 1] : 'stdio';
1630
+ const transport = requireFlagValue(args, { rejectEmpty: true }, '--transport') ?? 'stdio';
1624
1631
 
1625
1632
  if (transport === 'http') {
1626
- const portIdx = args.indexOf('--port');
1627
- const port = portIdx !== -1 ? parseInt(args[portIdx + 1], 10) : 3100;
1628
- console.error(`HTTP transport not yet implemented. Use stdio for now.`);
1629
- console.error(`Would start on port ${port}`);
1630
- process.exit(1);
1633
+ const { serveHttp } = await import('./http-transport.mjs');
1634
+ await serveHttp(subArgs);
1635
+ break;
1631
1636
  }
1632
1637
 
1633
1638
  // --toolsets flag overrides AIWG_MCP_TOOLSETS env (#1332 / S18)
@@ -5,6 +5,7 @@
5
5
  * @issues #1311 (scope split), #1312 (command-run), #1313 (discover + pairs)
6
6
  */
7
7
 
8
+ import { cliExecutionOptions, bindCliCancellation } from './tool-context.mjs';
8
9
  import { signalChild } from '../process/signal-child.mjs';
9
10
  import { spawn } from 'node:child_process';
10
11
  import { StringDecoder } from 'node:string_decoder';
@@ -266,7 +267,9 @@ export function isGlobalAllowed(toolName) {
266
267
  * @param {{ cwd?: string, env?: object, timeoutMs?: number, input?: string }} [options]
267
268
  * @returns {Promise<{ stdout: string, stderr: string, code: number }>}
268
269
  */
269
- export function runAiwgCli(args, { cwd, env, timeoutMs = 120_000, input } = {}) {
270
+ export function runAiwgCli(args, options = {}) {
271
+ const { cwd, env, timeoutMs = 120_000, input, signal } = cliExecutionOptions(options);
272
+ signal?.throwIfAborted();
270
273
  return new Promise((resolve, reject) => {
271
274
  const proc = spawn('aiwg', args, {
272
275
  shell: false,
@@ -298,6 +301,7 @@ export function runAiwgCli(args, { cwd, env, timeoutMs = 120_000, input } = {})
298
301
  rejectAndTerminate(new Error(`aiwg ${args[0] || ''} timed out after ${timeoutMs}ms`));
299
302
  }, timeoutMs);
300
303
 
304
+ bindCliCancellation(proc, signal, rejectAndTerminate);
301
305
  proc.stdout.on('data', (chunk) => { stdout += stdoutDecoder.write(chunk); });
302
306
  proc.stderr.on('data', (chunk) => { stderr += stderrDecoder.write(chunk); });
303
307