@ornexus/neocortex 4.66.3 → 4.66.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/release-source.json +1 -1
- package/dist/sbom.cdx.json +1194 -1194
- package/install.js +2 -0
- package/install.ps1 +89 -35
- package/install.sh +63 -99
- package/package.json +2 -2
- package/packages/client/dist/agent/refresh-stubs.d.ts +9 -0
- package/packages/client/dist/agent/refresh-stubs.js +2 -2
- package/packages/client/dist/agent/update-agent-yaml.js +1 -1
- package/packages/client/dist/agent/update-description.d.ts +23 -0
- package/packages/client/dist/agent/update-description.js +1 -2
- package/packages/client/dist/cli.js +14 -6
- package/packages/client/dist/commands/activate.js +8 -8
- package/packages/client/dist/commands/auth-doctor.d.ts +24 -0
- package/packages/client/dist/commands/auth-doctor.js +7 -0
- package/packages/client/dist/commands/invoke.d.ts +3 -1
- package/packages/client/dist/commands/invoke.js +101 -95
- package/packages/client/dist/config/profile-directory.d.ts +24 -0
- package/packages/client/dist/config/profile-directory.js +1 -1
- package/packages/client/dist/config/project-root.d.ts +40 -0
- package/packages/client/dist/config/project-root.js +1 -0
- package/packages/client/dist/errors/error-messages.js +2 -2
- package/packages/client/dist/git/epic-operational-state.d.ts +18 -0
- package/packages/client/dist/git/epic-operational-state.js +2 -2
- package/packages/client/dist/license/license-client.d.ts +2 -1
- package/packages/client/dist/license/license-client.js +1 -1
- package/packages/client/dist/migrations/epic-lifecycle-backfill.d.ts +7 -0
- package/packages/client/dist/migrations/epic-lifecycle-backfill.js +3 -3
- package/packages/shared/dist/executable-graph-catalog/contracts.js +6 -6
- package/packages/shared/dist/invocation/diagnose-degraded-continuation.d.ts +14 -0
- package/packages/shared/dist/invocation/diagnose-degraded-continuation.js +39 -0
- package/packages/shared/dist/invocation/diagnose-degraded-continuation.test.d.ts +1 -0
- package/packages/shared/dist/invocation/diagnose-degraded-continuation.test.js +26 -0
- package/packages/shared/dist/invocation/index.d.ts +1 -0
- package/packages/shared/dist/invocation/index.js +1 -0
- package/targets-stubs/antigravity/gemini.md +1 -1
- package/targets-stubs/antigravity/neocortex.md +15 -1
- package/targets-stubs/antigravity/skill/SKILL.md +18 -4
- package/targets-stubs/claude-code/neocortex-root.agent.yaml +1 -1
- package/targets-stubs/claude-code/neocortex-root.md +13 -5
- package/targets-stubs/claude-code/neocortex-sentinel.md +1 -1
- package/targets-stubs/claude-code/neocortex.agent.yaml +1 -1
- package/targets-stubs/claude-code/neocortex.md +13 -5
- package/targets-stubs/codex/AGENTS.md +20 -21
- package/targets-stubs/codex/neocortex.toml +15 -1
- package/targets-stubs/cursor/agent.md +19 -5
- package/targets-stubs/deepseek-harness/SKILL.md +15 -1
- package/targets-stubs/gemini-cli/README.md +7 -5
- package/targets-stubs/gemini-cli/agent.md +19 -5
- package/targets-stubs/gemini-cli/agents/neocortex.md +19 -5
- package/targets-stubs/gemini-cli/gemini.md +8 -7
- package/targets-stubs/gemini-cli/install-gemini.sh +29 -11
- package/targets-stubs/grok/README.md +5 -0
- package/targets-stubs/grok/SKILL.md +16 -1
- package/targets-stubs/grok/install-grok.sh +15 -6
- package/targets-stubs/kimi/neocortex.md +15 -1
- package/targets-stubs/lib/managed-config-merge.js +276 -23
- package/targets-stubs/lib/managed-profile.sh +38 -0
- package/targets-stubs/openclaw/SKILL.md +20 -17
- package/targets-stubs/opencode/neocortex-root.md +20 -22
- package/targets-stubs/opencode/neocortex.md +20 -22
- package/targets-stubs/vscode/neocortex.agent.md +19 -5
package/install.js
CHANGED
|
@@ -163,6 +163,7 @@ const FLAG_MAP_WIN32 = {
|
|
|
163
163
|
'-q': '-Quiet',
|
|
164
164
|
'--quiet': '-Quiet',
|
|
165
165
|
'--dry-run': '-DryRun',
|
|
166
|
+
'--install-sentinel': '-InstallSentinel',
|
|
166
167
|
// Suppress ASCII banner
|
|
167
168
|
'--no-banner': '-NoBanner',
|
|
168
169
|
// Show help text
|
|
@@ -323,6 +324,7 @@ function showHelp() {
|
|
|
323
324
|
console.log(` ${color.cyan('-s, --skip-project')} Instalacao somente global (padrao)`);
|
|
324
325
|
console.log(` ${color.cyan('-q, --quiet')} Modo silencioso`);
|
|
325
326
|
console.log(` ${color.cyan('--dry-run')} Mostra adapters/stubs resolvidos sem modificar arquivos`);
|
|
327
|
+
console.log(` ${color.cyan('--install-sentinel')} Instala o child isolado opcional neocortex-sentinel`);
|
|
326
328
|
console.log(` ${color.cyan('--cleanup-legacy')} Remover artefatos legados de ~/.claude/`);
|
|
327
329
|
console.log(` ${color.dim('--local')} ${color.dim('(Removido) Thin-client obrigatorio')}`);
|
|
328
330
|
console.log(` ${color.cyan('--server-url=<url>')} URL do server Neocortex`);
|
package/install.ps1
CHANGED
|
@@ -9,6 +9,7 @@ param(
|
|
|
9
9
|
[switch]$CreateProject,
|
|
10
10
|
[switch]$Quiet,
|
|
11
11
|
[switch]$DryRun,
|
|
12
|
+
[switch]$InstallSentinel,
|
|
12
13
|
[switch]$NoBanner,
|
|
13
14
|
[switch]$CleanupLegacy,
|
|
14
15
|
[switch]$Local,
|
|
@@ -18,7 +19,7 @@ param(
|
|
|
18
19
|
[string]$ServerUrl = ('https://{0}.{1}.{2}' -f 'api','neocortex','sh')
|
|
19
20
|
)
|
|
20
21
|
|
|
21
|
-
$VERSION = "4.66.
|
|
22
|
+
$VERSION = "4.66.5"
|
|
22
23
|
|
|
23
24
|
# =============================================================================
|
|
24
25
|
# CONFIGURACOES
|
|
@@ -68,6 +69,7 @@ if ($Help) {
|
|
|
68
69
|
Write-Host " -SkipProject Instalacao somente global (padrao)" -ForegroundColor Cyan
|
|
69
70
|
Write-Host " -Quiet Modo silencioso" -ForegroundColor Cyan
|
|
70
71
|
Write-Host " -DryRun Mostra adapters/stubs resolvidos sem modificar arquivos" -ForegroundColor Cyan
|
|
72
|
+
Write-Host " -InstallSentinel Instala o child isolado opcional neocortex-sentinel" -ForegroundColor Cyan
|
|
71
73
|
Write-Host " -CleanupLegacy (Redundante) Limpeza agora e automatica" -ForegroundColor Cyan
|
|
72
74
|
Write-Host " -Local (Removido) Thin-client obrigatorio, zero IP no client" -ForegroundColor DarkGray
|
|
73
75
|
Write-Host " -ServerUrl <url> Override avancado do endpoint remoto" -ForegroundColor Cyan
|
|
@@ -160,12 +162,19 @@ function Show-TargetResolutionDryRun {
|
|
|
160
162
|
switch ($target) {
|
|
161
163
|
"cursor" { Write-Info "Dry-run MCP target=cursor file=$HOME\.cursor\mcp.json root=mcpServers managed=playwright,browser_use,figma,shadcn,chrome-devtools action=add-or-update-preserve-custom" }
|
|
162
164
|
"vscode" { Write-Info "Dry-run MCP target=vscode file=$(Get-VsCodeUserMcpPath) root=servers managed=playwright,browser_use,figma,shadcn,chrome-devtools action=add-or-update-preserve-custom" }
|
|
163
|
-
"gemini" {
|
|
164
|
-
|
|
165
|
+
"gemini" {
|
|
166
|
+
Write-Info "Dry-run Agent target=gemini file=$HOME\.gemini\agents\neocortex.md action=install-orchestrator aliases=retire-if-managed sentinel=$(if ($InstallSentinel) { 'install' } else { 'retire-if-managed' })"
|
|
167
|
+
Write-Info "Dry-run MCP target=gemini file=$HOME\.gemini\settings.json root=mcpServers managed=playwright,browser_use,figma,shadcn,chrome-devtools action=add-or-update-preserve-custom"
|
|
168
|
+
}
|
|
169
|
+
"gemini-cli" {
|
|
170
|
+
Write-Info "Dry-run Agent target=gemini file=$HOME\.gemini\agents\neocortex.md action=install-orchestrator aliases=retire-if-managed sentinel=$(if ($InstallSentinel) { 'install' } else { 'retire-if-managed' })"
|
|
171
|
+
Write-Info "Dry-run MCP target=gemini file=$HOME\.gemini\settings.json root=mcpServers managed=playwright,browser_use,figma,shadcn,chrome-devtools action=add-or-update-preserve-custom"
|
|
172
|
+
}
|
|
165
173
|
"codex" { Write-Info "Dry-run MCP target=codex file=$HOME\.codex\config.toml root=mcp_servers managed=playwright,browser_use,figma,shadcn,chrome-devtools action=replace-managed-sections-preserve-unknown" }
|
|
166
174
|
"grok" {
|
|
167
175
|
$grokHome = if ($env:GROK_HOME) { $env:GROK_HOME } else { Join-Path $HOME ".grok" }
|
|
168
176
|
Write-Info "Dry-run Skill target=grok file=$(Join-Path $grokHome 'skills\neocortex\SKILL.md') project=.grok\skills\neocortex\SKILL.md"
|
|
177
|
+
Write-Info "Dry-run Agent target=grok file=$(Join-Path $grokHome 'agents\neocortex-sentinel.md') action=$(if ($InstallSentinel) { 'install-optional' } else { 'retire-if-managed' })"
|
|
169
178
|
Write-Info "Dry-run MCP target=grok file=$(Join-Path $grokHome 'config.toml') root=mcp_servers managed=playwright,browser_use,figma,shadcn,chrome-devtools action=replace-managed-sections-preserve-unknown"
|
|
170
179
|
}
|
|
171
180
|
"opencode" { Write-Info "Dry-run MCP target=opencode file=$(Join-Path (Get-OpenCodeHome) 'opencode.json') root=mcp managed=playwright,browser_use,figma,shadcn,chrome-devtools action=add-or-update-preserve-custom" }
|
|
@@ -339,6 +348,15 @@ function Copy-ManagedFile {
|
|
|
339
348
|
}
|
|
340
349
|
$manifest = Get-ManagedManifestPath -BaseDir $BaseDir
|
|
341
350
|
$arguments = @($helper, "profile", $Source, $target, $manifest, $BaseDir, $ManagedId, "--adopt-legacy")
|
|
351
|
+
# P231.05 AC4: same tier transform as install.sh, applied by the helper before planning.
|
|
352
|
+
# Like install.sh: only an explicit config tier is forwarded (no implicit "free").
|
|
353
|
+
$tierValue = ""
|
|
354
|
+
$tierConfig = Join-Path (Join-Path $HOME ".neocortex") "config.json"
|
|
355
|
+
if (Test-Path $tierConfig -PathType Leaf) {
|
|
356
|
+
try { $tierCfg = Get-Content -Path $tierConfig -Raw -ErrorAction Stop | ConvertFrom-Json -ErrorAction Stop; if ($tierCfg.tier -is [string]) { $tierValue = $tierCfg.tier } } catch { }
|
|
357
|
+
}
|
|
358
|
+
$tierLabel = switch -CaseSensitive ($tierValue) { "free" { "Free" } "pro" { "Pro" } "enterprise" { "Enterprise" } default { "" } }
|
|
359
|
+
if ($tierLabel) { $arguments += "--tier=$tierLabel" }
|
|
342
360
|
if ($LegacyCopy -and (Test-Path $LegacyCopy)) { $arguments += "--legacy-copy=$LegacyCopy" }
|
|
343
361
|
if ($DryRun) { $arguments += "--dry-run" }
|
|
344
362
|
$output = (& node @arguments 2>&1 | Out-String)
|
|
@@ -365,6 +383,25 @@ function Copy-ManagedFile {
|
|
|
365
383
|
return $true
|
|
366
384
|
}
|
|
367
385
|
|
|
386
|
+
function Remove-ManagedProfile {
|
|
387
|
+
param(
|
|
388
|
+
[string]$Destination,
|
|
389
|
+
[string]$ManagedId,
|
|
390
|
+
[string]$BaseDir = $env:USERPROFILE
|
|
391
|
+
)
|
|
392
|
+
$helper = Get-ManagedConfigHelper
|
|
393
|
+
if (-not $helper) { return $false }
|
|
394
|
+
$manifest = Get-ManagedManifestPath -BaseDir $BaseDir
|
|
395
|
+
$arguments = @($helper, "retire-legacy", $Destination, $manifest, $BaseDir, $ManagedId)
|
|
396
|
+
if ($DryRun) { $arguments += "--dry-run" }
|
|
397
|
+
$output = (& node @arguments 2>&1 | Out-String)
|
|
398
|
+
if ($LASTEXITCODE -ne 0) { return $false }
|
|
399
|
+
if ($output -match '"action":"preserved"') {
|
|
400
|
+
Write-Warn "Perfil legado personalizado preservado em $Destination"
|
|
401
|
+
}
|
|
402
|
+
return $true
|
|
403
|
+
}
|
|
404
|
+
|
|
368
405
|
# P228.19 (P228-CON-MANIFEST-MIGRATION): managed id of an agent role file.
|
|
369
406
|
# Same table as AGENT_ROLE_TABLE in targets-stubs\lib\managed-config-merge.js.
|
|
370
407
|
function Get-AgentRoleManagedId {
|
|
@@ -383,8 +420,8 @@ function Get-AgentRoleManagedId {
|
|
|
383
420
|
return ""
|
|
384
421
|
}
|
|
385
422
|
|
|
386
|
-
#
|
|
387
|
-
#
|
|
423
|
+
# Public topology: one orchestrator by default; sentinel only with explicit
|
|
424
|
+
# -InstallSentinel. Historical root aliases are retired conservatively.
|
|
388
425
|
function Install-AgentRoleProfiles {
|
|
389
426
|
param(
|
|
390
427
|
[string]$Platform,
|
|
@@ -400,10 +437,13 @@ function Install-AgentRoleProfiles {
|
|
|
400
437
|
$script:AgentRoleOrchestratorAction = ""
|
|
401
438
|
$files = @("neocortex-sentinel.$ext", "neocortex.$ext", "neocortex-root.$ext")
|
|
402
439
|
foreach ($file in $files) {
|
|
403
|
-
if ($OrchestratorOnly -and ($file -eq "neocortex-root.$ext")) { continue }
|
|
404
440
|
if (-not (Test-Path (Join-Path $SourceDir $file) -PathType Leaf)) { continue }
|
|
405
441
|
$id = Get-AgentRoleManagedId -Platform $Platform -Scope $Scope -File $file
|
|
406
442
|
if (-not $id) { continue }
|
|
443
|
+
if (($file -eq "neocortex-root.$ext") -or (($file -eq "neocortex-sentinel.$ext") -and (-not $InstallSentinel))) {
|
|
444
|
+
if (-not (Remove-ManagedProfile -Destination (Join-Path $AgentsDir $file) -ManagedId $id -BaseDir $BaseDir)) { $ok = $false }
|
|
445
|
+
continue
|
|
446
|
+
}
|
|
407
447
|
$legacyCopy = ""
|
|
408
448
|
if ($LegacyDir -and (Test-Path (Join-Path $LegacyDir $file) -PathType Leaf)) { $legacyCopy = Join-Path $LegacyDir $file }
|
|
409
449
|
if (-not $DryRun) { New-Item -ItemType Directory -Path $AgentsDir -Force | Out-Null }
|
|
@@ -1375,24 +1415,20 @@ function Install-Agent {
|
|
|
1375
1415
|
# each CAS-guarded by the helper. The nested legacy agent (not discovered by
|
|
1376
1416
|
# Claude Code) is removed by the helper only with a known managed hash (AM-04).
|
|
1377
1417
|
$legacyMd = Join-Path $script:DestDir "neocortex.md"
|
|
1378
|
-
if (Test-Path "$claudeTargetDir\neocortex-sentinel.md") {
|
|
1418
|
+
if ($InstallSentinel -and (Test-Path "$claudeTargetDir\neocortex-sentinel.md")) {
|
|
1379
1419
|
$sentinelResult = Copy-ManagedFile -Source "$claudeTargetDir\neocortex-sentinel.md" -Destination (Join-Path $script:AgentsDir "neocortex-sentinel.md") -ManagedId "profile-claude-neocortex-sentinel-agent" -BaseDir $env:USERPROFILE
|
|
1380
1420
|
if (-not $sentinelResult) { $script:Errors++; Write-Fail "Falha ao copiar neocortex-sentinel.md de $claudeTargetDir" }
|
|
1421
|
+
} else {
|
|
1422
|
+
$null = Remove-ManagedProfile -Destination (Join-Path $script:AgentsDir "neocortex-sentinel.md") -ManagedId "profile-claude-neocortex-sentinel-agent" -BaseDir $env:USERPROFILE
|
|
1381
1423
|
}
|
|
1382
1424
|
$stubResult1 = Copy-ManagedFile -Source "$claudeTargetDir\neocortex.md" -Destination $destMd -ManagedId "profile-claude-neocortex-agent" -BaseDir $env:USERPROFILE -LegacyCopy $legacyMd
|
|
1383
1425
|
if (-not $stubResult1) { $script:Errors++; Write-Fail "Falha ao copiar neocortex.md de $claudeTargetDir" }
|
|
1384
1426
|
Write-Dbg "Install-Agent: Copy neocortex.md result=$stubResult1"
|
|
1385
|
-
|
|
1386
|
-
$stubResultRoot = Copy-ManagedFile -Source "$claudeTargetDir\neocortex-root.md" -Destination (Join-Path $script:AgentsDir "neocortex-root.md") -ManagedId "profile-claude-neocortex-root-agent" -BaseDir $env:USERPROFILE -LegacyCopy (Join-Path $script:DestDir "neocortex-root.md")
|
|
1387
|
-
if (-not $stubResultRoot) { $script:Errors++; Write-Fail "Falha ao copiar neocortex-root.md de $claudeTargetDir" }
|
|
1388
|
-
}
|
|
1427
|
+
$null = Remove-ManagedProfile -Destination (Join-Path $script:AgentsDir "neocortex-root.md") -ManagedId "profile-claude-neocortex-root-agent" -BaseDir $env:USERPROFILE
|
|
1389
1428
|
$stubResult2 = Copy-Silent "$claudeTargetDir\neocortex.agent.yaml" "$script:DestDir\"
|
|
1390
1429
|
if (-not $stubResult2) { Write-Fail "Falha ao copiar neocortex.agent.yaml de $claudeTargetDir" }
|
|
1391
1430
|
Write-Dbg "Install-Agent: Copy neocortex.agent.yaml result=$stubResult2"
|
|
1392
|
-
|
|
1393
|
-
if ((Test-Path "$claudeTargetDir\neocortex-root.md") -and (Test-Path "$claudeTargetDir\neocortex-root.agent.yaml")) {
|
|
1394
|
-
$null = Copy-Silent "$claudeTargetDir\neocortex-root.agent.yaml" "$script:DestDir\"
|
|
1395
|
-
}
|
|
1431
|
+
$null = Remove-ManagedProfile -Destination (Join-Path $script:DestDir "neocortex-root.agent.yaml") -ManagedId "profile-claude-code-.claude-agents-neocortex-neocortex-root.agent.yaml" -BaseDir $env:USERPROFILE
|
|
1396
1432
|
|
|
1397
1433
|
# 4.64.5: v4 story worktrees must start from the epic checkout (local HEAD).
|
|
1398
1434
|
# Additive: only sets Claude Code worktree.baseRef when it is absent.
|
|
@@ -1658,13 +1694,19 @@ function Install-Targets {
|
|
|
1658
1694
|
$geminiHome = if ($env:GEMINI_HOME) { $env:GEMINI_HOME } else { "$homeDir\.gemini" }
|
|
1659
1695
|
if ($geminiTargetDir -and (Test-Path $geminiTargetDir -PathType Container)) {
|
|
1660
1696
|
# P201.08: preserve existing agents/skills; update owned files only.
|
|
1697
|
+
New-Item -ItemType Directory -Path "$geminiHome\agents" -Force | Out-Null
|
|
1698
|
+
$geminiBase = Get-ManagedPlatformBase -PlatformHome $geminiHome -DefaultBase $homeDir
|
|
1661
1699
|
|
|
1662
1700
|
if (Test-Path "$geminiTargetDir\agents\neocortex.md") {
|
|
1663
|
-
|
|
1664
|
-
Copy-ManagedFile -Source "$geminiTargetDir\agents\neocortex.md" -Destination "$geminiHome\agents\neocortex.md" -ManagedId "profile-gemini-neocortex" -BaseDir (Get-ManagedPlatformBase -PlatformHome $geminiHome -DefaultBase $homeDir) | Out-Null
|
|
1701
|
+
Copy-ManagedFile -Source "$geminiTargetDir\agents\neocortex.md" -Destination "$geminiHome\agents\neocortex.md" -ManagedId "profile-gemini-neocortex" -BaseDir $geminiBase | Out-Null
|
|
1665
1702
|
} elseif (Test-Path "$geminiTargetDir\agent.md") {
|
|
1666
|
-
|
|
1667
|
-
|
|
1703
|
+
Copy-ManagedFile -Source "$geminiTargetDir\agent.md" -Destination "$geminiHome\agents\neocortex.md" -ManagedId "profile-gemini-neocortex" -BaseDir $geminiBase | Out-Null
|
|
1704
|
+
}
|
|
1705
|
+
$null = Remove-ManagedProfile -Destination "$geminiHome\agents\neocortex-root.md" -ManagedId "profile-gemini-neocortex-root" -BaseDir $geminiBase
|
|
1706
|
+
if ($InstallSentinel -and (Test-Path "$geminiTargetDir\agents\neocortex-sentinel.md" -PathType Leaf)) {
|
|
1707
|
+
Copy-ManagedFile -Source "$geminiTargetDir\agents\neocortex-sentinel.md" -Destination "$geminiHome\agents\neocortex-sentinel.md" -ManagedId "profile-gemini-neocortex-sentinel" -BaseDir $geminiBase | Out-Null
|
|
1708
|
+
} else {
|
|
1709
|
+
$null = Remove-ManagedProfile -Destination "$geminiHome\agents\neocortex-sentinel.md" -ManagedId "profile-gemini-neocortex-sentinel" -BaseDir $geminiBase
|
|
1668
1710
|
}
|
|
1669
1711
|
if (Test-Path "$geminiTargetDir\gemini.md") {
|
|
1670
1712
|
Copy-ManagedFile -Source "$geminiTargetDir\gemini.md" -Destination "$homeDir\GEMINI.md" -ManagedId "profile-gemini-root" -BaseDir $homeDir | Out-Null
|
|
@@ -1724,7 +1766,14 @@ function Install-Targets {
|
|
|
1724
1766
|
$grokHome = if ($env:GROK_HOME) { $env:GROK_HOME } else { Join-Path $homeDir ".grok" }
|
|
1725
1767
|
if ($grokTargetDir -and (Test-Path "$grokTargetDir\SKILL.md" -PathType Leaf)) {
|
|
1726
1768
|
New-Item -ItemType Directory -Path "$grokHome\skills\neocortex" -Force | Out-Null
|
|
1727
|
-
|
|
1769
|
+
$grokBase = Get-ManagedPlatformBase -PlatformHome $grokHome -DefaultBase $homeDir
|
|
1770
|
+
Copy-ManagedFile -Source "$grokTargetDir\SKILL.md" -Destination "$grokHome\skills\neocortex\SKILL.md" -ManagedId "profile-grok-neocortex" -BaseDir $grokBase | Out-Null
|
|
1771
|
+
if ($InstallSentinel -and (Test-Path "$grokTargetDir\agents\neocortex-sentinel.md" -PathType Leaf)) {
|
|
1772
|
+
New-Item -ItemType Directory -Path "$grokHome\agents" -Force | Out-Null
|
|
1773
|
+
Copy-ManagedFile -Source "$grokTargetDir\agents\neocortex-sentinel.md" -Destination "$grokHome\agents\neocortex-sentinel.md" -ManagedId "profile-grok-agent-neocortex-sentinel" -BaseDir $grokBase | Out-Null
|
|
1774
|
+
} else {
|
|
1775
|
+
$null = Remove-ManagedProfile -Destination "$grokHome\agents\neocortex-sentinel.md" -ManagedId "profile-grok-agent-neocortex-sentinel" -BaseDir $grokBase
|
|
1776
|
+
}
|
|
1728
1777
|
if (Test-Path "$grokTargetDir\config-mcp.toml") {
|
|
1729
1778
|
Merge-CodexMcpToml -StubFile "$grokTargetDir\config-mcp.toml" -DestFile "$grokHome\config.toml" -TargetName "Grok"
|
|
1730
1779
|
}
|
|
@@ -1765,15 +1814,10 @@ function Install-Targets {
|
|
|
1765
1814
|
"opencode" {
|
|
1766
1815
|
$opencodeTargetDir = Resolve-TargetDir -Target "opencode"
|
|
1767
1816
|
$opencodeHome = Get-OpenCodeHome
|
|
1768
|
-
if ($opencodeTargetDir -and (Test-Path "$opencodeTargetDir\neocortex.md")
|
|
1817
|
+
if ($opencodeTargetDir -and (Test-Path "$opencodeTargetDir\neocortex.md")) {
|
|
1769
1818
|
New-Item -ItemType Directory -Path "$opencodeHome\agents" -Force | Out-Null
|
|
1770
|
-
# P228.19: sentinel -> orchestrator -> alias, CAS-guarded by the helper.
|
|
1771
1819
|
$opencodeBase = Get-ManagedPlatformBase -PlatformHome $opencodeHome -DefaultBase $homeDir
|
|
1772
|
-
|
|
1773
|
-
Copy-ManagedFile -Source "$opencodeTargetDir\neocortex-sentinel.md" -Destination "$opencodeHome\agents\neocortex-sentinel.md" -ManagedId "profile-opencode-neocortex-sentinel" -BaseDir $opencodeBase | Out-Null
|
|
1774
|
-
}
|
|
1775
|
-
Copy-ManagedFile -Source "$opencodeTargetDir\neocortex.md" -Destination "$opencodeHome\agents\neocortex.md" -ManagedId "profile-opencode-neocortex" -BaseDir $opencodeBase | Out-Null
|
|
1776
|
-
Copy-ManagedFile -Source "$opencodeTargetDir\neocortex-root.md" -Destination "$opencodeHome\agents\neocortex-root.md" -ManagedId "profile-opencode-neocortex-root" -BaseDir $opencodeBase | Out-Null
|
|
1820
|
+
$null = Install-AgentRoleProfiles -Platform "opencode" -SourceDir $opencodeTargetDir -AgentsDir "$opencodeHome\agents" -BaseDir $opencodeBase -Scope "user"
|
|
1777
1821
|
if (Test-Path "$opencodeTargetDir\opencode-mcp.json") {
|
|
1778
1822
|
Merge-JsonMcpConfig -StubFile "$opencodeTargetDir\opencode-mcp.json" -DestFile "$opencodeHome\opencode.json" -RootKey "mcp"
|
|
1779
1823
|
}
|
|
@@ -1888,9 +1932,11 @@ function New-ProjectDirectories {
|
|
|
1888
1932
|
$projectAgentMd = "$projectDir\.claude\agents\neocortex.md"
|
|
1889
1933
|
# P228.19: sentinel before the orchestrator; the nested legacy agent
|
|
1890
1934
|
# is removed by the helper only with a known hash (AM-04).
|
|
1891
|
-
if (Test-Path "$claudeTargetDir\neocortex-sentinel.md") {
|
|
1935
|
+
if ($InstallSentinel -and (Test-Path "$claudeTargetDir\neocortex-sentinel.md")) {
|
|
1892
1936
|
$r = Copy-ManagedFile -Source "$claudeTargetDir\neocortex-sentinel.md" -Destination "$projectDir\.claude\agents\neocortex-sentinel.md" -ManagedId "project-claude-neocortex-sentinel-agent" -BaseDir $projectDir
|
|
1893
1937
|
if (-not $r) { $script:Errors++; Write-Fail "Falha ao copiar neocortex-sentinel.md (projeto)" }
|
|
1938
|
+
} else {
|
|
1939
|
+
$null = Remove-ManagedProfile -Destination "$projectDir\.claude\agents\neocortex-sentinel.md" -ManagedId "project-claude-neocortex-sentinel-agent" -BaseDir $projectDir
|
|
1894
1940
|
}
|
|
1895
1941
|
$r = Copy-ManagedFile -Source "$claudeTargetDir\neocortex.md" -Destination $projectAgentMd -ManagedId "project-claude-neocortex-agent" -BaseDir $projectDir -LegacyCopy "$agentDest\neocortex.md"
|
|
1896
1942
|
if (-not $r) { $script:Errors++; Write-Fail "Falha ao copiar neocortex.md (projeto)" }
|
|
@@ -1964,6 +2010,13 @@ function New-ProjectDirectories {
|
|
|
1964
2010
|
New-Item -ItemType Directory -Path "$projectDir\.gemini\agents" -Force | Out-Null
|
|
1965
2011
|
Copy-ManagedFile -Source "$geminiTargetDir\agent.md" -Destination "$projectDir\.gemini\agents\neocortex.md" -ManagedId "project-gemini-neocortex" -BaseDir $projectDir | Out-Null
|
|
1966
2012
|
}
|
|
2013
|
+
$null = Remove-ManagedProfile -Destination "$projectDir\.gemini\agents\neocortex-root.md" -ManagedId "project-gemini-neocortex-root" -BaseDir $projectDir
|
|
2014
|
+
if ($InstallSentinel -and (Test-Path "$geminiTargetDir\agents\neocortex-sentinel.md" -PathType Leaf)) {
|
|
2015
|
+
New-Item -ItemType Directory -Path "$projectDir\.gemini\agents" -Force | Out-Null
|
|
2016
|
+
Copy-ManagedFile -Source "$geminiTargetDir\agents\neocortex-sentinel.md" -Destination "$projectDir\.gemini\agents\neocortex-sentinel.md" -ManagedId "project-gemini-neocortex-sentinel" -BaseDir $projectDir | Out-Null
|
|
2017
|
+
} else {
|
|
2018
|
+
$null = Remove-ManagedProfile -Destination "$projectDir\.gemini\agents\neocortex-sentinel.md" -ManagedId "project-gemini-neocortex-sentinel" -BaseDir $projectDir
|
|
2019
|
+
}
|
|
1967
2020
|
$targetSummary += "gemini"
|
|
1968
2021
|
}
|
|
1969
2022
|
}
|
|
@@ -1984,6 +2037,12 @@ function New-ProjectDirectories {
|
|
|
1984
2037
|
$skillDestDir = "$projectDir\.grok\skills\neocortex"
|
|
1985
2038
|
New-Item -ItemType Directory -Path $skillDestDir -Force | Out-Null
|
|
1986
2039
|
Copy-ManagedFile -Source "$grokTargetDir\SKILL.md" -Destination "$skillDestDir\SKILL.md" -ManagedId "project-grok-neocortex" -BaseDir $projectDir | Out-Null
|
|
2040
|
+
if ($InstallSentinel -and (Test-Path "$grokTargetDir\agents\neocortex-sentinel.md" -PathType Leaf)) {
|
|
2041
|
+
New-Item -ItemType Directory -Path "$projectDir\.grok\agents" -Force | Out-Null
|
|
2042
|
+
Copy-ManagedFile -Source "$grokTargetDir\agents\neocortex-sentinel.md" -Destination "$projectDir\.grok\agents\neocortex-sentinel.md" -ManagedId "project-grok-agent-neocortex-sentinel" -BaseDir $projectDir | Out-Null
|
|
2043
|
+
} else {
|
|
2044
|
+
$null = Remove-ManagedProfile -Destination "$projectDir\.grok\agents\neocortex-sentinel.md" -ManagedId "project-grok-agent-neocortex-sentinel" -BaseDir $projectDir
|
|
2045
|
+
}
|
|
1987
2046
|
$targetSummary += "grok"
|
|
1988
2047
|
}
|
|
1989
2048
|
}
|
|
@@ -2017,14 +2076,9 @@ function New-ProjectDirectories {
|
|
|
2017
2076
|
}
|
|
2018
2077
|
"opencode" {
|
|
2019
2078
|
$opencodeTargetDir = Resolve-TargetDir -Target "opencode"
|
|
2020
|
-
if ($opencodeTargetDir -and (Test-Path "$opencodeTargetDir\neocortex.md")
|
|
2079
|
+
if ($opencodeTargetDir -and (Test-Path "$opencodeTargetDir\neocortex.md")) {
|
|
2021
2080
|
New-Item -ItemType Directory -Path "$projectDir\.opencode\agents" -Force | Out-Null
|
|
2022
|
-
|
|
2023
|
-
if (Test-Path "$opencodeTargetDir\neocortex-sentinel.md") {
|
|
2024
|
-
Copy-ManagedFile -Source "$opencodeTargetDir\neocortex-sentinel.md" -Destination "$projectDir\.opencode\agents\neocortex-sentinel.md" -ManagedId "project-opencode-neocortex-sentinel" -BaseDir $projectDir | Out-Null
|
|
2025
|
-
}
|
|
2026
|
-
Copy-ManagedFile -Source "$opencodeTargetDir\neocortex.md" -Destination "$projectDir\.opencode\agents\neocortex.md" -ManagedId "project-opencode-neocortex" -BaseDir $projectDir | Out-Null
|
|
2027
|
-
Copy-ManagedFile -Source "$opencodeTargetDir\neocortex-root.md" -Destination "$projectDir\.opencode\agents\neocortex-root.md" -ManagedId "project-opencode-neocortex-root" -BaseDir $projectDir | Out-Null
|
|
2081
|
+
$null = Install-AgentRoleProfiles -Platform "opencode" -SourceDir $opencodeTargetDir -AgentsDir "$projectDir\.opencode\agents" -BaseDir $projectDir -Scope "project"
|
|
2028
2082
|
$targetSummary += "opencode"
|
|
2029
2083
|
}
|
|
2030
2084
|
}
|
package/install.sh
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
# Development Orchestrator
|
|
5
5
|
|
|
6
6
|
# Versao do instalador
|
|
7
|
-
VERSION="4.66.
|
|
7
|
+
VERSION="4.66.5"
|
|
8
8
|
|
|
9
9
|
# Flags
|
|
10
10
|
MIGRATION_DETECTED=false
|
|
@@ -50,6 +50,7 @@ QUIET_MODE=false
|
|
|
50
50
|
NO_BANNER=false
|
|
51
51
|
CLEANUP_LEGACY=false
|
|
52
52
|
DRY_RUN=false
|
|
53
|
+
INSTALL_SENTINEL=false
|
|
53
54
|
|
|
54
55
|
while [[ $# -gt 0 ]]; do
|
|
55
56
|
case $1 in
|
|
@@ -58,6 +59,7 @@ while [[ $# -gt 0 ]]; do
|
|
|
58
59
|
-s|--skip-project|--skip-projetct) PROJECT_SKIP_EXPLICIT=true; shift ;;
|
|
59
60
|
-q|--quiet) QUIET_MODE=true; shift ;;
|
|
60
61
|
--dry-run) DRY_RUN=true; shift ;;
|
|
62
|
+
--install-sentinel) INSTALL_SENTINEL=true; shift ;;
|
|
61
63
|
--no-banner) NO_BANNER=true; shift ;;
|
|
62
64
|
--cleanup-legacy) CLEANUP_LEGACY=true; shift ;;
|
|
63
65
|
--targets=*) SELECTED_TARGETS="${1#--targets=}"; shift ;;
|
|
@@ -78,6 +80,7 @@ while [[ $# -gt 0 ]]; do
|
|
|
78
80
|
echo " -s, --skip-project Instalacao somente global (padrao)"
|
|
79
81
|
echo " -q, --quiet Modo silencioso"
|
|
80
82
|
echo " --dry-run Mostra adapters/stubs resolvidos sem modificar arquivos"
|
|
83
|
+
echo " --install-sentinel Instala o child isolado opcional neocortex-sentinel"
|
|
81
84
|
echo " --cleanup-legacy (Redundante) Limpeza agora e automatica"
|
|
82
85
|
echo " --local (Removido) Thin-client obrigatorio, zero IP no client"
|
|
83
86
|
echo " --server-url=<url> Override avancado do endpoint remoto"
|
|
@@ -541,6 +544,26 @@ managed_copy_file() {
|
|
|
541
544
|
return 0
|
|
542
545
|
}
|
|
543
546
|
|
|
547
|
+
# Retire only files whose current bytes are proven by the managed manifest.
|
|
548
|
+
# User-edited/unmanaged profiles are preserved by the helper.
|
|
549
|
+
managed_retire_file() {
|
|
550
|
+
local dest="$1" managed_id="$2" base_dir="${3:-$HOME}"
|
|
551
|
+
local helper manifest output status
|
|
552
|
+
helper="$(managed_helper_path)"
|
|
553
|
+
manifest="$(managed_manifest_path "$base_dir")"
|
|
554
|
+
[ -f "$helper" ] && command -v node >/dev/null 2>&1 || return 1
|
|
555
|
+
local args=(retire-legacy "$dest" "$manifest" "$base_dir" "$managed_id")
|
|
556
|
+
[ "$DRY_RUN" = true ] && args+=(--dry-run)
|
|
557
|
+
output=$(node "$helper" "${args[@]}" 2>&1)
|
|
558
|
+
status=$?
|
|
559
|
+
managed_parse_result "$output"
|
|
560
|
+
[ "$status" -eq 0 ] || return 1
|
|
561
|
+
case "$NEOCORTEX_MANAGED_ACTION" in
|
|
562
|
+
preserved) warn "Perfil legado personalizado preservado em ${dest/#$HOME/\~}" ;;
|
|
563
|
+
esac
|
|
564
|
+
return 0
|
|
565
|
+
}
|
|
566
|
+
|
|
544
567
|
# P228.19 (P228-CON-MANIFEST-MIGRATION): managed id of an agent role file.
|
|
545
568
|
# Same table as AGENT_ROLE_TABLE in targets-stubs/lib/managed-config-merge.js.
|
|
546
569
|
agent_role_managed_id() {
|
|
@@ -558,9 +581,8 @@ agent_role_managed_id() {
|
|
|
558
581
|
esac
|
|
559
582
|
}
|
|
560
583
|
|
|
561
|
-
#
|
|
562
|
-
#
|
|
563
|
-
# sentinel precondition; this only fixes the order and reports the plan.
|
|
584
|
+
# Public topology: one orchestrator by default; sentinel only with explicit
|
|
585
|
+
# --install-sentinel. Historical root aliases are retired conservatively.
|
|
564
586
|
# Usage: install_agent_role_profiles <platform> <source_dir> <agents_dir> <base_dir> <user|project> [legacy_dir] [platform]
|
|
565
587
|
# Sets AGENT_ROLE_ORCHESTRATOR_ACTION to the orchestrator outcome.
|
|
566
588
|
install_agent_role_profiles() {
|
|
@@ -572,6 +594,10 @@ install_agent_role_profiles() {
|
|
|
572
594
|
[ -f "$source_dir/$file" ] || continue
|
|
573
595
|
id="$(agent_role_managed_id "$platform" "$scope" "$file")"
|
|
574
596
|
[ -n "$id" ] || continue
|
|
597
|
+
if [[ "$file" == neocortex-root.* ]] || { [[ "$file" == neocortex-sentinel.* ]] && [ "$INSTALL_SENTINEL" != true ]; }; then
|
|
598
|
+
managed_retire_file "$agents_dir/$file" "$id" "$base_dir" || errors=$((errors + 1))
|
|
599
|
+
continue
|
|
600
|
+
fi
|
|
575
601
|
legacy_copy=""
|
|
576
602
|
[ -n "$legacy_dir" ] && [ -f "$legacy_dir/$file" ] && legacy_copy="$legacy_dir/$file"
|
|
577
603
|
[ "$DRY_RUN" = true ] || mkdir -p "$agents_dir" 2>/dev/null
|
|
@@ -673,83 +699,15 @@ managed_platform_base() {
|
|
|
673
699
|
printf '%s\n' "${resolved:-$HOME}"
|
|
674
700
|
}
|
|
675
701
|
|
|
676
|
-
managed_reconcile_file() {
|
|
677
|
-
local target_file="$1" base_dir="$2"
|
|
678
|
-
local helper manifest
|
|
679
|
-
helper="$(managed_helper_path)"
|
|
680
|
-
manifest="$(managed_manifest_path "$base_dir")"
|
|
681
|
-
[ -f "$helper" ] && [ -f "$target_file" ] && command -v node >/dev/null 2>&1 || return 1
|
|
682
|
-
node "$helper" reconcile "$target_file" "$manifest" "$base_dir" >/dev/null 2>&1
|
|
683
|
-
}
|
|
684
|
-
|
|
685
702
|
copy_dir() {
|
|
686
703
|
local src="$1" dest="$2"
|
|
687
704
|
debug "Copiando dir: $src -> $dest"
|
|
688
705
|
[ -d "$src" ] && cp -r "$src" "$dest" 2>/dev/null
|
|
689
706
|
}
|
|
690
707
|
|
|
691
|
-
#
|
|
692
|
-
#
|
|
693
|
-
#
|
|
694
|
-
# Supports: (Free) <-> (Pro) <-> (Enterprise) in any direction.
|
|
695
|
-
# Works on both frontmatter description and banner body lines.
|
|
696
|
-
patch_description_tier() {
|
|
697
|
-
local target_file="$1"
|
|
698
|
-
local config_file="${HOME}/.neocortex/config.json"
|
|
699
|
-
|
|
700
|
-
[ -f "$target_file" ] || return 0
|
|
701
|
-
[ -f "$config_file" ] || return 0
|
|
702
|
-
local before_checksum after_checksum
|
|
703
|
-
before_checksum=$(cksum "$target_file" 2>/dev/null)
|
|
704
|
-
|
|
705
|
-
local tier
|
|
706
|
-
tier=$(cat "$config_file" 2>/dev/null | grep -o '"tier"[[:space:]]*:[[:space:]]*"[^"]*"' | head -1 | sed 's/.*"\([^"]*\)"$/\1/')
|
|
707
|
-
[ -n "$tier" ] || return 0
|
|
708
|
-
|
|
709
|
-
local tier_label
|
|
710
|
-
case "$tier" in
|
|
711
|
-
free) tier_label="Free" ;;
|
|
712
|
-
pro) tier_label="Pro" ;;
|
|
713
|
-
enterprise) tier_label="Enterprise" ;;
|
|
714
|
-
*) return 0 ;;
|
|
715
|
-
esac
|
|
716
|
-
|
|
717
|
-
# Replace ANY tier label with the correct one in non-banner lines
|
|
718
|
-
# (frontmatter description, body text, H1 headers, etc.)
|
|
719
|
-
# Each sed expression replaces one possible source tier with the target tier.
|
|
720
|
-
# If source == target, sed is a no-op (replaces X with X). This is correct.
|
|
721
|
-
sed -i.bak \
|
|
722
|
-
-e "s/(Free)/(${tier_label})/g" \
|
|
723
|
-
-e "s/(Pro)/(${tier_label})/g" \
|
|
724
|
-
-e "s/(Enterprise)/(${tier_label})/g" \
|
|
725
|
-
"$target_file" 2>/dev/null
|
|
726
|
-
rm -f "${target_file}.bak" 2>/dev/null
|
|
727
|
-
|
|
728
|
-
# Fix banner alignment: the OrNexus Team line has a fixed 62-char frame.
|
|
729
|
-
# After replacing tier labels of different lengths, re-pad to maintain alignment.
|
|
730
|
-
# Pattern: "│ ## ### ###### ## OrNexus Team (Tier)<spaces>│"
|
|
731
|
-
# Inner width must be exactly 60 chars (│ + 60 + │ = 62).
|
|
732
|
-
if grep -q "OrNexus Team (${tier_label})" "$target_file" 2>/dev/null; then
|
|
733
|
-
local prefix="│ ## ### ###### ## " # 25 chars inner prefix
|
|
734
|
-
local content="OrNexus Team (${tier_label})"
|
|
735
|
-
local content_len=${#content}
|
|
736
|
-
local pad_len=$((60 - 25 - content_len))
|
|
737
|
-
local padding=""
|
|
738
|
-
local i
|
|
739
|
-
for ((i=0; i<pad_len; i++)); do padding="${padding} "; done
|
|
740
|
-
local new_line="${prefix}${content}${padding}│"
|
|
741
|
-
# Replace the (possibly misaligned) banner line with the correctly padded one
|
|
742
|
-
sed -i.bak -e "s|│ ## ### ###### ## OrNexus Team ([^)]*).*│|${new_line}|" "$target_file" 2>/dev/null
|
|
743
|
-
rm -f "${target_file}.bak" 2>/dev/null
|
|
744
|
-
fi
|
|
745
|
-
|
|
746
|
-
debug "Tier patched to (${tier_label}) in $(basename "$target_file")"
|
|
747
|
-
after_checksum=$(cksum "$target_file" 2>/dev/null)
|
|
748
|
-
if [ "$before_checksum" != "$after_checksum" ]; then
|
|
749
|
-
managed_reconcile_file "$target_file" "$HOME" || \
|
|
750
|
-
managed_reconcile_file "$target_file" "$PWD" || true
|
|
751
|
-
fi
|
|
752
|
-
}
|
|
708
|
+
# P231.05: the former post-write tier patch (sed + manifest reconcile) was
|
|
709
|
+
# removed. Tier/version are rendered by the managed helper before planning;
|
|
710
|
+
# `reconcile` never blesses post-written bytes.
|
|
753
711
|
|
|
754
712
|
# =============================================================================
|
|
755
713
|
# DETECCAO DE VERSAO ANTIGA
|
|
@@ -1082,6 +1040,7 @@ show_target_resolution_dry_run() {
|
|
|
1082
1040
|
info "Dry-run MCP target=vscode file=$vscode_mcp root=servers managed=playwright,browser_use,figma,shadcn,chrome-devtools action=add-or-update-preserve-custom"
|
|
1083
1041
|
;;
|
|
1084
1042
|
gemini|gemini-cli)
|
|
1043
|
+
info "Dry-run Agent target=gemini file=${GEMINI_HOME:-$HOME/.gemini}/agents/neocortex.md action=install-orchestrator aliases=retire-if-managed sentinel=$([ "$INSTALL_SENTINEL" = true ] && printf install || printf retire-if-managed)"
|
|
1085
1044
|
info "Dry-run MCP target=gemini file=${GEMINI_HOME:-$HOME/.gemini}/settings.json root=mcpServers managed=playwright,browser_use,figma,shadcn,chrome-devtools action=add-or-update-preserve-custom"
|
|
1086
1045
|
;;
|
|
1087
1046
|
codex)
|
|
@@ -1091,7 +1050,7 @@ show_target_resolution_dry_run() {
|
|
|
1091
1050
|
;;
|
|
1092
1051
|
grok)
|
|
1093
1052
|
info "Dry-run Skill target=grok file=${GROK_HOME:-$HOME/.grok}/skills/neocortex/SKILL.md project=.grok/skills/neocortex/SKILL.md"
|
|
1094
|
-
info "Dry-run Agent target=grok file=${GROK_HOME:-$HOME/.grok}/agents/neocortex-sentinel.md project=.grok/agents/neocortex-sentinel.md action=
|
|
1053
|
+
info "Dry-run Agent target=grok file=${GROK_HOME:-$HOME/.grok}/agents/neocortex-sentinel.md project=.grok/agents/neocortex-sentinel.md action=$([ "$INSTALL_SENTINEL" = true ] && printf install-optional || printf retire-if-managed)"
|
|
1095
1054
|
info "Dry-run MCP target=grok file=${GROK_HOME:-$HOME/.grok}/config.toml root=mcp_servers managed=playwright,browser_use,figma,shadcn,chrome-devtools action=replace-managed-sections-preserve-unknown"
|
|
1096
1055
|
;;
|
|
1097
1056
|
opencode)
|
|
@@ -1381,9 +1340,7 @@ install_agent() {
|
|
|
1381
1340
|
# with a known managed hash (AM-04).
|
|
1382
1341
|
install_agent_role_profiles claude-code "$CLAUDE_TARGET_DIR" "$AGENTS_DIR" "$HOME" user "$DEST_DIR" || ((errors++))
|
|
1383
1342
|
copy_file "$CLAUDE_TARGET_DIR/neocortex.agent.yaml" "$DEST_DIR/" || ((errors++))
|
|
1384
|
-
|
|
1385
|
-
copy_file "$CLAUDE_TARGET_DIR/neocortex-root.agent.yaml" "$DEST_DIR/" || ((errors++))
|
|
1386
|
-
fi
|
|
1343
|
+
managed_retire_file "$DEST_DIR/neocortex-root.agent.yaml" "profile-claude-code-.claude-agents-neocortex-neocortex-root.agent.yaml" "$HOME" || ((errors++))
|
|
1387
1344
|
|
|
1388
1345
|
# 4.64.5: v4 story worktrees must start from the epic checkout (local HEAD).
|
|
1389
1346
|
# Additive: only sets Claude Code worktree.baseRef when it is absent.
|
|
@@ -1436,18 +1393,11 @@ install_targets() {
|
|
|
1436
1393
|
opencode)
|
|
1437
1394
|
local opencode_target="$SOURCE_DIR/targets-stubs/opencode"
|
|
1438
1395
|
local opencode_home="${OPENCODE_HOME:-${XDG_CONFIG_HOME:-$HOME/.config}/opencode}"
|
|
1439
|
-
if [ -f "$opencode_target/neocortex.md" ]
|
|
1396
|
+
if [ -f "$opencode_target/neocortex.md" ]; then
|
|
1440
1397
|
mkdir -p "$opencode_home/agents" 2>/dev/null
|
|
1441
1398
|
local opencode_base
|
|
1442
1399
|
opencode_base="$(managed_platform_base "$opencode_home")"
|
|
1443
|
-
|
|
1444
|
-
local opencode_sentinel_ok=0
|
|
1445
|
-
if [ -f "$opencode_target/neocortex-sentinel.md" ]; then
|
|
1446
|
-
managed_copy_file "$opencode_target/neocortex-sentinel.md" "$opencode_home/agents/neocortex-sentinel.md" "profile-opencode-neocortex-sentinel" "$opencode_base" || opencode_sentinel_ok=1
|
|
1447
|
-
fi
|
|
1448
|
-
if [ "$opencode_sentinel_ok" -eq 0 ] && \
|
|
1449
|
-
managed_copy_file "$opencode_target/neocortex.md" "$opencode_home/agents/neocortex.md" "profile-opencode-neocortex" "$opencode_base" && \
|
|
1450
|
-
managed_copy_file "$opencode_target/neocortex-root.md" "$opencode_home/agents/neocortex-root.md" "profile-opencode-neocortex-root" "$opencode_base"; then
|
|
1400
|
+
if install_agent_role_profiles opencode "$opencode_target" "$opencode_home/agents" "$opencode_base" user; then
|
|
1451
1401
|
if [ -f "$opencode_target/opencode-mcp.json" ] && command -v node >/dev/null 2>&1; then
|
|
1452
1402
|
if ! node "$SOURCE_DIR/targets-stubs/lib/mcp-merge.js" json "$opencode_target/opencode-mcp.json" "$opencode_home/opencode.json" mcp OPENCODE; then
|
|
1453
1403
|
target_results+=("$target:FAIL")
|
|
@@ -1569,7 +1519,17 @@ install_targets() {
|
|
|
1569
1519
|
. "$adapter_script"
|
|
1570
1520
|
|
|
1571
1521
|
# P228.19 AM-06: the Codex sentinel precedes the adapter's orchestrator write.
|
|
1572
|
-
[ "$target" = "codex" ]
|
|
1522
|
+
if [ "$target" = "codex" ]; then
|
|
1523
|
+
if [ "$INSTALL_SENTINEL" = true ]; then
|
|
1524
|
+
install_codex_sentinel "$HOME" user
|
|
1525
|
+
else
|
|
1526
|
+
local codex_home="$HOME/.codex"
|
|
1527
|
+
[[ "${CODEX_HOME:-}" == /* ]] && codex_home="$CODEX_HOME"
|
|
1528
|
+
local codex_base
|
|
1529
|
+
codex_base="$(managed_platform_base "$codex_home")"
|
|
1530
|
+
managed_retire_file "$codex_home/agents/neocortex-sentinel.toml" "profile-codex-neocortex-sentinel" "$codex_base"
|
|
1531
|
+
fi
|
|
1532
|
+
fi
|
|
1573
1533
|
|
|
1574
1534
|
if type "$func_name" >/dev/null 2>&1; then
|
|
1575
1535
|
"$func_name" "$SOURCE_DIR" "$HOME"
|
|
@@ -1977,9 +1937,18 @@ create_project_dirs() {
|
|
|
1977
1937
|
local stub_adapter="$SOURCE_DIR/targets-stubs/codex/install-codex.sh"
|
|
1978
1938
|
if [ -f "$stub_adapter" ]; then
|
|
1979
1939
|
. "$stub_adapter"
|
|
1980
|
-
#
|
|
1981
|
-
|
|
1982
|
-
|
|
1940
|
+
# The isolated sentinel is an explicit topology opt-in.
|
|
1941
|
+
if [ "$INSTALL_SENTINEL" = true ]; then
|
|
1942
|
+
install_codex_sentinel "$project_dir" project
|
|
1943
|
+
install_codex_sentinel "$HOME" user
|
|
1944
|
+
else
|
|
1945
|
+
managed_retire_file "$project_dir/.codex/agents/neocortex-sentinel.toml" "project-codex-neocortex-sentinel" "$project_dir"
|
|
1946
|
+
local codex_home="$HOME/.codex"
|
|
1947
|
+
[[ "${CODEX_HOME:-}" == /* ]] && codex_home="$CODEX_HOME"
|
|
1948
|
+
local codex_base
|
|
1949
|
+
codex_base="$(managed_platform_base "$codex_home")"
|
|
1950
|
+
managed_retire_file "$codex_home/agents/neocortex-sentinel.toml" "profile-codex-neocortex-sentinel" "$codex_base"
|
|
1951
|
+
fi
|
|
1983
1952
|
install_codex "$SOURCE_DIR" "$project_dir"
|
|
1984
1953
|
target_summary="${target_summary}codex, "
|
|
1985
1954
|
fi
|
|
@@ -2002,14 +1971,9 @@ create_project_dirs() {
|
|
|
2002
1971
|
;;
|
|
2003
1972
|
opencode)
|
|
2004
1973
|
local opencode_target="$SOURCE_DIR/targets-stubs/opencode"
|
|
2005
|
-
if [ -f "$opencode_target/neocortex.md" ]
|
|
1974
|
+
if [ -f "$opencode_target/neocortex.md" ]; then
|
|
2006
1975
|
mkdir -p "$project_dir/.opencode/agents" 2>/dev/null
|
|
2007
|
-
|
|
2008
|
-
if [ -f "$opencode_target/neocortex-sentinel.md" ]; then
|
|
2009
|
-
managed_copy_file "$opencode_target/neocortex-sentinel.md" "$project_dir/.opencode/agents/neocortex-sentinel.md" "project-opencode-neocortex-sentinel" "$project_dir"
|
|
2010
|
-
fi
|
|
2011
|
-
managed_copy_file "$opencode_target/neocortex.md" "$project_dir/.opencode/agents/neocortex.md" "project-opencode-neocortex" "$project_dir"
|
|
2012
|
-
managed_copy_file "$opencode_target/neocortex-root.md" "$project_dir/.opencode/agents/neocortex-root.md" "project-opencode-neocortex-root" "$project_dir"
|
|
1976
|
+
install_agent_role_profiles opencode "$opencode_target" "$project_dir/.opencode/agents" "$project_dir" project
|
|
2013
1977
|
target_summary="${target_summary}opencode, "
|
|
2014
1978
|
fi
|
|
2015
1979
|
;;
|
package/package.json
CHANGED
|
@@ -88,6 +88,8 @@ export interface StubTarget {
|
|
|
88
88
|
* agents never coexist. `.version` always stays in `destDir`.
|
|
89
89
|
*/
|
|
90
90
|
fileDestDirs?: Readonly<Record<string, string>>;
|
|
91
|
+
/** Optional source path for a destination filename (relative to sourceDir). */
|
|
92
|
+
fileSources?: Readonly<Record<string, string>>;
|
|
91
93
|
}
|
|
92
94
|
export declare const STUB_TARGETS: readonly StubTarget[];
|
|
93
95
|
interface ProjectRoleTarget {
|
|
@@ -96,6 +98,7 @@ interface ProjectRoleTarget {
|
|
|
96
98
|
readonly agentsDir: string;
|
|
97
99
|
/** [file, managed id, create when missing] in migration order. */
|
|
98
100
|
readonly roleFiles: readonly (readonly [string, string, boolean])[];
|
|
101
|
+
readonly fileSources?: Readonly<Record<string, string>>;
|
|
99
102
|
readonly legacyDir?: string;
|
|
100
103
|
}
|
|
101
104
|
/** P228.19 spec T1: project scope, migrated before the user scope. */
|
|
@@ -142,6 +145,12 @@ export interface RefreshStubsOptions {
|
|
|
142
145
|
* creates a project profile where none was installed.
|
|
143
146
|
*/
|
|
144
147
|
projectRoot?: string;
|
|
148
|
+
/**
|
|
149
|
+
* Install the isolated `neocortex-sentinel` child profile. The public
|
|
150
|
+
* default is one discoverable `neocortex` orchestrator; the sentinel is an
|
|
151
|
+
* explicit opt-in through this option or `NEOCORTEX_INSTALL_SENTINEL=1`.
|
|
152
|
+
*/
|
|
153
|
+
installSentinel?: boolean;
|
|
145
154
|
}
|
|
146
155
|
/**
|
|
147
156
|
* Refresh installed stubs if CLI version differs from installed version.
|