@aiwg/cli 2026.11.6 → 2026.11.8

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 (102) hide show
  1. package/agentic/code/addons/aiwg-hooks/hooks/aiwg-prompt-discovery.cjs +3 -2
  2. package/agentic/code/providers/model-capabilities.v1.json +22 -21
  3. package/agentic/code/providers/model-catalog.v1.json +11 -10
  4. package/dist/src/artifacts/browser-export.js +1 -0
  5. package/dist/src/artifacts/fortemi-core-query-adapter.js +2 -0
  6. package/dist/src/artifacts/index-builder.js +1 -0
  7. package/dist/src/artifacts/query-engine-discover-output.js +1 -0
  8. package/dist/src/artifacts/query-engine-discover.js +2 -2
  9. package/dist/src/artifacts/query-engine-scoring.js +7 -0
  10. package/dist/src/artifacts/template-output-kind.js +10 -0
  11. package/dist/src/artifacts/types.js +1 -1
  12. package/dist/src/cli/handlers/dataset.js +11 -2
  13. package/dist/src/cli/handlers/refresh-managed-deployment.js +13 -3
  14. package/dist/src/cli/handlers/refresh-user-hooks.js +102 -0
  15. package/dist/src/cli/handlers/refresh.js +2 -0
  16. package/dist/src/cli/handlers/update.js +26 -12
  17. package/dist/src/cli/handlers/use.js +4 -3
  18. package/dist/src/cli/handlers/writing.js +7 -1
  19. package/dist/src/config/worker-guidance-warning.js +8 -0
  20. package/dist/src/dataset/backend-selection.d.ts +3 -0
  21. package/dist/src/dataset/backend-selection.js +11 -0
  22. package/dist/src/dataset/contract-range.d.ts +7 -0
  23. package/dist/src/dataset/contract-range.js +55 -0
  24. package/dist/src/dataset/fortemi-execution-bridge.d.ts +2 -0
  25. package/dist/src/dataset/fortemi-execution-bridge.js +12 -1
  26. package/dist/src/dataset/index.d.ts +2 -0
  27. package/dist/src/dataset/index.js +2 -0
  28. package/dist/src/dataset/orchestration-service.d.ts +1 -1
  29. package/dist/src/dataset/orchestration-service.js +7 -8
  30. package/dist/src/dataset/orchestration-types.d.ts +2 -0
  31. package/dist/src/dataset/service-binding-checkpoints.d.ts +10 -0
  32. package/dist/src/dataset/service-binding-checkpoints.js +26 -0
  33. package/dist/src/dataset/service-binding-contract.d.ts +46 -0
  34. package/dist/src/dataset/service-binding-contract.js +25 -0
  35. package/dist/src/dataset/service-binding-registry.d.ts +12 -0
  36. package/dist/src/dataset/service-binding-registry.js +118 -0
  37. package/dist/src/extensions/manifest.js +23 -7
  38. package/dist/src/extensions/project-local-doctor.js +2 -1
  39. package/dist/src/extensions/project-quickref-discovery.js +11 -0
  40. package/dist/src/extensions/project-quickref.js +4 -7
  41. package/dist/src/extensions/user-hook-diagnostics.js +16 -1
  42. package/dist/src/extensions/verified-hook-command.js +7 -0
  43. package/dist/src/mcp/tools/worker-invoke.mjs +6 -4
  44. package/dist/src/mcp/tools/worker-launch-ledger.mjs +33 -0
  45. package/dist/src/mcp/tools/worker-verify-deliver-schema.mjs +22 -6
  46. package/dist/src/mcp/tools/worker-verify-deliver.mjs +4 -6
  47. package/dist/src/models/cursor-models.js +92 -0
  48. package/dist/src/models/model-capabilities.v1.json +22 -21
  49. package/dist/src/models/model-catalog.v1.json +11 -10
  50. package/dist/src/models/model-discovery.js +4 -3
  51. package/dist/src/models/provider-policy.js +1 -1
  52. package/dist/src/models/worker-health-readiness.js +4 -0
  53. package/dist/src/models/worker-installation.d.mts +2 -0
  54. package/dist/src/models/worker-installation.mjs +8 -2
  55. package/dist/src/models/worker-invocation-policy.js +21 -1
  56. package/dist/src/models/worker-plan.js +3 -1
  57. package/dist/src/models/worker-wiring-diagnostics.js +25 -0
  58. package/dist/src/providers/deployment-input-session.d.mts +2 -0
  59. package/dist/src/providers/deployment-input-session.mjs +38 -0
  60. package/dist/src/providers/provider-context-contracts.js +3 -0
  61. package/dist/src/providers/provider-seeds-1.js +1 -1
  62. package/dist/src/serve/worker-invocation-preparation.js +52 -33
  63. package/dist/src/serve/worker-invocation.js +4 -2
  64. package/dist/src/serve/worker-shell-prompt.d.mts +6 -0
  65. package/dist/src/serve/worker-shell-prompt.mjs +78 -0
  66. package/dist/src/smiths/context-pipeline/muse-bridge.js +7 -4
  67. package/dist/src/smiths/context-pipeline/workspace-audit.js +37 -6
  68. package/dist/src/smiths/context-pipeline/workspace-bootstrap.js +3 -1
  69. package/dist/src/smiths/context-pipeline/workspace-doctor.js +16 -4
  70. package/dist/src/smiths/context-pipeline/workspace-document.js +4 -2
  71. package/dist/src/smiths/hook-bridge/codex-trust.js +56 -7
  72. package/dist/src/smiths/hook-bridge/cursor-translator.js +89 -0
  73. package/dist/src/smiths/hook-bridge/index.js +4 -1
  74. package/dist/src/writing/campaign-patterns.js +96 -0
  75. package/dist/src/writing/campaign-report.js +41 -0
  76. package/dist/src/writing/contextual-diagnostics.js +30 -5
  77. package/dist/src/writing/current-patterns.catalogue.json +87 -0
  78. package/dist/src/writing/current-patterns.js +99 -0
  79. package/dist/src/writing/prose-mask.js +80 -0
  80. package/dist/src/writing/structural-patterns.js +126 -0
  81. package/dist/src/writing/validation-campaign.js +19 -0
  82. package/dist/src/writing/validation-engine.js +17 -10
  83. package/dist/src/writing/validation-rules.js +4 -3
  84. package/package.json +1 -1
  85. package/schemas/dataset/service-binding.v1.schema.json +70 -0
  86. package/tools/agents/providers/base-models-platforms.mjs +87 -48
  87. package/tools/agents/providers/cursor-prompt-discovery.mjs +13 -0
  88. package/tools/agents/providers/cursor.mjs +2 -0
  89. package/tools/agents/providers/openclaw-context.mjs +6 -0
  90. package/tools/agents/providers/openclaw.mjs +14 -12
  91. package/tools/agents/providers/rule-delivery-surface.mjs +1 -1
  92. package/tools/agents/providers/rule-deployment-corpus-inputs.mjs +19 -0
  93. package/tools/agents/providers/rule-deployment-input-session.mjs +40 -0
  94. package/tools/agents/providers/rule-deployment-prepare.mjs +16 -6
  95. package/tools/agents/providers/rule-presentation.mjs +1 -1
  96. package/tools/agents/providers/rule-startup.mjs +3 -1
  97. package/tools/plugin/package-plugins.mjs +2 -0
  98. package/tools/ralph-external/lib/typed-stop-delivery.mjs +10 -1
  99. package/tools/ralph-external/lib/worker-delivery-guards.mjs +47 -1
  100. package/tools/ralph-external/lib/worker-run-directory-refusal.mjs +2 -1
  101. package/tools/ralph-external/lib/worker-verification-cli.mjs +1 -1
  102. package/vscode-extension/schemas/aiwg.config.v1.json +13 -0
