@ornexus/neocortex 4.61.5 → 4.62.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 (279) hide show
  1. package/dist/release-source.json +1 -1
  2. package/dist/sbom.cdx.json +1193 -1193
  3. package/install.ps1 +31 -34
  4. package/install.sh +1 -1
  5. package/package.json +5 -2
  6. package/packages/client/dist/adapters/adapter-registry.js +1 -108
  7. package/packages/client/dist/adapters/antigravity-adapter.js +2 -77
  8. package/packages/client/dist/adapters/claude-code-adapter.js +3 -79
  9. package/packages/client/dist/adapters/codex-adapter.js +2 -80
  10. package/packages/client/dist/adapters/cursor-adapter.js +4 -115
  11. package/packages/client/dist/adapters/gemini-adapter.js +2 -71
  12. package/packages/client/dist/adapters/grok-adapter.js +2 -42
  13. package/packages/client/dist/adapters/index.js +1 -22
  14. package/packages/client/dist/adapters/platform-detector.js +1 -220
  15. package/packages/client/dist/adapters/target-adapter.js +0 -12
  16. package/packages/client/dist/adapters/vscode-adapter.js +2 -72
  17. package/packages/client/dist/agent/refresh-stubs.js +2 -443
  18. package/packages/client/dist/agent/update-agent-yaml.js +1 -102
  19. package/packages/client/dist/agent/update-description.d.ts +8 -1
  20. package/packages/client/dist/agent/update-description.js +2 -260
  21. package/packages/client/dist/cache/crypto-utils.js +1 -78
  22. package/packages/client/dist/cache/encrypted-cache.js +1 -338
  23. package/packages/client/dist/cache/in-memory-asset-cache.js +1 -73
  24. package/packages/client/dist/cache/index.js +1 -13
  25. package/packages/client/dist/cache/protected-pi-boundary.js +1 -44
  26. package/packages/client/dist/checkpoint/checkpoint-client-reader.js +2 -127
  27. package/packages/client/dist/checkpoint/index.js +1 -11
  28. package/packages/client/dist/checkpoint/shared-checkpoint-types.js +1 -32
  29. package/packages/client/dist/cli.js +5 -364
  30. package/packages/client/dist/commands/activate.js +8 -394
  31. package/packages/client/dist/commands/architecture-answers.js +7 -274
  32. package/packages/client/dist/commands/architecture-memory-terminal.js +4 -253
  33. package/packages/client/dist/commands/architecture-non-ui-continuation.js +1 -100
  34. package/packages/client/dist/commands/architecture-root-binding.js +1 -51
  35. package/packages/client/dist/commands/cache-status.js +2 -112
  36. package/packages/client/dist/commands/config.js +1 -88
  37. package/packages/client/dist/commands/doctor.js +2 -635
  38. package/packages/client/dist/commands/invoke.d.ts +17 -0
  39. package/packages/client/dist/commands/invoke.js +148 -7822
  40. package/packages/client/dist/commands/legacy-epic-terminal.js +1 -71
  41. package/packages/client/dist/commands/legacy-story-branch.js +1 -96
  42. package/packages/client/dist/commands/legacy-story-pr.js +1 -276
  43. package/packages/client/dist/commands/mutation-qa-checkpoint.js +5 -285
  44. package/packages/client/dist/commands/mutation-qa-gate.js +1 -54
  45. package/packages/client/dist/commands/mutation-qa-git.js +1 -41
  46. package/packages/client/dist/commands/mutation-qa-policy.js +1 -102
  47. package/packages/client/dist/commands/mutation-qa-run.js +3 -219
  48. package/packages/client/dist/commands/mutation-qa-verdict.js +1 -149
  49. package/packages/client/dist/commands/mutation-qa.js +1 -220
  50. package/packages/client/dist/commands/native-agent.js +2 -136
  51. package/packages/client/dist/commands/planning-diagnosis.js +1 -43
  52. package/packages/client/dist/commands/planning-generation.js +1 -53
  53. package/packages/client/dist/commands/planning-memory.js +1 -40
  54. package/packages/client/dist/commands/planning-research.js +1 -42
  55. package/packages/client/dist/commands/private-session.js +1 -75
  56. package/packages/client/dist/commands/property-qa.js +1 -139
  57. package/packages/client/dist/commands/qa-control.js +1 -16
  58. package/packages/client/dist/commands/qa-scan-browser-launch.js +1 -55
  59. package/packages/client/dist/commands/qa-scan-browser-route.js +1 -28
  60. package/packages/client/dist/commands/qa-scan-capture.js +5 -663
  61. package/packages/client/dist/commands/qa-scan-discovery.js +3 -376
  62. package/packages/client/dist/commands/qa-scan-review.js +5 -826
  63. package/packages/client/dist/commands/qa-synthetic-backend-capture.js +1 -266
  64. package/packages/client/dist/commands/qa-synthetic-backend-review.js +1 -297
  65. package/packages/client/dist/commands/qa-synthetic-backend.js +2 -340
  66. package/packages/client/dist/commands/qa-synthetic-broker-port.js +1 -85
  67. package/packages/client/dist/commands/qa-synthetic-browser.js +1 -39
  68. package/packages/client/dist/commands/refactor-characterization.js +21 -671
  69. package/packages/client/dist/commands/refactor-commit.js +13 -399
  70. package/packages/client/dist/commands/refactor-control.js +3 -142
  71. package/packages/client/dist/commands/refactor-cpp-assertions.js +3 -93
  72. package/packages/client/dist/commands/refactor-review.js +5 -283
  73. package/packages/client/dist/commands/refactor-root.js +7 -588
  74. package/packages/client/dist/commands/refresh-memory.js +3 -174
  75. package/packages/client/dist/commands/shared-architecture-non-ui.js +1 -24
  76. package/packages/client/dist/commands/story-checkpoint.d.ts +5 -1
  77. package/packages/client/dist/commands/story-checkpoint.js +1 -203
  78. package/packages/client/dist/commands/story-worktree.js +5 -258
  79. package/packages/client/dist/config/host-auth-broker.js +1 -60
  80. package/packages/client/dist/config/host-auth-reference.js +1 -93
  81. package/packages/client/dist/config/profile-directory.js +1 -13
  82. package/packages/client/dist/config/resolver-selection.js +1 -278
  83. package/packages/client/dist/config/secure-config.js +12 -281
  84. package/packages/client/dist/config.js +2 -224
  85. package/packages/client/dist/constants.js +1 -25
  86. package/packages/client/dist/context/context-collector.js +2 -222
  87. package/packages/client/dist/context/context-sanitizer.js +1 -145
  88. package/packages/client/dist/continuity/autonomous-governance.js +1 -285
  89. package/packages/client/dist/continuity/continuity-client-state-store.js +1 -1587
  90. package/packages/client/dist/continuity/invoke-hooks.js +1 -129
  91. package/packages/client/dist/continuity/migrations/001-initial-schema.js +2 -12
  92. package/packages/client/dist/continuity/migrations/002-processing-output-summary-indexes.js +2 -12
  93. package/packages/client/dist/continuity/migrations/003-headless-execution-attempts.js +2 -12
  94. package/packages/client/dist/continuity/migrations/004-outbox-delivery-state.js +2 -12
  95. package/packages/client/dist/continuity/migrations/005-bounded-headless-queue.js +2 -12
  96. package/packages/client/dist/continuity/migrations/006-native-agent-dispatches.js +2 -10
  97. package/packages/client/dist/continuity/native-agent-store.js +1 -69
  98. package/packages/client/dist/continuity/native-agent-types.js +1 -105
  99. package/packages/client/dist/continuity/outbox.js +1 -117
  100. package/packages/client/dist/continuity/runner-bootstrap-policy.js +1 -172
  101. package/packages/client/dist/continuity/sqlite-store.js +81 -2612
  102. package/packages/client/dist/effects/invoke-effect-gateways.js +1 -62
  103. package/packages/client/dist/errors/error-messages.js +2 -258
  104. package/packages/client/dist/errors/frontmatter-diagnostics.d.ts +10 -1
  105. package/packages/client/dist/errors/frontmatter-diagnostics.js +1 -125
  106. package/packages/client/dist/evidence/collector.js +1 -347
  107. package/packages/client/dist/evidence/index.js +1 -1
  108. package/packages/client/dist/evidence/types.js +0 -2
  109. package/packages/client/dist/fs/atomic-state-replace.js +1 -152
  110. package/packages/client/dist/generated/command-registry.generated.js +1 -4076
  111. package/packages/client/dist/generated/public-projections.generated.js +1 -149
  112. package/packages/client/dist/git/direct-yolo-c01-retry.js +4 -138
  113. package/packages/client/dist/git/direct-yolo-checkpoint.d.ts +94 -9
  114. package/packages/client/dist/git/direct-yolo-checkpoint.js +3 -1592
  115. package/packages/client/dist/git/epic-operational-state.js +2 -672
  116. package/packages/client/dist/git/git-lifecycle-step-ids.js +1 -14
  117. package/packages/client/dist/git/git-lifecycle-store.d.ts +88 -0
  118. package/packages/client/dist/git/git-lifecycle-store.js +9 -2529
  119. package/packages/client/dist/git/legacy-story-branch-checkpoint.js +9 -259
  120. package/packages/client/dist/git/legacy-story-branch-setup.js +4 -348
  121. package/packages/client/dist/git/legacy-story-pr.js +70 -3538
  122. package/packages/client/dist/git/neocortex-trailers.js +2 -53
  123. package/packages/client/dist/git/release-gate-env.d.ts +62 -0
  124. package/packages/client/dist/git/release-gate-env.js +1 -0
  125. package/packages/client/dist/git/secure-filesystem-boundary.d.ts +24 -0
  126. package/packages/client/dist/git/secure-filesystem-boundary.js +20 -186
  127. package/packages/client/dist/git/story-worktree-cleanup.js +4 -1058
  128. package/packages/client/dist/git/story-worktree-integration.d.ts +62 -0
  129. package/packages/client/dist/git/story-worktree-integration.js +3 -603
  130. package/packages/client/dist/git/story-worktree-manager.js +3 -843
  131. package/packages/client/dist/git/story-worktree-paths.js +1 -150
  132. package/packages/client/dist/git/story-write-set-extension.d.ts +44 -0
  133. package/packages/client/dist/git/story-write-set-extension.js +1 -0
  134. package/packages/client/dist/graph-retrieval/pre-command-hook.js +1 -284
  135. package/packages/client/dist/graph-retrieval/shared-graph-retrieval-contract.js +1 -237
  136. package/packages/client/dist/i18n/first-run.js +2 -60
  137. package/packages/client/dist/index.js +1 -50
  138. package/packages/client/dist/invocation/invoke-input.js +1 -24
  139. package/packages/client/dist/license/host-auth-recovery.js +1 -401
  140. package/packages/client/dist/license/index.js +1 -5
  141. package/packages/client/dist/license/license-client.js +1 -337
  142. package/packages/client/dist/machine/fingerprint.js +2 -163
  143. package/packages/client/dist/machine/index.js +1 -5
  144. package/packages/client/dist/memory/project-memory-path-scope.js +1 -62
  145. package/packages/client/dist/memory/project-memory-writer.js +41 -1117
  146. package/packages/client/dist/memory/shared-project-memory-types.js +2 -259
  147. package/packages/client/dist/migrations/epic-lifecycle-backfill.js +3 -1060
  148. package/packages/client/dist/migrations/project-identity-capability.js +1 -50
  149. package/packages/client/dist/migrations/project-identity.js +7 -493
  150. package/packages/client/dist/migrations/state-json.js +4 -393
  151. package/packages/client/dist/policy/architecture-policy.js +2 -184
  152. package/packages/client/dist/policy/index.js +1 -7
  153. package/packages/client/dist/policy/shared-policy-types.js +0 -38
  154. package/packages/client/dist/policy/subagent-approval-policy.js +1 -57
  155. package/packages/client/dist/private-execution/clean-baseline.js +2 -279
  156. package/packages/client/dist/private-execution/codex-executor.js +4 -574
  157. package/packages/client/dist/private-execution/codex-host-runtime.js +1 -137
  158. package/packages/client/dist/private-execution/codex-lifecycle-guard.js +1 -97
  159. package/packages/client/dist/private-execution/codex-scoped-permissions.js +1 -128
  160. package/packages/client/dist/private-execution/delivery.js +13 -410
  161. package/packages/client/dist/private-execution/diagnosis-root-review.js +2 -294
  162. package/packages/client/dist/private-execution/frozen-handoff.js +6 -19
  163. package/packages/client/dist/private-execution/implementation-validation.js +2 -106
  164. package/packages/client/dist/private-execution/isolated-admission.js +23 -1432
  165. package/packages/client/dist/private-execution/isolated-session.js +5 -725
  166. package/packages/client/dist/private-execution/isolated-workspace.js +1 -122
  167. package/packages/client/dist/private-execution/pact-consumer-runtime.js +3 -409
  168. package/packages/client/dist/private-execution/pact-test-source.js +1 -258
  169. package/packages/client/dist/private-execution/pact-toolchain.js +3 -290
  170. package/packages/client/dist/private-execution/pact-write-set.js +1 -172
  171. package/packages/client/dist/private-execution/planning-diagnosis-checkpoint.js +5 -406
  172. package/packages/client/dist/private-execution/planning-generation-checkpoint.js +5 -462
  173. package/packages/client/dist/private-execution/planning-memory-checkpoint.js +3 -139
  174. package/packages/client/dist/private-execution/planning-research-checkpoint.js +4 -325
  175. package/packages/client/dist/private-execution/private-report-store.js +1 -42
  176. package/packages/client/dist/private-execution/property-test-candidate.js +1 -103
  177. package/packages/client/dist/private-execution/property-test-choices.js +3 -147
  178. package/packages/client/dist/private-execution/property-test-plan.js +7 -271
  179. package/packages/client/dist/private-execution/property-test-review.js +4 -258
  180. package/packages/client/dist/private-execution/property-test-runtime.js +9 -372
  181. package/packages/client/dist/private-execution/property-test-source.js +1 -139
  182. package/packages/client/dist/private-execution/root-checkpoint.js +1 -80
  183. package/packages/client/dist/private-execution/root-memory-git-evidence.js +3 -135
  184. package/packages/client/dist/private-execution/root-memory-recovery.js +1 -93
  185. package/packages/client/dist/private-execution/root-memory-request.js +1 -29
  186. package/packages/client/dist/private-execution/root-memory-scope.js +1 -178
  187. package/packages/client/dist/private-execution/root-memory-writer.js +1 -102
  188. package/packages/client/dist/private-execution/session-lease.js +1 -63
  189. package/packages/client/dist/private-execution/shared-private-admission-types.js +1 -50
  190. package/packages/client/dist/private-execution/shared-project-validation.js +1 -66
  191. package/packages/client/dist/private-execution/shared-root-memory-types.js +1 -61
  192. package/packages/client/dist/private-execution/ux-source-validation.js +1 -372
  193. package/packages/client/dist/private-execution/ux-write-set.js +2 -191
  194. package/packages/client/dist/registry/registry-reconciliation.js +1 -234
  195. package/packages/client/dist/resilience/circuit-breaker.js +1 -170
  196. package/packages/client/dist/resilience/degradation-manager.js +1 -164
  197. package/packages/client/dist/resilience/freshness-indicator.js +1 -100
  198. package/packages/client/dist/resilience/index.js +1 -8
  199. package/packages/client/dist/resilience/recovery-detector.js +1 -74
  200. package/packages/client/dist/resolvers/asset-resolver.js +0 -13
  201. package/packages/client/dist/resolvers/local-resolver.js +8 -255
  202. package/packages/client/dist/resolvers/remote-resolver.js +1 -233
  203. package/packages/client/dist/runner/binary.js +1 -404
  204. package/packages/client/dist/runner/cli.js +17 -1571
  205. package/packages/client/dist/runner/epic-background-dispatcher.js +1 -124
  206. package/packages/client/dist/runner/headless/adapters.js +1 -49
  207. package/packages/client/dist/runner/headless/background-root.js +1 -85
  208. package/packages/client/dist/runner/headless/child-env.d.ts +92 -0
  209. package/packages/client/dist/runner/headless/child-env.js +1 -0
  210. package/packages/client/dist/runner/headless/claude-code-adapter.js +1 -79
  211. package/packages/client/dist/runner/headless/continuous-story-workspace.js +11 -1776
  212. package/packages/client/dist/runner/headless/epic-git-reconciliation-inventory.js +1 -69
  213. package/packages/client/dist/runner/headless/epic-merge-candidate-qa.js +2 -111
  214. package/packages/client/dist/runner/headless/epic-terminal-git-cli-adapter.d.ts +1 -0
  215. package/packages/client/dist/runner/headless/epic-terminal-git-cli-adapter.js +10 -1464
  216. package/packages/client/dist/runner/headless/epic-terminal-git-runner.js +2 -357
  217. package/packages/client/dist/runner/headless/fake-adapter.js +1 -62
  218. package/packages/client/dist/runner/headless/managed-environment-cleanup.js +1 -274
  219. package/packages/client/dist/runner/headless/managed-profile.js +1 -149
  220. package/packages/client/dist/runner/headless/opencode-adapter.js +2 -145
  221. package/packages/client/dist/runner/headless/prepared-story-bundle.js +1 -43
  222. package/packages/client/dist/runner/headless/resolver.js +1 -231
  223. package/packages/client/dist/runner/headless/run-yolo.js +1 -886
  224. package/packages/client/dist/runner/headless/run-yoloop.js +2 -2657
  225. package/packages/client/dist/runner/headless/types.js +2 -575
  226. package/packages/client/dist/runner/host-capacity.js +1 -59
  227. package/packages/client/dist/runner/local-console.js +13 -396
  228. package/packages/client/dist/runner/portal-sync-worker.js +1 -1487
  229. package/packages/client/dist/runner/project-identity.js +1 -106
  230. package/packages/client/dist/runner/scheduler.js +7 -995
  231. package/packages/client/dist/runner-cli.js +2 -18
  232. package/packages/client/dist/state/invocation-shape.js +1 -13
  233. package/packages/client/dist/state/project-state-snapshot.js +1 -1754
  234. package/packages/client/dist/state/state-json-repair.js +3 -785
  235. package/packages/client/dist/state/structural-dag-projection.js +1 -118
  236. package/packages/client/dist/telemetry/index.js +1 -5
  237. package/packages/client/dist/telemetry/offline-queue.js +1 -131
  238. package/packages/client/dist/tier/index.js +1 -5
  239. package/packages/client/dist/tier/tier-aware-client.js +1 -405
  240. package/packages/client/dist/types/index.js +1 -38
  241. package/packages/client/dist/version.js +1 -27
  242. package/packages/client/dist/yolo/change-evidence-collector.d.ts +10 -0
  243. package/packages/client/dist/yolo/change-evidence-collector.js +1 -262
  244. package/packages/client/dist/yolo/invoke-envelope-capability.d.ts +2 -0
  245. package/packages/client/dist/yolo/invoke-envelope-capability.js +1 -65
  246. package/packages/client/dist/yolo/project-manifest-projection-collector.d.ts +28 -0
  247. package/packages/client/dist/yolo/project-manifest-projection-collector.js +1 -0
  248. package/packages/client/dist/yolo/spec-envelope-collector.d.ts +9 -0
  249. package/packages/client/dist/yolo/spec-envelope-collector.js +5 -184
  250. package/packages/client/dist/yoloop/discovery-hook.js +2 -300
  251. package/packages/client/dist/yoloop/index.js +1 -8
  252. package/packages/client/dist/yoloop/invoke-hooks.js +12 -669
  253. package/packages/client/dist/yoloop/shared-discover-epics.d.ts +16 -0
  254. package/packages/client/dist/yoloop/shared-discover-epics.js +1 -1007
  255. package/packages/client/dist/yoloop/shared-yoloop-types.js +1 -33
  256. package/packages/client/dist/yoloop/target-normalization.js +1 -180
  257. package/packages/client/dist/yoloop/yoloop-client-state-store.js +1 -1920
  258. package/packages/shared/dist/frontmatter-context-contract.js +164 -52
  259. package/packages/shared/dist/project-manifest-projection.js +199 -0
  260. package/packages/shared/dist/project-validation-commands.js +14 -6
  261. package/packages/shared/dist/yolo/spec-envelope-rules.js +85 -0
  262. package/packages/shared/dist/yolo/spec-envelope.js +33 -7
  263. package/packages/shared/dist/yoloop/epic-terminal-git.js +94 -6
  264. package/packages/shared/dist/yoloop/story-write-scope.js +212 -0
  265. package/targets-stubs/antigravity/gemini.md +1 -1
  266. package/targets-stubs/antigravity/install-antigravity.sh +13 -4
  267. package/targets-stubs/antigravity/skill/SKILL.md +1 -1
  268. package/targets-stubs/claude-code/neocortex-root.agent.yaml +1 -1
  269. package/targets-stubs/claude-code/neocortex-root.md +2 -2
  270. package/targets-stubs/claude-code/neocortex.agent.yaml +1 -1
  271. package/targets-stubs/claude-code/neocortex.md +5 -5
  272. package/targets-stubs/codex/AGENTS.md +1 -1
  273. package/targets-stubs/cursor/agent.md +2 -2
  274. package/targets-stubs/gemini-cli/agent.md +2 -2
  275. package/targets-stubs/lib/managed-config-merge.js +77 -1
  276. package/targets-stubs/lib/managed-profile.sh +7 -0
  277. package/targets-stubs/opencode/neocortex-root.md +1 -1
  278. package/targets-stubs/vscode/install-vscode.sh +21 -0
  279. package/targets-stubs/vscode/neocortex.agent.md +2 -2