@@ -96,7 +96,8 @@ async function main() {
96
96
  }
97
97
  const event = JSON.parse(Buffer.concat(chunks).toString('utf8'));
98
98
  const hermes = event.hook_event_name === 'pre_llm_call';
99
- if (event.hook_event_name && event.hook_event_name !== 'UserPromptSubmit' && !hermes) return finish();
99
+ const cursor = event.hook_event_name === 'beforeSubmitPrompt';
100
+ if (event.hook_event_name && event.hook_event_name !== 'UserPromptSubmit' && !hermes && !cursor) return finish();
100
101
  if ([event.role, event.message?.role].some(role => role && role !== 'user')
101
102
  || /^(system|notification|tool[_-]result)$/.test(event.type || '')) return finish();
102
103
  const text = hermes ? event.extra?.user_message : event.prompt;
@@ -127,7 +128,7 @@ async function main() {
127
128
  worker.on('message', envelope => {
128
129
  if (Date.now() >= deadline) return finish();
129
130
  const context = contextFor(envelope, prompt);
130
- if (context) process.stdout.write(JSON.stringify(hermes ? { context } : {
131
+ if (context) process.stdout.write(JSON.stringify(cursor ? { continue: true, additional_context: context } : hermes ? { context } : {
131
132
  hookSpecificOutput: { hookEventName: 'UserPromptSubmit', additionalContext: context },
132
133
  }) + '\n', finish);
133
134
  else finish();
@@ -891,7 +891,7 @@
891
891
  "id": "cursor-direct",
892
892
  "provider": "cursor",
893
893
  "adapterVersion": "1",
894
- "supportedVersions": "2026.10.1-e373342",
894
+ "supportedVersions": "2026.11.13-eacade1",
895
895
  "runtimeDriver": "installed:cursor",
896
896
  "catalogAdapter": {
897
897
  "kind": "file",
@@ -946,67 +946,67 @@
946
946
  "invocationProfiles": {
947
947
  "direct-shell": {
948
948
  "transport": "shell",
949
- "supportedVersions": "2026.10.1-e373342",
949
+ "supportedVersions": "2026.11.13-eacade1",
950
950
  "controls": {
951
951
  "model": {
952
952
  "support": "unqualified",
953
- "mapping": "[--model MODEL[effort=E]]; exact catalog model ID with the embedded bracket effort override, never a generic alias, never the CLI's own auto-selection ('auto'/'default'); the captured --help documents only --model, no -m short alias",
954
- "evidence": "H: cursor-agent 2026.10.01-e373342 --help documents --model <model> (no -m alias) and its bracket-override syntax; unqualified until live model-pin evidence"
953
+ "mapping": "[--model MODEL]; exact catalog model ID including its effort variant, never a generic alias, never the CLI's own auto-selection ('auto'/'default'); the captured --help documents only --model, no -m short alias",
954
+ "evidence": "H: cursor-agent 2026.11.13-eacade1 --help and live --list-models observed 2026-11-17; composer-2.5 stdin smoke exited 0 with one success result; dispatch remains unqualified pending human review of a live run"
955
955
  },
956
956
  "effort": {
957
957
  "support": "unqualified",
958
- "mapping": "embedded in --model as MODEL[effort=E]; valid levels are account/backend-scoped (parameterizedModels is fetched from the Cursor backend), never a CLI default",
959
- "evidence": "H: cursor-agent 2026.10.01-e373342 --help documents the bracket-override example 'claude-opus-4-8[context=1m,effort=high,fast=false]'; D: installed-module bundle read on noodle (~/.local/share/cursor-agent/versions/2026.10.01-e373342/7000.index.js), never executed shows parameterizedModels is fetched remotely; unqualified until live evidence"
958
+ "mapping": "select the exact catalog model ID encoding effort, e.g. gpt-5.3-codex-high; never append bracket overrides; composer-2.5 has no separate effort selector",
959
+ "evidence": "H: 2026.11.13-eacade1 help still advertises parameterized bracket overrides, but the live list encodes effort in IDs; observed 2026-11-17: claude-sonnet-5-thinking-high[effort=low] rejected with plain-text Cannot use this model, exit 1 and no JSON"
960
960
  },
961
961
  "sandbox": {
962
962
  "support": "unqualified",
963
963
  "mapping": "both contracts emit [--sandbox enabled] (never --sandbox disabled); read-only additionally emits [--mode ask] (the CLI's own documented read-only mode) on top of --sandbox enabled; -f/--force, --yolo, --auto-review and --approve-mcps are out of this contract's scope and are never emitted (--approve-mcps is a bypass, not a non-approval convenience; see pitfalls)",
964
- "evidence": "H: cursor-agent 2026.10.01-e373342 --help documents --sandbox <enabled|disabled>, --mode <plan|ask> ('ask: ... (read-only)') and -f/--force/--yolo/--auto-review/--approve-mcps; D: installed-module bundle read on noodle (~/.local/share/cursor-agent/versions/2026.10.01-e373342/7000.index.js and 8192.index.js), never executed, shows sandboxMode:\"enabled\" pairs with approvalMode:\"allowlist\" and --approve-mcps sets ignoreApprovals:true on the MCP approval source; unqualified until live evidence"
964
+ "evidence": "H: cursor-agent 2026.11.13-eacade1 --help documents --sandbox <enabled|disabled>, --mode <plan|ask> ('ask: ... (read-only)') and -f/--force/--yolo/--auto-review/--approve-mcps; D: installed-module bundle read on noodle (~/.local/share/cursor-agent/versions/2026.10.01-e373342/7000.index.js and 8192.index.js), never executed, shows sandboxMode:\"enabled\" pairs with approvalMode:\"allowlist\" and --approve-mcps sets ignoreApprovals:true on the MCP approval source; Observed 2026-11-17: composer-2.5 smoke with --sandbox enabled exited 0 on titan after host AppArmor setup; read-only mode is help-evidenced only; dispatch unqualified pending human review"
965
965
  },
966
966
  "approval": {
967
967
  "support": "unqualified",
968
968
  "mapping": "unavailable as a separate flag: --sandbox/--mode are the only non-bypass permission gates; the direct profile never emits -f/--force, --yolo, --auto-review or --approve-mcps",
969
- "evidence": "H: cursor-agent 2026.10.01-e373342 --help documents no non-bypass approval-policy flag; unqualified until live evidence"
969
+ "evidence": "H: cursor-agent 2026.11.13-eacade1 --help documents no non-bypass approval-policy flag; Observed 2026-11-17: unapproved project MCP server never ran; smoke exited 0 without error or interaction_query events; dispatch unqualified pending human review"
970
970
  },
971
971
  "workdir": {
972
972
  "support": "unqualified",
973
973
  "mapping": "[--workspace W] conductor working root, plus the conductor process cwd",
974
- "evidence": "H: cursor-agent 2026.10.01-e373342 --help documents --workspace <path-or-name>; unqualified until live evidence"
974
+ "evidence": "H: cursor-agent 2026.11.13-eacade1 --help documents --workspace <path-or-name>; Observed 2026-11-17: smoke system/init cwd matched the supplied temporary workspace; dispatch unqualified pending human review"
975
975
  },
976
976
  "finalOutput": {
977
977
  "support": "unqualified",
978
978
  "mapping": "unavailable as a file target: no output-file flag is documented; the final is the last type:\"result\" line of the captured --output-format stream-json stdout stream",
979
- "evidence": "H: cursor-agent 2026.10.01-e373342 --help documents --output-format <text|json|stream-json> with no file-path argument; D: installed-module bundle read on noodle (~/.local/share/cursor-agent/versions/2026.10.01-e373342/7000.index.js), never executed shows the single terminal result object shape; unqualified until live evidence"
979
+ "evidence": "H: cursor-agent 2026.11.13-eacade1 --help documents --output-format <text|json|stream-json> with no file-path argument; D: installed-module bundle read on noodle (~/.local/share/cursor-agent/versions/2026.10.01-e373342/7000.index.js), never executed shows the single terminal result object shape; Observed 2026-11-17: plain-model smoke emitted exactly one result with subtype success, is_error false and result cursor-smoke-ok, exit 0; dispatch unqualified pending human review"
980
980
  },
981
981
  "stdin": {
982
982
  "support": "unqualified",
983
983
  "mapping": "brief-text: omitting the prompt argument makes the CLI read the prompt from stdin to EOF; brief text never enters argv, rendered commands or serialized plans",
984
- "evidence": "D: installed-module bundle read on noodle (~/.local/share/cursor-agent/versions/2026.10.01-e373342/7000.index.js), never executed shows the prompt-building function reads stdin to EOF only when no positional prompt argument is supplied; unqualified until live evidence"
984
+ "evidence": "D: installed-module bundle read on noodle (~/.local/share/cursor-agent/versions/2026.10.01-e373342/7000.index.js), never executed shows the prompt-building function reads stdin to EOF only when no positional prompt argument is supplied; Observed 2026-11-17: brief piped on stdin with no positional prompt produced cursor-smoke-ok, exit 0; dispatch unqualified pending human review"
985
985
  },
986
986
  "structuredOutput": {
987
987
  "support": "unqualified",
988
988
  "mapping": "unavailable: no output-schema flag is documented",
989
- "evidence": "H: cursor-agent 2026.10.01-e373342 --help advertises no output-schema flag; unqualified until live evidence"
989
+ "evidence": "H: cursor-agent 2026.11.13-eacade1 --help advertises no output-schema flag; unqualified until live evidence"
990
990
  },
991
991
  "stepCap": {
992
992
  "support": "unqualified",
993
993
  "mapping": "unavailable: no step or turn cap flag is evidenced; deadline and output-byte bounds come from the invoking shell",
994
- "evidence": "H: cursor-agent 2026.10.01-e373342 --help advertises no step-cap flag; unknown controls block tasks requiring them"
994
+ "evidence": "H: cursor-agent 2026.11.13-eacade1 --help advertises no step-cap flag; unknown controls block tasks requiring them"
995
995
  },
996
996
  "trust": {
997
997
  "support": "unqualified",
998
998
  "mapping": "always emitted: [--trust] removes the only documented workspace-trust prompt so the non-interactive run cannot block on it",
999
- "evidence": "H: cursor-agent 2026.10.01-e373342 --help documents --trust ('Trust the current workspace without prompting'); unqualified until live evidence"
999
+ "evidence": "H: cursor-agent 2026.11.13-eacade1 --help documents --trust ('Trust the current workspace without prompting'); Observed 2026-11-17: --trust smoke completed with no interaction_query or error events; dispatch unqualified pending human review"
1000
1000
  },
1001
1001
  "children": {
1002
1002
  "support": "unqualified",
1003
1003
  "mapping": "unknown: no subagent/child-process fan-out flag is documented for -p",
1004
- "evidence": "H: cursor-agent 2026.10.01-e373342 --help documents no child-process flag for -p; unqualified until live evidence"
1004
+ "evidence": "H: cursor-agent 2026.11.13-eacade1 --help documents no child-process flag for -p; unqualified until live evidence"
1005
1005
  },
1006
1006
  "fallback": {
1007
1007
  "support": "unqualified",
1008
1008
  "mapping": "unavailable: no fallback-model flag is documented",
1009
- "evidence": "H: cursor-agent 2026.10.01-e373342 --help advertises no fallback-model flag; unknown controls block tasks requiring them"
1009
+ "evidence": "H: cursor-agent 2026.11.13-eacade1 --help advertises no fallback-model flag; unknown controls block tasks requiring them"
1010
1010
  }
1011
1011
  },
1012
1012
  "envAllowlist": [
@@ -1015,16 +1015,17 @@
1015
1015
  "PATH"
1016
1016
  ],
1017
1017
  "pitfalls": [
1018
- "Documentation/help and synthetic observations are not authenticated live qualification.",
1018
+ "Help, live model list and smoke observations from 2026-11-17 are recorded in docs/providers/cursor-direct.md; dispatch remains unqualified pending human review of a live run.",
1019
1019
  "Unknown model, effort, permission or required step mappings block dispatch.",
1020
+ "On hosts with kernel.apparmor_restrict_unprivileged_userns=1, cursorsandbox needs a host AppArmor profile; without it the CLI reports Sandbox mode is enabled but not available in plain text and exits non-zero.",
1020
1021
  "Native MCP/client, MSP/ACP, gateway and conversation capabilities do not establish worker authority.",
1021
1022
  "-f/--force, --yolo and --auto-review are never part of the direct profile; none was ever shipped as a new argv-prompt path.",
1022
1023
  "--approve-mcps is a BYPASS, not a harmless convenience: it sets ignoreApprovals:true on the MCP approval source (installed-module bundle read, 8192.index.js), which is folded with --force/--yolo into one upstream bypass flag. Without it, an MCP server not already recorded as approved fails its load() call and is skipped; the run continues without that server's tools. It is never emitted by this profile.",
1023
1024
  "This version's non-interactive path has no type:\"error\" terminal event: a thrown error writes plain text and exits non-zero with no JSON result line at all; a missing terminal plus a non-zero exit is the failure signal here. Defensively, ANY type:\"error\" event or non-null top-level error field fails the stream regardless of position, including after an earlier success.",
1024
1025
  "A type:\"interaction_query\" line means the CLI is waiting for an approval answer this profile cannot supply; treated as fatal regardless of position (before or after a success line), never as a pending success.",
1025
1026
  "The template placeholder ${mode} documents the conditional --mode ask that read-only additionally emits on top of --sandbox enabled; it is omitted entirely for workspace-write, never rendered as an empty token.",
1026
- "CURSOR_API_KEY must be present for auth (there is no login on the evidenced host); HOME locates ~/.cursor for persistent settings.",
1027
- "SE4: the raw `cursor-agent --version` banner is `2026.10.01-e373342` (leading-zero day-of-month), which is not valid semver; supportedVersions here is the semver-normalized `2026.10.1-e373342` and a caller must apply the same normalization to the live version string before qualification, or a correct installation is unconditionally refused."
1027
+ "Auth may use CURSOR_API_KEY or an existing login (live smoke used login); HOME locates ~/.cursor for persistent settings.",
1028
+ "SE4: historical raw banner 2026.10.01-e373342 needs semver normalization to 2026.10.1-e373342; current supported version 2026.11.13-eacade1 needs no normalization."
1028
1029
  ],
1029
1030
  "health": {
1030
1031
  "version": 1,
@@ -1050,8 +1051,8 @@
1050
1051
  {
1051
1052
  "kind": "help",
1052
1053
  "ref": "tools/ralph-external/lib/cursor-adapter.mjs",
1053
- "observedAt": "2026-10-10T00:00:00Z",
1054
- "cliVersion": "2026.10.1-e373342"
1054
+ "observedAt": "2026-11-17T00:00:00Z",
1055
+ "cliVersion": "2026.11.13-eacade1"
1055
1056
  },
1056
1057
  {
1057
1058
  "kind": "repository",
@@ -141,23 +141,24 @@
141
141
  "cursor": {
142
142
  "roles": {
143
143
  "reasoning": {
144
- "id": "claude-4.6-opus-high-thinking",
145
- "status": "unverified",
146
- "observed": false
144
+ "id": "claude-opus-5-thinking-high",
145
+ "status": "active",
146
+ "observed": true
147
147
  },
148
148
  "coding": {
149
- "id": "claude-4.6-sonnet",
150
- "status": "unverified",
151
- "observed": false
149
+ "id": "gpt-5.3-codex-high",
150
+ "status": "active",
151
+ "observed": true
152
152
  },
153
153
  "efficiency": {
154
- "id": "auto",
155
- "status": "unverified",
156
- "observed": false
154
+ "id": "composer-2.5",
155
+ "status": "active",
156
+ "observed": true
157
157
  }
158
158
  },
159
159
  "sourceUrl": "https://cursor.com/docs/models",
160
- "verifiedAt": "2026-07-20"
160
+ "verifiedAt": "2026-11-17",
161
+ "evidence": "Source: live cursor-agent 2026.11.13-eacade1 --list-models on 2026-11-17 (models.txt); account-offered IDs observed, not dispatch qualification. See docs/providers/cursor-direct.md#live-observations-2026-11-17."
161
162
  },
162
163
  "factory": {
163
164
  "roles": {
@@ -448,6 +448,7 @@ function recordForEntry(cwd, entry, graphName, dependencyGraph, privacy, schemaV
448
448
  phase: entry.phase,
449
449
  type: entry.type,
450
450
  frontmatter: {
451
+ ...(entry.outputKind ? { outputKind: entry.outputKind } : {}),
451
452
  ...(entry.memoryRecord ? { aiwg_memory_record: entry.memoryRecord } : {}),
452
453
  ...(entry.kernel === undefined ? {} : { kernel: entry.kernel }),
453
454
  ...(entry.kind ? { aiwg_kind: entry.kind } : {}),
@@ -272,6 +272,8 @@ function entryFromRecord(record) {
272
272
  relationship.source_path ??
273
273
  relationship.target_id),
274
274
  triggers: record.search?.triggers,
275
+ ...(artifactTypeFromRecord(record) === 'template' && typeof indexedFrontmatter.outputKind === 'string'
276
+ ? { outputKind: indexedFrontmatter.outputKind } : {}),
275
277
  capability: record.search?.capability,
276
278
  searchTerms: Array.isArray(indexedSearchTerms)
277
279
  ? indexedSearchTerms.filter((term) => typeof term === "string")
@@ -936,6 +936,7 @@ function extractIndexArtifact(job, bindingOnly, warnings = []) {
936
936
  ...(markdownLinks.length > 0 ? { markdownLinks } : {}),
937
937
  dependents: [], // Computed after all entries are processed
938
938
  ...(name ? { name } : {}),
939
+ ...(type === 'template' && typeof data.outputKind === 'string' && data.outputKind.trim() ? { outputKind: data.outputKind.trim() } : {}),
939
940
  ...(triggers && triggers.length > 0 ? { triggers } : {}),
940
941
  ...(capability ? { capability } : {}),
941
942
  ...(searchTerms && searchTerms.length > 0 ? { searchTerms } : {}),
@@ -121,6 +121,7 @@ export async function emitDiscoverResults(context) {
121
121
  ...(includePaths ? { path: resolvePath(r.entry) } : {}),
122
122
  type: r.entry.type,
123
123
  name: r.entry.name,
124
+ ...(r.entry.outputKind ? { outputKind: r.entry.outputKind } : {}),
124
125
  title: r.entry.title,
125
126
  ...orderingFor(r.entry),
126
127
  ...templateRelationFields(r.entry, ruleRelations, 3, includePaths),
@@ -288,7 +288,7 @@ export async function discoverCapability(cwd, params) {
288
288
  const lexicalDiagnostics = new Map();
289
289
  const legacyStrictScored = candidates
290
290
  .map(entry => {
291
- const detailed = scoreEntryDetailed(entry, params.phrase, { personaIdentitySuppressed });
291
+ const detailed = scoreEntryDetailed(entry, params.phrase, { personaIdentitySuppressed, typeFilter: params.typeFilter });
292
292
  const legacyScore = detailed.score;
293
293
  const fortemiScore = fortemiCoreDiscoveryScores?.get(entry.path) ?? 0;
294
294
  lexicalDiagnostics.set(entry.path, detailed.diagnostic);
@@ -318,7 +318,7 @@ export async function discoverCapability(cwd, params) {
318
318
  const strictPaths = new Set(strictScored.map(result => result.entry.path));
319
319
  const combinedByPath = new Map(strictScored.map(result => [result.entry.path, result]));
320
320
  for (const entry of candidates) {
321
- const detailed = scoreEntryDetailed(entry, params.phrase, { relaxOverlap: true, personaIdentitySuppressed });
321
+ const detailed = scoreEntryDetailed(entry, params.phrase, { relaxOverlap: true, personaIdentitySuppressed, typeFilter: params.typeFilter });
322
322
  if (detailed.score < RELAXED_MIN_SCORE)
323
323
  continue;
324
324
  const existing = combinedByPath.get(entry.path);
@@ -1,5 +1,6 @@
1
1
  // Tokenize discovery phrases and score metadata matches with lexical diagnostics.
2
2
  import { diagnoseFacetActivations } from './discover-facets.js';
3
+ import { matchTemplateOutputKind } from './template-output-kind.js';
3
4
  import { verboseQueryProfile } from './query-engine-verbose.js';
4
5
  export function containsTokenSequence(haystack, needle) {
5
6
  if (needle.length === 0 || haystack.length < needle.length)
@@ -210,6 +211,12 @@ export function scoreEntryDetailed(entry, text, opts = {}) {
210
211
  query_token_coverage: tokens.length > 0 ? newlyMatched.length / tokens.length : 0,
211
212
  });
212
213
  };
214
+ const outputKindMatch = opts.typeFilter?.includes('template') ? matchTemplateOutputKind(entry, text) : undefined;
215
+ if (outputKindMatch) {
216
+ matches.push({ field: 'output_kind', match: 'exact', value: outputKindMatch,
217
+ contribution: 1.002, matched_tokens: tokens, query_token_coverage: 1 });
218
+ return finish(1.002, 1.002);
219
+ }
213
220
  // Exact and near-name floors preserve deliberate artifact selection. The
214
221
  // 1.001 offset sorts exact names above capped lexical matches (display: 1.0).
215
222
  if (entry.name) {
@@ -0,0 +1,10 @@
1
+ export function matchTemplateOutputKind(entry, phrase) {
2
+ if (entry.type !== 'template' || !entry.outputKind)
3
+ return undefined;
4
+ const normalize = (value) => value.toLowerCase().replace(/[._\s-]+/g, ' ').trim();
5
+ const query = normalize(phrase).replace(/ templates?$/, '').trim();
6
+ if (!query)
7
+ return undefined;
8
+ return [entry.outputKind, ...(entry.triggers ?? [])].find(value => normalize(value) === query);
9
+ }
10
+ //# sourceMappingURL=template-output-kind.js.map
@@ -110,7 +110,7 @@ export const INDEX_VERSION = '1.0.0';
110
110
  * making the serialized index schema incompatible; a mismatch simply forces a
111
111
  * one-time content re-extraction during the next incremental build.
112
112
  */
113
- export const INDEX_EXTRACTOR_VERSION = '2026.11.10.1';
113
+ export const INDEX_EXTRACTOR_VERSION = '2026.11.16.1';
114
114
  /**
115
115
  * Built-in graph definitions
116
116
  */
@@ -5,6 +5,7 @@ import { FileDatasetOrchestrationRepository } from "../../dataset/file-orchestra
5
5
  import { LocalDatasetExecutionBackend } from "../../dataset/local-execution-backend.js";
6
6
  import { DatasetOrchestrationService } from "../../dataset/orchestration-service.js";
7
7
  import { presentDatasetResult } from "../../dataset/presentation.js";
8
+ import { datasetBindingRegistry } from "../../dataset/service-binding-registry.js";
8
9
  export const DATASET_ACTIONS = [
9
10
  "source",
10
11
  "check",
@@ -27,6 +28,7 @@ function option(args, name) {
27
28
  function positions(args) {
28
29
  const values = new Set([
29
30
  "--file",
31
+ "--binding",
30
32
  "--count",
31
33
  "--digest",
32
34
  "--idempotency-key",
@@ -51,7 +53,12 @@ function input(ctx) {
51
53
  throw new Error("DATASET_INPUT_REQUIRED: --file <json> is required");
52
54
  return JSON.parse(readFileSync(resolve(ctx.cwd, file), "utf8"));
53
55
  }
54
- function service(ctx) {
56
+ export function createDatasetCliService(ctx, bindings = datasetBindingRegistry) {
57
+ const selected = ctx.args.filter(arg => arg === "--binding").length;
58
+ const bindingFile = option(ctx.args, "--binding");
59
+ if (selected && (selected !== 1 || !bindingFile || bindingFile.startsWith("--")))
60
+ throw new Error("DATASET_BINDING_SELECTION_REQUIRED: --binding <json>");
61
+ const binding = bindingFile ? bindings.select(JSON.parse(readFileSync(resolve(ctx.cwd, bindingFile), "utf8"))) : undefined;
55
62
  const registry = createBuiltinAdapterRegistry();
56
63
  return new DatasetOrchestrationService(new FileDatasetOrchestrationRepository(ctx.cwd), {
57
64
  adapter: (id, version) => {
@@ -64,6 +71,7 @@ function service(ctx) {
64
71
  return adapter;
65
72
  },
66
73
  localBackend: new LocalDatasetExecutionBackend(),
74
+ ...binding,
67
75
  });
68
76
  }
69
77
  export async function executeDatasetCommand(ctx, providedService) {
@@ -89,7 +97,7 @@ export async function executeDatasetCommand(ctx, providedService) {
89
97
  }],
90
98
  }, ctx.args.includes("--json")),
91
99
  };
92
- const s = providedService ?? service(ctx);
100
+ const s = providedService ?? createDatasetCliService(ctx);
93
101
  let result;
94
102
  switch (action) {
95
103
  case "source":
@@ -172,6 +180,7 @@ export const datasetHandler = {
172
180
  "preview: <source-id> [--count N] [--offline]",
173
181
  "ingest: <plan-id> --digest <sha256> --idempotency-key <key> [--approve id,id]",
174
182
  "status <run-id>: Inspect one run by its required ID.",
183
+ "All actions: --binding <json> explicitly selects a pre-registered qualified service binding.",
175
184
  "All actions: --json for the canonical aiwg.dataset-orchestration/v1 envelope.",
176
185
  ].join("\n"),
177
186
  };
@@ -7,6 +7,7 @@ import { managedClaudeHooks } from '../../extensions/claude-hooks-installer.js';
7
7
  import { verifiedHookCommand } from '../../extensions/verified-hook-command.js';
8
8
  import { managedMuseHooks } from '../../extensions/muse-managed-hooks.js';
9
9
  import { managedHookScriptState } from '../../extensions/managed-hook-script-state.js';
10
+ import { managedCursorPromptHook } from '../../smiths/hook-bridge/cursor-translator.js';
10
11
  import { managedFactoryHooks } from '../../smiths/hook-bridge/factory-translator.js';
11
12
  import { readFactoryDocument } from '../../smiths/hook-bridge/factory-hook-config.js';
12
13
  import { loadHookSources } from '../../smiths/hook-bridge/loader.js';
@@ -42,7 +43,7 @@ function groups(doc, event) {
42
43
  return Array.isArray(hooks?.[event]) ? hooks[event] : [];
43
44
  }
44
45
  async function staleHooks(projectRoot, frameworkRoot, provider) {
45
- if (!['claude', 'muse', 'factory', 'codex'].includes(provider))
46
+ if (!['claude', 'muse', 'factory', 'codex', 'cursor'].includes(provider))
46
47
  return [];
47
48
  const file = provider === 'claude' ? '.claude/settings.json' : `.${provider}/hooks.json`;
48
49
  let doc;
@@ -54,7 +55,16 @@ async function staleHooks(projectRoot, frameworkRoot, provider) {
54
55
  return [{ name: `${provider} managed hooks`, file, reason: 'unreadable' }];
55
56
  }
56
57
  const stale = [];
57
- if (provider === 'codex') {
58
+ if (provider === 'cursor') {
59
+ const expected = managedCursorPromptHook(projectRoot, await fs.readFile(path.join(frameworkRoot, 'agentic/code/addons/aiwg-hooks/hooks/aiwg-prompt-discovery.cjs')));
60
+ const hooks = doc.hooks?.beforeSubmitPrompt;
61
+ const candidates = Array.isArray(hooks) ? hooks.filter(hook => hook?._aiwg_id === expected._aiwg_id) : [];
62
+ if (!candidates.some(hook => hook.type === expected.type && hook.command === expected.command
63
+ && hook.timeout === expected.timeout && hook._aiwg_managed === true)) {
64
+ stale.push({ name: `beforeSubmitPrompt → ${expected._aiwg_id}`, file, reason: candidates.length ? 'outdated' : 'missing' });
65
+ }
66
+ }
67
+ else if (provider === 'codex') {
58
68
  const { sources } = await loadHookSources(frameworkRoot);
59
69
  const source = sources.find(hook => hook.id === 'aiwg-prompt-discovery');
60
70
  if (!source?.args?.[0])
@@ -169,7 +179,7 @@ async function staleHookScripts(projectRoot, frameworkRoot, provider) {
169
179
  else if (provider === 'muse') {
170
180
  scripts.set('.muse/hooks/aiwg-prompt-discovery.cjs', path.join(source, 'aiwg-prompt-discovery.cjs'));
171
181
  }
172
- else if (provider === 'codex' || provider === 'factory') {
182
+ else if (provider === 'codex' || provider === 'factory' || provider === 'cursor') {
173
183
  // Match installCodexPromptDiscovery: resolve packaged canonical arguments,
174
184
  // not the portable launcher command emitted into hooks.json.
175
185
  const { sources, errors } = await loadHookSources(frameworkRoot);
@@ -0,0 +1,102 @@
1
+ // Migrate only existing legacy user hook registrations, preserving operator settings.
2
+ import fs from 'node:fs/promises';
3
+ import path from 'node:path';
4
+ import os from 'node:os';
5
+ import { managedClaudeHooks } from '../../extensions/claude-hooks-installer.js';
6
+ import { managedMuseHooks } from '../../extensions/muse-managed-hooks.js';
7
+ import { managedHookScriptState } from '../../extensions/managed-hook-script-state.js';
8
+ import { diagnoseUserHookCommands } from '../../extensions/user-hook-diagnostics.js';
9
+ import { captureDeploymentOutputs, recordDeploymentOutputs } from '../../providers/deployment-ownership.mjs';
10
+ import * as ui from '../ui.js';
11
+ function relativeCommand(command) {
12
+ if (typeof command !== 'string')
13
+ return;
14
+ const match = /^node\s+(?:"([^"]+)"|'([^']+)'|(\S+))(?:\s+(start|stop))?\s*$/.exec(command);
15
+ if (!match)
16
+ return;
17
+ const script = (match[1] || match[2] || match[3]).replace(/\\/g, '/').replace(/\.js$/, '.cjs');
18
+ return `node ${script}${match[4] ? ` ${match[4]}` : ''}`;
19
+ }
20
+ export async function refreshUserHooks(options) {
21
+ const { frameworkRoot, provider, dryRun, quiet } = options;
22
+ if (!['claude', 'muse'].includes(provider))
23
+ return;
24
+ const home = os.homedir();
25
+ const directory = path.join(home, `.${provider}`);
26
+ const file = path.join(directory, provider === 'claude' ? 'settings.json' : 'hooks.json');
27
+ const diagnostics = await diagnoseUserHookCommands();
28
+ if (!diagnostics.some(diagnostic => diagnostic.path === file))
29
+ return;
30
+ const doc = JSON.parse(await fs.readFile(file, 'utf8'));
31
+ const source = path.join(frameworkRoot, 'agentic/code/addons/aiwg-hooks/hooks');
32
+ const files = await fs.readdir(source);
33
+ const canonical = provider === 'claude'
34
+ ? managedClaudeHooks(files, home, source, 'user').map((hook, i) => ({ ...hook,
35
+ relativeCommand: managedClaudeHooks(files)[i].command }))
36
+ : managedMuseHooks(home, await fs.readFile(path.join(source, 'aiwg-prompt-discovery.cjs')), 'user')
37
+ .filter(hook => hook.id === 'aiwg-prompt-discovery').map(hook => ({ event: hook.event,
38
+ script: '.muse/hooks/aiwg-prompt-discovery.cjs', command: hook.group.hooks[0].command,
39
+ relativeCommand: 'node .muse/hooks/aiwg-prompt-discovery.cjs' }));
40
+ const scripts = new Map();
41
+ let count = 0;
42
+ for (const hook of canonical) {
43
+ const groups = doc.hooks?.[hook.event];
44
+ if (!Array.isArray(groups))
45
+ continue;
46
+ for (const group of groups) {
47
+ for (const entry of Array.isArray(group?.hooks) ? group.hooks : []) {
48
+ if (entry?.type !== 'command' || relativeCommand(entry.command) !== hook.relativeCommand)
49
+ continue;
50
+ entry.command = hook.command;
51
+ scripts.set(hook.script, await fs.readFile(path.join(source, path.basename(hook.script))));
52
+ count++;
53
+ }
54
+ }
55
+ }
56
+ if (!count)
57
+ return;
58
+ // Validate every script before making any writes or blessing a new digest.
59
+ for (const [script, bytes] of scripts) {
60
+ const state = await managedHookScriptState(home, script, bytes);
61
+ if (state === 'operator-edited' || state === 'unreadable')
62
+ throw new Error(`${script}: kept (${state}); user hook migration needs review`);
63
+ }
64
+ if (dryRun) {
65
+ if (!quiet)
66
+ ui.info(`Would anchor ${count} ${provider} user hook(s) — ${file} (with backup)`);
67
+ return;
68
+ }
69
+ const before = captureDeploymentOutputs([directory]);
70
+ const backup = `${file}.bak.${new Date().toISOString().replace(/[:.]/g, '-')}`;
71
+ await fs.copyFile(file, backup, fs.constants.COPYFILE_EXCL);
72
+ for (const [script, bytes] of scripts) {
73
+ const target = path.join(home, script);
74
+ await fs.mkdir(path.dirname(target), { recursive: true });
75
+ await fs.writeFile(target, bytes);
76
+ }
77
+ const temporary = `${file}.tmp.${process.pid}`;
78
+ try {
79
+ await fs.writeFile(temporary, JSON.stringify(doc, null, 2) + '\n');
80
+ await fs.rename(temporary, file);
81
+ }
82
+ finally {
83
+ await fs.rm(temporary, { force: true });
84
+ }
85
+ recordDeploymentOutputs(before, [directory], { frameworkSlug: 'aiwg-hooks',
86
+ writtenFiles: [file, ...[...scripts.keys()].map(script => path.join(home, script))] });
87
+ if (!quiet)
88
+ ui.info(`Anchored ${count} ${provider} user hook(s) — backup: ${backup}`);
89
+ }
90
+ /** Run the user-hook migration without letting a review-needed hook abort `aiwg refresh`. */
91
+ export async function refreshUserHooksOrWarn(options, migrate = refreshUserHooks) {
92
+ try {
93
+ await migrate(options);
94
+ return undefined;
95
+ }
96
+ catch (error) {
97
+ const message = `User hook migration skipped: ${error instanceof Error ? error.message : String(error)}`;
98
+ ui.warn(message);
99
+ return message;
100
+ }
101
+ }
102
+ //# sourceMappingURL=refresh-user-hooks.js.map
@@ -23,6 +23,7 @@ import { automaticRemovalAllowed } from '../../providers/deployment-preservation
23
23
  import { refreshDeclaredBundles } from './refresh-bundles.js';
24
24
  import { bundledRuleOutputNames } from './refresh-rule-inventory.js';
25
25
  import { checkManagedDeployment, sourcePrebuiltIndexRepairHint } from './refresh-managed-deployment.js';
26
+ import { refreshUserHooksOrWarn } from './refresh-user-hooks.js';
26
27
  import { getFrameworkRoot } from '../../channel/manager.mjs';
27
28
  import { refreshAllPackages } from '../../packages/registry.js';
28
29
  import { resolveActiveProvider } from '../provider-resolution.js';
@@ -545,6 +546,7 @@ export const refreshHandler = {
545
546
  if (!quiet)
546
547
  ui.dim(' Skipping package update (--skip-update)');
547
548
  }
549
+ await refreshUserHooksOrWarn({ frameworkRoot, provider: detectedProvider, dryRun, quiet });
548
550
  // Step 4: Re-deploy frameworks. Both the default form and --all mean
549
551
  // "all installed", never the `aiwg use all` expansion meta-target. This
550
552
  // preserves the operator's selected footprint and removal symmetry.
@@ -8,6 +8,7 @@ import { bundleCopyArgs } from './bundle-deployment-mode.js';
8
8
  import { bundleProviders, pruneUndeclaredBundles, pruneAfterScopedDeployments } from './bundle-reconciliation.js';
9
9
  import { readAiwgConfig } from '../../config/aiwg-config.js';
10
10
  import { withInstalledSelection } from '../../config/installed-selection.js';
11
+ import { withDeploymentInputSession } from '../../providers/deployment-input-session.mjs';
11
12
  import { REGISTRY_ID_TO_USE_NAME } from '../../config/framework-aliases.js';
12
13
  /**
13
14
  * Read the installed frameworks from the on-disk registry.
@@ -131,17 +132,29 @@ export const updateHandler = {
131
132
  }
132
133
  // Step 3: Re-deploy each installed framework
133
134
  const results = [];
134
- for (const { fw, args } of deployments) {
135
- console.log(`Re-deploying ${fw}...`);
136
- const deploy = () => useFrameworkHandler.execute({
137
- ...ctx,
138
- args: [fw, ...args],
135
+ // One immutable corpus per update; target/config inputs remain per-pass.
136
+ let cleanupFailed = false;
137
+ try {
138
+ await withDeploymentInputSession(async () => {
139
+ for (const { fw, args } of deployments) {
140
+ console.log(`Re-deploying ${fw}...`);
141
+ const deploy = () => useFrameworkHandler.execute({
142
+ ...ctx,
143
+ args: [fw, ...args],
144
+ });
145
+ const result = await (deployAll ? deploy() : withInstalledSelection(ctx.cwd, installed, deploy));
146
+ results.push({ framework: fw, exitCode: result.exitCode });
147
+ if (result.exitCode !== 0) {
148
+ console.error(`Warning: Failed to re-deploy ${fw}: ${result.message || `exit ${result.exitCode}`}`);
149
+ }
150
+ }
139
151
  });
140
- const result = await (deployAll ? deploy() : withInstalledSelection(ctx.cwd, installed, deploy));
141
- results.push({ framework: fw, exitCode: result.exitCode });
142
- if (result.exitCode !== 0) {
143
- console.error(`Warning: Failed to re-deploy ${fw}: ${result.message || `exit ${result.exitCode}`}`);
144
- }
152
+ }
153
+ catch (error) {
154
+ if (results.length !== deployments.length)
155
+ throw error;
156
+ cleanupFailed = true;
157
+ console.error(`Warning: Deployment input cleanup failed: ${error instanceof Error ? error.message : String(error)}`);
145
158
  }
146
159
  if (!deployAll)
147
160
  pruneFailures += await pruneAfterScopedDeployments(ctx.cwd, await readAiwgConfig(ctx.cwd), providerArgs[1], ctx.frameworkRoot);
@@ -157,10 +170,11 @@ export const updateHandler = {
157
170
  console.log('');
158
171
  console.log(`Updated: ${succeeded.length}/${results.length}`);
159
172
  return {
160
- exitCode: failed.length > 0 || pruneFailures ? 1 : 0,
173
+ exitCode: failed.length > 0 || pruneFailures || cleanupFailed ? 1 : 0,
161
174
  message: failed.length > 0
162
175
  ? `Some frameworks failed to update: ${failed.map(f => f.framework).join(', ')}`
163
- : `Successfully updated ${succeeded.length} framework(s)`,
176
+ : cleanupFailed ? 'Deployment input cleanup failed'
177
+ : `Successfully updated ${succeeded.length} framework(s)`,
164
178
  };
165
179
  },
166
180
  };
@@ -46,6 +46,7 @@ export { getAllAddons, getAllExtensions, USE_ALL_DISALLOW, USE_ALL_EXTENSIONS_DI
46
46
  import { checkCollisions, formatCollisionReport, hasBlockingCollisions, } from '../../smiths/skillsmith/collision-detector.js';
47
47
  import { discoverProjectLocalBundles, formatProjectLocalTargetErrors, } from '../../extensions/project-local-discovery.js';
48
48
  import { PROJECT_LOCAL_TYPE_TO_DIR } from '../../extensions/project-local-paths.js';
49
+ import { formatManifestValidationError } from '../../extensions/manifest.js';
49
50
  import { buildUpstreamRegistry } from '../../extensions/upstream-registry.js';
50
51
  import { resolveShadows, formatShadowReport, } from '../../extensions/shadow-resolver.js';
51
52
  import { appendProjectLocalActivity, emitDiscoverEventsDeduped, } from '../../extensions/project-local-activity.js';
@@ -1187,8 +1188,8 @@ async function deployOneProjectLocalBundle(opts) {
1187
1188
  async function deployProjectLocalBundles(opts) {
1188
1189
  const { ctx, frameworkRoot, projectDir, provider, target, dryRun, verbose, quiet, onlyBundleId, modelArgs = [], } = opts;
1189
1190
  const discovery = await discoverProjectLocalBundles(projectDir);
1190
- if (discovery.errors.length > 0 && !quiet) {
1191
- ui.warn(`Project-local discovery surfaced ${discovery.errors.length} validation error(s) — run 'aiwg list --project-local' for details`);
1191
+ for (const error of discovery.errors) {
1192
+ ui.warn(`${error.path}: ${formatManifestValidationError(error)} — run 'aiwg list --project-local' for details`);
1192
1193
  }
1193
1194
  const targetBundles = onlyBundleId
1194
1195
  ? discovery.bundles.filter(b => b.id === onlyBundleId)
@@ -3108,7 +3109,7 @@ export class UseHandler {
3108
3109
  }
3109
3110
  }
3110
3111
  }
3111
- if (totalDeployed > 0 && totalFailed === 0 && !dryRunSingle) {
3112
+ if (totalDeployed > 0 && !dryRunSingle) {
3112
3113
  try {
3113
3114
  await rebuildExternalBundleIndex(projectDir, 'project', verboseSingle);
3114
3115
  if (scopeSingle === 'user') {