@@ -1,115 +1,4 @@
1
- /**
2
- * @license FSL-1.1
3
- * Copyright (c) 2026 OrNexus AI
4
- *
5
- * Cursor Adapter - Formats prompts as .cursorrules content.
6
- *
7
- * Cursor reads system instructions from .cursorrules files.
8
- * This adapter produces concise, directive-style rules optimized
9
- * for Cursor's instruction format.
10
- *
11
- * Story 42.8
12
- */
13
- // ── Constants ───────────────────────────────────────────────────────────────
14
- const TARGET_ID = 'cursor';
15
- const MAX_CONTEXT_LENGTH = 100_000;
16
- const CAPABILITIES = {
17
- supportsMarkdown: true,
18
- supportsMultiFile: false,
19
- supportsMultiTurn: true,
20
- supportsTools: true,
21
- maxContextLength: MAX_CONTEXT_LENGTH,
22
- };
23
- // ── Helpers ─────────────────────────────────────────────────────────────────
24
- /**
25
- * Convert verbose markdown prose to concise directive-style rules.
26
- * Strips excessive headers, converts paragraphs to bullet points.
27
- */
28
- function condenseToCursorFormat(content) {
29
- const lines = content.split('\n');
30
- const result = [];
31
- for (const line of lines) {
32
- const trimmed = line.trim();
33
- // Skip empty lines in sequences (collapse to single)
34
- if (trimmed === '') {
35
- if (result.length > 0 && result[result.length - 1] !== '') {
36
- result.push('');
37
- }
38
- continue;
39
- }
40
- // Keep headers but reduce depth (### becomes ##)
41
- if (trimmed.startsWith('#')) {
42
- result.push(trimmed);
43
- continue;
44
- }
45
- // Keep bullet points, code blocks, and directives
46
- if (trimmed.startsWith('-') ||
47
- trimmed.startsWith('*') ||
48
- trimmed.startsWith('```') ||
49
- trimmed.startsWith('>')) {
50
- result.push(trimmed);
51
- continue;
52
- }
53
- // Inside code blocks, preserve as-is
54
- if (result.length > 0 && isInsideCodeBlock(result)) {
55
- result.push(line);
56
- continue;
57
- }
58
- // Convert standalone paragraphs to bullet points
59
- if (trimmed.length > 0) {
60
- result.push(`- ${trimmed}`);
61
- }
62
- }
63
- return result.join('\n').trim();
64
- }
65
- function isInsideCodeBlock(lines) {
66
- let openCount = 0;
67
- for (const line of lines) {
68
- if (line.trim().startsWith('```')) {
69
- openCount++;
70
- }
71
- }
72
- return openCount % 2 !== 0;
73
- }
74
- // ── Implementation ──────────────────────────────────────────────────────────
75
- export class CursorAdapter {
76
- formatPrompt(assembledPrompt, platformInstructions, config) {
77
- const sections = [];
78
- // Condense prompt for Cursor's concise format
79
- const condensed = config.verbose === true
80
- ? assembledPrompt
81
- : condenseToCursorFormat(assembledPrompt);
82
- sections.push(condensed);
83
- // Add tool hints if available
84
- if (platformInstructions.tools && platformInstructions.tools.length > 0) {
85
- sections.push('');
86
- sections.push('## Tools');
87
- for (const tool of platformInstructions.tools) {
88
- sections.push(`- ${tool}`);
89
- }
90
- }
91
- // Add context files as references
92
- if (platformInstructions.contextFiles && platformInstructions.contextFiles.length > 0) {
93
- sections.push('');
94
- sections.push('## Context');
95
- for (const file of platformInstructions.contextFiles) {
96
- sections.push(`- @${file}`);
97
- }
98
- }
99
- let result = sections.join('\n');
100
- const maxLength = config.maxPromptLength ?? MAX_CONTEXT_LENGTH;
101
- if (result.length > maxLength) {
102
- result = result.slice(0, maxLength);
103
- }
104
- return result;
105
- }
106
- getTargetId() {
107
- return TARGET_ID;
108
- }
109
- getCapabilities() {
110
- return CAPABILITIES;
111
- }
112
- getInjectionMethod() {
113
- return 'file';
114
- }
115
- }
1
+ const l="cursor",T=1e5,c={supportsMarkdown:!0,supportsMultiFile:!1,supportsMultiTurn:!0,supportsTools:!0,maxContextLength:1e5};function p(n){const s=n.split(`
2
+ `),t=[];for(const o of s){const e=o.trim();if(e===""){t.length>0&&t[t.length-1]!==""&&t.push("");continue}if(e.startsWith("#")){t.push(e);continue}if(e.startsWith("-")||e.startsWith("*")||e.startsWith("```")||e.startsWith(">")){t.push(e);continue}if(t.length>0&&f(t)){t.push(o);continue}e.length>0&&t.push(`- ${e}`)}return t.join(`
3
+ `).trim()}function f(n){let s=0;for(const t of n)t.trim().startsWith("```")&&s++;return s%2!==0}class g{formatPrompt(s,t,o){const e=[],h=o.verbose===!0?s:p(s);if(e.push(h),t.tools&&t.tools.length>0){e.push(""),e.push("## Tools");for(const r of t.tools)e.push(`- ${r}`)}if(t.contextFiles&&t.contextFiles.length>0){e.push(""),e.push("## Context");for(const r of t.contextFiles)e.push(`- @${r}`)}let i=e.join(`
4
+ `);const u=o.maxPromptLength??1e5;return i.length>u&&(i=i.slice(0,u)),i}getTargetId(){return l}getCapabilities(){return c}getInjectionMethod(){return"file"}}export{g as CursorAdapter};
@@ -1,71 +1,2 @@
1
- /**
2
- * @license FSL-1.1
3
- * Copyright (c) 2026 OrNexus AI
4
- *
5
- * Gemini CLI Adapter - Formats prompts as GEMINI.md system instructions.
6
- *
7
- * Gemini CLI reads system instructions from GEMINI.md files
8
- * with @import directives for referenced standards and skills.
9
- *
10
- * Story 42.8
11
- */
12
- // ── Constants ───────────────────────────────────────────────────────────────
13
- const TARGET_ID = 'gemini-cli';
14
- const MAX_CONTEXT_LENGTH = 1_000_000;
15
- const CAPABILITIES = {
16
- supportsMarkdown: true,
17
- supportsMultiFile: true,
18
- supportsMultiTurn: true,
19
- supportsTools: true,
20
- maxContextLength: MAX_CONTEXT_LENGTH,
21
- };
22
- // ── Implementation ──────────────────────────────────────────────────────────
23
- export class GeminiAdapter {
24
- formatPrompt(assembledPrompt, platformInstructions, config) {
25
- const sections = [];
26
- // Main prompt content
27
- sections.push(assembledPrompt);
28
- // Add @import directives for context files (Gemini-native feature)
29
- if (platformInstructions.contextFiles && platformInstructions.contextFiles.length > 0) {
30
- sections.push('');
31
- sections.push('## Standards');
32
- sections.push('');
33
- for (const file of platformInstructions.contextFiles) {
34
- sections.push(`@import ${file}`);
35
- }
36
- }
37
- // Tool definitions
38
- if (platformInstructions.tools && platformInstructions.tools.length > 0) {
39
- sections.push('');
40
- sections.push('## Available Tools');
41
- sections.push('');
42
- for (const tool of platformInstructions.tools) {
43
- sections.push(`- ${tool}`);
44
- }
45
- }
46
- // MCP configuration (Gemini supports MCP servers)
47
- if (platformInstructions.mcpConfig && Object.keys(platformInstructions.mcpConfig).length > 0) {
48
- sections.push('');
49
- sections.push('## MCP Servers');
50
- sections.push('');
51
- sections.push('```json');
52
- sections.push(JSON.stringify(platformInstructions.mcpConfig, null, 2));
53
- sections.push('```');
54
- }
55
- let result = sections.join('\n');
56
- const maxLength = config.maxPromptLength ?? MAX_CONTEXT_LENGTH;
57
- if (result.length > maxLength) {
58
- result = result.slice(0, maxLength);
59
- }
60
- return result;
61
- }
62
- getTargetId() {
63
- return TARGET_ID;
64
- }
65
- getCapabilities() {
66
- return CAPABILITIES;
67
- }
68
- getInjectionMethod() {
69
- return 'file';
70
- }
71
- }
1
+ const i="gemini-cli",g=1e6,n={supportsMarkdown:!0,supportsMultiFile:!0,supportsMultiTurn:!0,supportsTools:!0,maxContextLength:1e6};class r{formatPrompt(u,t,h){const e=[];if(e.push(u),t.contextFiles&&t.contextFiles.length>0){e.push(""),e.push("## Standards"),e.push("");for(const o of t.contextFiles)e.push(`@import ${o}`)}if(t.tools&&t.tools.length>0){e.push(""),e.push("## Available Tools"),e.push("");for(const o of t.tools)e.push(`- ${o}`)}t.mcpConfig&&Object.keys(t.mcpConfig).length>0&&(e.push(""),e.push("## MCP Servers"),e.push(""),e.push("```json"),e.push(JSON.stringify(t.mcpConfig,null,2)),e.push("```"));let s=e.join(`
2
+ `);const p=h.maxPromptLength??1e6;return s.length>p&&(s=s.slice(0,p)),s}getTargetId(){return i}getCapabilities(){return n}getInjectionMethod(){return"file"}}export{r as GeminiAdapter};
@@ -1,42 +1,2 @@
1
- const TARGET_ID = 'grok';
2
- const MAX_CONTEXT_LENGTH = 256_000;
3
- const CAPABILITIES = {
4
- supportsMarkdown: true,
5
- supportsMultiFile: true,
6
- supportsMultiTurn: true,
7
- supportsTools: true,
8
- maxContextLength: MAX_CONTEXT_LENGTH,
9
- };
10
- export class GrokAdapter {
11
- formatPrompt(assembledPrompt, platformInstructions, config) {
12
- const sections = [assembledPrompt];
13
- if (platformInstructions.tools?.length) {
14
- sections.push('', '## Tools', '', ...platformInstructions.tools.map((tool) => `- ${tool}`));
15
- }
16
- if (platformInstructions.contextFiles?.length) {
17
- sections.push('', '## Context Files', '', ...platformInstructions.contextFiles.map((file) => `- ${file}`));
18
- }
19
- if (platformInstructions.mcpConfig && Object.keys(platformInstructions.mcpConfig).length > 0) {
20
- sections.push('', '## MCP Configuration', '', '```toml');
21
- for (const [key, value] of Object.entries(platformInstructions.mcpConfig)) {
22
- sections.push(`[mcp_servers.${key}]`);
23
- if (typeof value === 'object' && value !== null) {
24
- for (const [subKey, subValue] of Object.entries(value)) {
25
- sections.push(`${subKey} = ${JSON.stringify(subValue)}`);
26
- }
27
- }
28
- }
29
- sections.push('```');
30
- }
31
- return sections.join('\n').slice(0, config.maxPromptLength ?? MAX_CONTEXT_LENGTH);
32
- }
33
- getTargetId() {
34
- return TARGET_ID;
35
- }
36
- getCapabilities() {
37
- return CAPABILITIES;
38
- }
39
- getInjectionMethod() {
40
- return 'file';
41
- }
42
- }
1
+ const p="grok",g=256e3,l={supportsMarkdown:!0,supportsMultiFile:!0,supportsMultiTurn:!0,supportsTools:!0,maxContextLength:256e3};class c{formatPrompt(n,e,r){const t=[n];if(e.tools?.length&&t.push("","## Tools","",...e.tools.map(o=>`- ${o}`)),e.contextFiles?.length&&t.push("","## Context Files","",...e.contextFiles.map(o=>`- ${o}`)),e.mcpConfig&&Object.keys(e.mcpConfig).length>0){t.push("","## MCP Configuration","","```toml");for(const[o,s]of Object.entries(e.mcpConfig))if(t.push(`[mcp_servers.${o}]`),typeof s=="object"&&s!==null)for(const[i,u]of Object.entries(s))t.push(`${i} = ${JSON.stringify(u)}`);t.push("```")}return t.join(`
2
+ `).slice(0,r.maxPromptLength??256e3)}getTargetId(){return p}getCapabilities(){return l}getInjectionMethod(){return"file"}}export{c as GrokAdapter};
@@ -1,22 +1 @@
1
- /**
2
- * @license FSL-1.1
3
- * Copyright (c) 2026 OrNexus AI
4
- *
5
- * @neocortex/client - Target Adapters
6
- *
7
- * Platform-specific prompt formatting for 6 supported targets.
8
- *
9
- * Story 42.8
10
- */
11
- // ── Adapter Implementations ─────────────────────────────────────────────────
12
- export { ClaudeCodeAdapter } from './claude-code-adapter.js';
13
- export { CursorAdapter } from './cursor-adapter.js';
14
- export { VSCodeAdapter } from './vscode-adapter.js';
15
- export { GeminiAdapter } from './gemini-adapter.js';
16
- export { CodexAdapter } from './codex-adapter.js';
17
- export { AntigravityAdapter } from './antigravity-adapter.js';
18
- export { GrokAdapter } from './grok-adapter.js';
19
- // ── Platform Detection ──────────────────────────────────────────────────────
20
- export { detectPlatform, isValidTargetId, } from './platform-detector.js';
21
- // ── Registry ────────────────────────────────────────────────────────────────
22
- export { AdapterRegistry, createDefaultRegistry, UnknownTargetError, } from './adapter-registry.js';
1
+ import{ClaudeCodeAdapter as t}from"./claude-code-adapter.js";import{CursorAdapter as p}from"./cursor-adapter.js";import{VSCodeAdapter as d}from"./vscode-adapter.js";import{GeminiAdapter as m}from"./gemini-adapter.js";import{CodexAdapter as A}from"./codex-adapter.js";import{AntigravityAdapter as g}from"./antigravity-adapter.js";import{GrokAdapter as C}from"./grok-adapter.js";import{detectPlatform as s,isValidTargetId as u}from"./platform-detector.js";import{AdapterRegistry as c,createDefaultRegistry as k,UnknownTargetError as G}from"./adapter-registry.js";export{c as AdapterRegistry,g as AntigravityAdapter,t as ClaudeCodeAdapter,A as CodexAdapter,p as CursorAdapter,m as GeminiAdapter,C as GrokAdapter,G as UnknownTargetError,d as VSCodeAdapter,k as createDefaultRegistry,s as detectPlatform,u as isValidTargetId};
@@ -1,220 +1 @@
1
- /**
2
- * @license FSL-1.1
3
- * Copyright (c) 2026 OrNexus AI
4
- *
5
- * Platform Detector - Auto-detects the current platform target.
6
- *
7
- * Uses explicit selection and runtime environment signals to identify which AI
8
- * coding platform owns the current process. Filesystem markers can corroborate
9
- * a runtime signal, but never select a platform by themselves.
10
- *
11
- * Detection priority:
12
- * 1. --target flag (explicit override)
13
- * 2. Unambiguous platform-owned runtime signal
14
- * 3. Weak editor runtime signal when no agent runtime signal exists
15
- * 4. Fail-closed fallback -> unknown
16
- *
17
- * Story 42.8
18
- */
19
- import { existsSync } from 'node:fs';
20
- import { join } from 'node:path';
21
- const SAFE_HOST_VERSION = /^[A-Za-z0-9][A-Za-z0-9._+-]{0,63}$/;
22
- /**
23
- * Build a bounded Codex host attestation independently from platform selection.
24
- * Explicit target flags can select a fallback target, but never become trusted
25
- * native-host evidence.
26
- */
27
- export function detectNativeHostAttestation(context, detection = detectPlatform(context)) {
28
- if (detection.targetId !== 'codex')
29
- return undefined;
30
- const hasCodexRuntime = [
31
- 'CODEX_THREAD_ID',
32
- 'CODEX_SESSION_ID',
33
- 'CODEX_SANDBOX_NETWORK_DISABLED',
34
- ].some((key) => context.env[key] !== undefined);
35
- const desktopObserved = hasCodexRuntime && context.env.CODEX_REMOTE_PAYLOAD !== undefined;
36
- const hostKind = desktopObserved
37
- ? 'codex-desktop'
38
- : hasCodexRuntime
39
- ? 'codex-cli'
40
- : 'unknown';
41
- const candidateVersion = context.nativeHostVersion?.trim() ?? '';
42
- const hostVersion = SAFE_HOST_VERSION.test(candidateVersion) ? candidateVersion : null;
43
- const explicitOnly = !!context.targetFlag && !hasCodexRuntime;
44
- return Object.freeze({
45
- schemaVersion: 1,
46
- platformTarget: 'codex',
47
- hostKind,
48
- hostVersion,
49
- origin: explicitOnly
50
- ? 'explicit-override'
51
- : desktopObserved
52
- ? 'host-observed'
53
- : hasCodexRuntime
54
- ? 'environment'
55
- : 'unknown',
56
- confidence: explicitOnly || hostKind === 'unknown'
57
- ? 'unknown'
58
- : desktopObserved
59
- ? 'observed'
60
- : 'inferred',
61
- publicSafe: true,
62
- });
63
- }
64
- // ── Valid Target IDs ────────────────────────────────────────────────────────
65
- const VALID_TARGETS = new Set([
66
- 'claude-code',
67
- 'cursor',
68
- 'vscode',
69
- 'gemini',
70
- 'codex',
71
- 'opencode',
72
- 'github-copilot-cli',
73
- 'kimi',
74
- 'antigravity',
75
- 'openclaw',
76
- 'grok',
77
- 'deepseek',
78
- 'runner',
79
- 'unknown',
80
- ]);
81
- const TARGET_ALIASES = Object.freeze({
82
- claude: 'claude-code',
83
- 'claude-code': 'claude-code',
84
- cursor: 'cursor',
85
- vscode: 'vscode',
86
- 'vscode-copilot': 'vscode',
87
- gemini: 'gemini',
88
- 'gemini-cli': 'gemini',
89
- codex: 'codex',
90
- 'codex-cli': 'codex',
91
- opencode: 'opencode',
92
- 'copilot-cli': 'github-copilot-cli',
93
- 'github-copilot-cli': 'github-copilot-cli',
94
- kimi: 'kimi',
95
- antigravity: 'antigravity',
96
- openclaw: 'openclaw',
97
- 'open-claw': 'openclaw',
98
- grok: 'grok',
99
- 'grok-build': 'grok',
100
- // P225.09 (RQ-05): explicit `--platform-target deepseek` for DeepSeek Harness.
101
- deepseek: 'deepseek',
102
- 'deepseek-harness': 'deepseek',
103
- deepseek_harness: 'deepseek',
104
- dsh: 'deepseek',
105
- runner: 'runner',
106
- unknown: 'unknown',
107
- });
108
- /** Check if a string is a valid TargetId */
109
- export function isValidTargetId(value) {
110
- return VALID_TARGETS.has(value);
111
- }
112
- export function normalizeTargetId(value) {
113
- return TARGET_ALIASES[value.trim().toLowerCase()] ?? null;
114
- }
115
- const defaultFileExists = (path) => existsSync(path);
116
- // ── Detection Function ──────────────────────────────────────────────────────
117
- /**
118
- * Detect the current platform target based on the execution context.
119
- *
120
- * @param context - Detection context with cwd, env, and optional target flag
121
- * @param fileExists - Injectable filesystem check (for testing)
122
- * @returns Detection result with target ID, confidence, and reason
123
- */
124
- export function detectPlatform(context, fileExists = defaultFileExists) {
125
- // 1. Explicit --target flag (highest priority)
126
- if (context.targetFlag) {
127
- const normalized = normalizeTargetId(context.targetFlag);
128
- if (normalized) {
129
- return {
130
- targetId: normalized,
131
- confidence: 1.0,
132
- reason: `Explicit --target=${normalized} flag`,
133
- reasonCode: 'platform-target-explicit',
134
- };
135
- }
136
- return {
137
- targetId: 'unknown',
138
- confidence: 0,
139
- reason: 'Explicit platform target is not recognized',
140
- reasonCode: 'platform-target-invalid-override',
141
- };
142
- }
143
- const envIsSet = (key) => context.env[key] !== undefined;
144
- const candidates = [];
145
- const addCandidate = (targetId, signal, keys) => {
146
- if (keys.some(envIsSet))
147
- candidates.push({ targetId, signal });
148
- };
149
- // Claude Code exports CLAUDECODE=1 and CLAUDE_CODE_ENTRYPOINT to every tool process;
150
- // CLAUDE_CODE / CLAUDE_AGENT are kept for older hosts and wrappers.
151
- addCandidate('claude-code', 'Claude Code runtime', ['CLAUDECODE', 'CLAUDE_CODE_ENTRYPOINT', 'CLAUDE_CODE', 'CLAUDE_AGENT']);
152
- addCandidate('codex', 'Codex runtime', [
153
- 'CODEX_THREAD_ID',
154
- 'CODEX_SESSION_ID',
155
- 'CODEX_SANDBOX_NETWORK_DISABLED',
156
- ]);
157
- addCandidate('opencode', 'OpenCode runtime', ['OPENCODE', 'OPENCODE_SESSION_ID']);
158
- addCandidate('cursor', 'Cursor runtime', ['CURSOR_SESSION_ID', 'CURSOR_TRACE_ID']);
159
- addCandidate('gemini', 'Gemini CLI runtime', ['GEMINI_CLI']);
160
- addCandidate('github-copilot-cli', 'GitHub Copilot CLI runtime', ['COPILOT_CLI']);
161
- addCandidate('kimi', 'Kimi Code runtime', ['KIMI_SESSION_ID', 'KIMI_CODE_SESSION_ID']);
162
- addCandidate('antigravity', 'Antigravity runtime', [
163
- 'ANTIGRAVITY_SESSION_ID',
164
- 'ANTIGRAVITY_AGENT',
165
- ]);
166
- addCandidate('openclaw', 'OpenClaw runtime', ['OPENCLAW_SESSION_ID', 'OPENCLAW_GATEWAY']);
167
- addCandidate('grok', 'Grok Build runtime', ['GROK_SESSION_ID', 'GROK_AGENT', 'GROK_HOME']);
168
- const uniqueCandidates = [...new Map(candidates.map((candidate) => [candidate.targetId, candidate])).values()];
169
- if (uniqueCandidates.length > 1) {
170
- return {
171
- targetId: 'unknown',
172
- confidence: 0,
173
- reason: `Conflicting runtime platform signals: ${uniqueCandidates.map(({ targetId }) => targetId).sort().join(', ')}`,
174
- reasonCode: 'platform-target-ambiguous',
175
- };
176
- }
177
- if (uniqueCandidates.length === 1) {
178
- const candidate = uniqueCandidates[0];
179
- const corroboratingMarkers = {
180
- 'claude-code': 'CLAUDE.md',
181
- codex: 'AGENTS.md',
182
- cursor: '.cursor',
183
- gemini: 'GEMINI.md',
184
- vscode: '.vscode',
185
- grok: 'AGENTS.md',
186
- };
187
- const marker = corroboratingMarkers[candidate.targetId];
188
- const corroborated = marker ? fileExists(join(context.cwd, marker)) : false;
189
- return {
190
- targetId: candidate.targetId,
191
- confidence: corroborated ? 0.98 : 0.95,
192
- reason: `${candidate.signal} signal${corroborated ? ` corroborated by ${marker}` : ''}`,
193
- reasonCode: 'platform-target-runtime-signal',
194
- };
195
- }
196
- // Editor terminals are a weaker signal than an agent-owned process marker.
197
- if (envIsSet('VSCODE_PID') || context.env['TERM_PROGRAM'] === 'vscode') {
198
- return {
199
- targetId: 'vscode',
200
- confidence: 0.75,
201
- reason: 'VS Code runtime signal without a stronger agent runtime signal',
202
- reasonCode: 'platform-target-runtime-signal',
203
- };
204
- }
205
- const filesystemMarkers = ['AGENTS.md', '.cursor', '.cursorrules', 'CLAUDE.md', '.vscode', 'GEMINI.md'];
206
- if (filesystemMarkers.some((marker) => fileExists(join(context.cwd, marker)))) {
207
- return {
208
- targetId: 'unknown',
209
- confidence: 0,
210
- reason: 'Filesystem marker found without platform-owned runtime evidence',
211
- reasonCode: 'platform-target-filesystem-only',
212
- };
213
- }
214
- return {
215
- targetId: 'unknown',
216
- confidence: 0,
217
- reason: 'No platform runtime signals detected',
218
- reasonCode: 'platform-target-unknown',
219
- };
220
- }
1
+ import{existsSync as m}from"node:fs";import{join as l}from"node:path";const g=/^[A-Za-z0-9][A-Za-z0-9._+-]{0,63}$/;function S(n,a=O(n)){if(a.targetId!=="codex")return;const r=["CODEX_THREAD_ID","CODEX_SESSION_ID","CODEX_SANDBOX_NETWORK_DISABLED"].some(s=>n.env[s]!==void 0),i=r&&n.env.CODEX_REMOTE_PAYLOAD!==void 0,o=i?"codex-desktop":r?"codex-cli":"unknown",t=n.nativeHostVersion?.trim()??"",c=g.test(t)?t:null,e=!!n.targetFlag&&!r;return Object.freeze({schemaVersion:1,platformTarget:"codex",hostKind:o,hostVersion:c,origin:e?"explicit-override":i?"host-observed":r?"environment":"unknown",confidence:e||o==="unknown"?"unknown":i?"observed":"inferred",publicSafe:!0})}const E=new Set(["claude-code","cursor","vscode","gemini","codex","opencode","github-copilot-cli","kimi","antigravity","openclaw","grok","deepseek","runner","unknown"]),I=Object.freeze({claude:"claude-code","claude-code":"claude-code",cursor:"cursor",vscode:"vscode","vscode-copilot":"vscode",gemini:"gemini","gemini-cli":"gemini",codex:"codex","codex-cli":"codex",opencode:"opencode","copilot-cli":"github-copilot-cli","github-copilot-cli":"github-copilot-cli",kimi:"kimi",antigravity:"antigravity",openclaw:"openclaw","open-claw":"openclaw",grok:"grok","grok-build":"grok",deepseek:"deepseek","deepseek-harness":"deepseek",deepseek_harness:"deepseek",dsh:"deepseek",runner:"runner",unknown:"unknown"});function D(n){return E.has(n)}function p(n){return I[n.trim().toLowerCase()]??null}const C=n=>m(n);function O(n,a=C){if(n.targetFlag){const e=p(n.targetFlag);return e?{targetId:e,confidence:1,reason:`Explicit --target=${e} flag`,reasonCode:"platform-target-explicit"}:{targetId:"unknown",confidence:0,reason:"Explicit platform target is not recognized",reasonCode:"platform-target-invalid-override"}}const r=e=>n.env[e]!==void 0,i=[],o=(e,s,d)=>{d.some(r)&&i.push({targetId:e,signal:s})};o("claude-code","Claude Code runtime",["CLAUDECODE","CLAUDE_CODE_ENTRYPOINT","CLAUDE_CODE","CLAUDE_AGENT"]),o("codex","Codex runtime",["CODEX_THREAD_ID","CODEX_SESSION_ID","CODEX_SANDBOX_NETWORK_DISABLED"]),o("opencode","OpenCode runtime",["OPENCODE","OPENCODE_SESSION_ID"]),o("cursor","Cursor runtime",["CURSOR_SESSION_ID","CURSOR_TRACE_ID"]),o("gemini","Gemini CLI runtime",["GEMINI_CLI"]),o("github-copilot-cli","GitHub Copilot CLI runtime",["COPILOT_CLI"]),o("kimi","Kimi Code runtime",["KIMI_SESSION_ID","KIMI_CODE_SESSION_ID"]),o("antigravity","Antigravity runtime",["ANTIGRAVITY_SESSION_ID","ANTIGRAVITY_AGENT"]),o("openclaw","OpenClaw runtime",["OPENCLAW_SESSION_ID","OPENCLAW_GATEWAY"]),o("grok","Grok Build runtime",["GROK_SESSION_ID","GROK_AGENT","GROK_HOME"]);const t=[...new Map(i.map(e=>[e.targetId,e])).values()];if(t.length>1)return{targetId:"unknown",confidence:0,reason:`Conflicting runtime platform signals: ${t.map(({targetId:e})=>e).sort().join(", ")}`,reasonCode:"platform-target-ambiguous"};if(t.length===1){const e=t[0],d={"claude-code":"CLAUDE.md",codex:"AGENTS.md",cursor:".cursor",gemini:"GEMINI.md",vscode:".vscode",grok:"AGENTS.md"}[e.targetId],u=d?a(l(n.cwd,d)):!1;return{targetId:e.targetId,confidence:u?.98:.95,reason:`${e.signal} signal${u?` corroborated by ${d}`:""}`,reasonCode:"platform-target-runtime-signal"}}return r("VSCODE_PID")||n.env.TERM_PROGRAM==="vscode"?{targetId:"vscode",confidence:.75,reason:"VS Code runtime signal without a stronger agent runtime signal",reasonCode:"platform-target-runtime-signal"}:["AGENTS.md",".cursor",".cursorrules","CLAUDE.md",".vscode","GEMINI.md"].some(e=>a(l(n.cwd,e)))?{targetId:"unknown",confidence:0,reason:"Filesystem marker found without platform-owned runtime evidence",reasonCode:"platform-target-filesystem-only"}:{targetId:"unknown",confidence:0,reason:"No platform runtime signals detected",reasonCode:"platform-target-unknown"}}export{S as detectNativeHostAttestation,O as detectPlatform,D as isValidTargetId,p as normalizeTargetId};
@@ -1,12 +0,0 @@
1
- /**
2
- * @license FSL-1.1
3
- * Copyright (c) 2026 OrNexus AI
4
- *
5
- * TargetAdapter Interface - Core abstraction for platform-specific prompt formatting.
6
- *
7
- * Each platform target (Claude Code, Cursor, VS Code, Gemini CLI, Codex, Antigravity)
8
- * implements this interface to transform assembled prompts into platform-native format.
9
- *
10
- * Story 42.8
11
- */
12
- export {};
@@ -1,72 +1,2 @@
1
- /**
2
- * @license FSL-1.1
3
- * Copyright (c) 2026 OrNexus AI
4
- *
5
- * VS Code Adapter - Formats prompts for VS Code extension chat participant API.
6
- *
7
- * VS Code uses extensions and the chat API for AI interactions.
8
- * This adapter formats prompts as system messages with structured
9
- * instruction blocks suitable for the chat participant API.
10
- *
11
- * Story 42.8
12
- */
13
- // ── Constants ───────────────────────────────────────────────────────────────
14
- const TARGET_ID = 'vscode';
15
- const MAX_CONTEXT_LENGTH = 128_000;
16
- const CAPABILITIES = {
17
- supportsMarkdown: true,
18
- supportsMultiFile: true,
19
- supportsMultiTurn: true,
20
- supportsTools: true,
21
- maxContextLength: MAX_CONTEXT_LENGTH,
22
- };
23
- // ── Implementation ──────────────────────────────────────────────────────────
24
- export class VSCodeAdapter {
25
- formatPrompt(assembledPrompt, platformInstructions, config) {
26
- const sections = [];
27
- // System instruction block for VS Code chat
28
- sections.push('<system-instructions>');
29
- sections.push(assembledPrompt);
30
- sections.push('</system-instructions>');
31
- // Tool definitions block
32
- if (platformInstructions.tools && platformInstructions.tools.length > 0) {
33
- sections.push('');
34
- sections.push('<available-tools>');
35
- for (const tool of platformInstructions.tools) {
36
- sections.push(`- ${tool}`);
37
- }
38
- sections.push('</available-tools>');
39
- }
40
- // MCP configuration block
41
- if (platformInstructions.mcpConfig && Object.keys(platformInstructions.mcpConfig).length > 0) {
42
- sections.push('');
43
- sections.push('<mcp-config>');
44
- sections.push(JSON.stringify(platformInstructions.mcpConfig, null, 2));
45
- sections.push('</mcp-config>');
46
- }
47
- // Context files as instruction references
48
- if (platformInstructions.contextFiles && platformInstructions.contextFiles.length > 0) {
49
- sections.push('');
50
- sections.push('<context-files>');
51
- for (const file of platformInstructions.contextFiles) {
52
- sections.push(file);
53
- }
54
- sections.push('</context-files>');
55
- }
56
- let result = sections.join('\n');
57
- const maxLength = config.maxPromptLength ?? MAX_CONTEXT_LENGTH;
58
- if (result.length > maxLength) {
59
- result = result.slice(0, maxLength);
60
- }
61
- return result;
62
- }
63
- getTargetId() {
64
- return TARGET_ID;
65
- }
66
- getCapabilities() {
67
- return CAPABILITIES;
68
- }
69
- getInjectionMethod() {
70
- return 'api';
71
- }
72
- }
1
+ const u="vscode",c=128e3,h={supportsMarkdown:!0,supportsMultiFile:!0,supportsMultiTurn:!0,supportsTools:!0,maxContextLength:128e3};class g{formatPrompt(n,t,p){const e=[];if(e.push("<system-instructions>"),e.push(n),e.push("</system-instructions>"),t.tools&&t.tools.length>0){e.push(""),e.push("<available-tools>");for(const o of t.tools)e.push(`- ${o}`);e.push("</available-tools>")}if(t.mcpConfig&&Object.keys(t.mcpConfig).length>0&&(e.push(""),e.push("<mcp-config>"),e.push(JSON.stringify(t.mcpConfig,null,2)),e.push("</mcp-config>")),t.contextFiles&&t.contextFiles.length>0){e.push(""),e.push("<context-files>");for(const o of t.contextFiles)e.push(o);e.push("</context-files>")}let s=e.join(`
2
+ `);const i=p.maxPromptLength??128e3;return s.length>i&&(s=s.slice(0,i)),s}getTargetId(){return u}getCapabilities(){return h}getInjectionMethod(){return"api"}}export{g as VSCodeAdapter};